Trading ATR 10-1.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Trading ATR 10-1
  4. //  Author/Uploader: Marcelin 
  5. //  E-mail:          marcelint@xnet.ro
  6. //  Date/Time Added: 2005-03-04 15:40:51
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           basic
  10. //  Flags:           system
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=437
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=437
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  A volatility trading system.
  17. //
  18. //------------------------------------------------------------------------------
  19.   /*Developed by Tudor Marcelin - Art Invest
  20. Este un sistem care genereaza semnale pentru ziua urmatoare.*/
  21.  
  22.   k=1; /* factor de multiplicare*/
  23.     
  24. /*R rezistenta pentru ziua curenta*/
  25.     R = Ref(Close, -1)+k*Ref(ATR(10),-1); 
  26. /*S rezistenta pentru ziua curenta*/ 
  27.     S = Ref(Close, -1)-k*Ref(ATR(10),-1);
  28. Buy=Close>R;
  29. Sell=Close<S;
  30. Cump=IIf(Close>R,1,0);
  31. Vanz=IIf(Close<S,1,0);
  32. Plot(Close,"Close",colorBlack,styleCandle);
  33. Plot(R, "Rez:",colorGreen,styleDots|styleNoLine);
  34. Plot(S, "Sup:",colorRed,styleDots|styleNoLine);
  35. Buy = ExRem( Buy, Sell ); //Elimina semnalele buy consecutive
  36. Sell = ExRem( Sell, Buy ); //Elimina semnalele sell consecutive
  37. shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
  38. fig=Cump*shapeHollowUpArrow + Vanz*shapeHollowDownArrow;
  39. PlotShapes( fig, IIf( Cump, colorPaleGreen  , colorPink), 0, IIf( Cump, Low-50, High+50)); //Pentru a vizualiza semnalele consecutive eliminate de ExRem
  40. PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-50, High+50)); 
  41. AlertIf( Buy, "", "ATR 10-1 Sistem", 1 );
  42. AlertIf( Sell, "", "ATR 10-1 Sistem",2);
  43. GraphXSpace = 3;
  44. Title=EncodeColor(colorBlue)+"Sistem ATR 10-1 "+EncodeColor(colorBlack)+ " Open:"+O+" High:"+H+" Low:"+L+" Close:"+C+EncodeColor(colorGreen)+" Rez:"+R+EncodeColor(colorRed)+" Sup:"+S+EncodeColor(colorBlue)+
  45. " nDate: "+EncodeColor(colorRed)+Date();