Board logo

标题: 【Rate of Chg】 [打印本页]

作者: 龙听    时间: 2022-11-3 13:11     标题: 【Rate of Chg】

  1. inputs:
  2.         Price( Close ),
  3.         ROCLength( 14 ),
  4.         AlertLength( 14 ),
  5.         ColorNormLength( 14 ),                                                      
  6.                                                                                      
  7.         UpColor( Cyan ),                                                            
  8.                                      
  9.         DnColor( Magenta ),                                                            
  10.                                      
  11.         GridForegroundColor( Black ) ;      
  12. variables:
  13.         var0( 0 ),
  14.         var1( 0 ),
  15.         var2( 0 ) ;

  16. if CurrentBar = 1 then
  17.         var0 = GetAppInfo( aiApplicationType ) ;

  18. var1 = RateofChange( Price, ROCLength ) ;
  19.        
  20. Plot1( var1, "ROC" ) ;
  21. Plot2( 0, "ZeroLine" ) ;

  22. condition1 = UpColor >= 0 and DnColor >= 0 ;
  23. if condition1 then
  24.         begin
  25.         var2 = NormGradientColor( var1, true, ColorNormLength, UpColor, DnColor ) ;
  26.         if var0 = 1 then                                
  27.                 SetPlotColor( 1, var2 )
  28.         else if var0 > 1 then                                 
  29.                 begin
  30.                 SetPlotColor( 1, GridForegroundColor ) ;
  31.                 SetPlotBGColor( 1, var2 ) ;
  32.                 end ;
  33.         end ;

  34. condition1 = HighestBar( var1, AlertLength ) = 0 ;                  
  35. if condition1 then
  36.         Alert( "Indicator at high" )
  37. else
  38. begin
  39. condition1 = LowestBar( var1, AlertLength ) = 0 ;
  40. if condition1 then
  41.         Alert( "Indicator at low" ) ;
  42. end;
复制代码





欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2