Support Resistance levels.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Support Resistance levels
  4. //  Author/Uploader: Graham Kavanagh 
  5. //  E-mail:          gkavanagh@e-wire.net.au
  6. //  Date/Time Added: 2003-05-22 22:25:51
  7. //  Origin:          
  8. //  Keywords:        Support Resistance
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=282
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=282
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Indicator to show support and resistance levels based on RSI indicator
  17. //  reversals
  18. //
  19. //------------------------------------------------------------------------------
  20. //Support and resistance levels using RSI.
  21. //graham Kavanagh May 2003
  22. //Load into Indicator Builder
  23. //Sensitivity of the levels can be changed with the variables
  24. //Can test different numbers live with the Param function ctrl-R with open pane
  25. RSIperiod = 5; // Param("RSI p",3,14,30,1);
  26. Percent  = 5; // Param("ZIG %",8,9,15,1);
  27. EMAperiod  = 5; //Param("EMA p",4,5,10,1);
  28. HHVperiod  = 5; //Param("HHV p",3,5,10,1);
  29. NumLine  = 1; //Param("Num Lines",3,1,20,1);
  30. Base = DEMA(RSI(RSIperiod),EMAperiod);
  31. GraphXSpace=0.5;
  32. Plot(C,"",colorBlack,styleCandle);
  33. for( i = 1; i <= numline; i++ )
  34. {
  35. ResBase = LastValue(Peak(Base,Percent,i));
  36. SupBase = LastValue(Trough(Base,Percent,i));
  37. Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
  38. Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
  39. }
  40. Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " + /*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+ "Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines ="+WriteVal(numline,1) ;