Board logo

标题: 【摆动指标(Swing Index)】 [打印本页]

作者: 龙听    时间: 2022-11-3 13:48     标题: 【摆动指标(Swing Index)】

  1. inputs:
  2.         ColorNormLength( 14 ),                                                      
  3.                                                                                      
  4.         UpColor( Yellow ),                                                            
  5.                                      
  6.         DnColor( Cyan ),                                                            
  7.                                      
  8.         GridForegroundColor( Black ) ;   
  9. variables:
  10.         var0( 0 ),
  11.         var1( 0 ),
  12.         var2( 0 ) ;

  13. if CurrentBar = 1 then
  14.         var0 = GetAppInfo( aiApplicationType ) ;

  15. var1 = SwingIndex ;

  16. Plot1( var1, "SwingX" ) ;
  17. Plot2( 0, "ZeroLine" ) ;

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


  31. condition1 = var1 crosses over 0 ;                  
  32. if condition1 then
  33.         Alert( "Indicator turning positive" )
  34. else
  35. begin
  36. condition1 = var1 crosses under 0 ;
  37. if condition1 then
  38.         Alert( "Indicator turning negative" ) ;
  39. end;
复制代码





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