Board logo

标题: 【动量指标(Momentum)】 [打印本页]

作者: 龙听    时间: 2022-11-3 13:37     标题: 【动量指标(Momentum)】

  1. inputs:
  2.         Price( Close ),
  3.         Length( 12 ),
  4.         ColorNormLength( 14 ),                                                      
  5.                                                                                      
  6.         UpColor( Yellow ),                                                            
  7.                                      
  8.         DnColor( Red ),                                                            
  9.                                      
  10.         GridForegroundColor( Black ) ;                                                
  11.                                                                                      
  12.                  

  13. variables:
  14.         var0( 0 ),
  15.         var1( 0 ),
  16.         var2( 0 ),
  17.         var3( 0 ) ;

  18. if CurrentBar = 1 then
  19.         var0 = GetAppInfo( aiApplicationType ) ;

  20. var1 = Momentum( Price, Length ) ;
  21. var2 = Momentum( var1, 1 ) ;                       

  22. Plot1( var1, "Momentum" ) ;
  23. Plot2( 0, "ZeroLine" ) ;

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

  36. condition1 = var1 > 0 and var2 > 0 ;                  
  37. if condition1 then
  38.         Alert( "Indicator positive and increasing" )
  39. else
  40. begin
  41. condition1 = var1 < 0 and var2 < 0 ;
  42. if condition1 then
  43.         Alert( "Indicator negative and decreasing" ) ;
  44. end;
复制代码





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