诚信为本
量力而为
当前位置:首页MetaTrader 4MT4指标价格通道 Dynamic trend cleaned up.mq4

价格通道 Dynamic trend cleaned up.mq4

Dynamic trend cleaned up 指标绘制价格通道为分析行情走势提供参考。

图表:Dynamic trend cleaned up 指标

源码:

//+------------------------------------------------------------------+
//|                                     Dynamic trend cleaned up.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright @2004, OfficeFX Group"
#property link      "http://www.125808047.com"

#property indicator_chart_window 
#property indicator_buffers 3 
#property indicator_color1 Yellow 
#property indicator_color2 Blue
#property indicator_color3 Red

double DynamicLineTrend [];
double BUYSignals [];
double SELLSignals [];
extern int Percent=15;
extern int MaxPeriod=50;

int Shift=0;

int OnInit(void)
{
SetIndexStyle (0, DRAW_LINE);
SetIndexBuffer(0, DynamicLineTrend); 

SetIndexStyle (1, DRAW_ARROW);
SetIndexArrow (1,233);
SetIndexBuffer(1, BUYSignals); 
 
SetIndexStyle (2, DRAW_ARROW);
SetIndexArrow (2,234);
SetIndexBuffer(2, SELLSignals);
Comment("www.125808047.com");
return(INIT_SUCCEEDED);
} 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function |
//+------------------------------------------------------------------+ 
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  { 
 double point=MarketInfo (Symbol (), MODE_POINT); 
 int Counted_Bars=IndicatorCounted ()-MaxPeriod; 
   for ( Shift = Counted_Bars; Shift>=0; Shift--)
  {
      if (Close [Shift] <DynamicLineTrend [Shift+1])
         {
            DynamicLineTrend [Shift] =Close [Highest (NULL, 0, MODE_CLOSE, MaxPeriod, Shift+1)]-Percent*point;
         }
    
      if (Close [Shift]>=DynamicLineTrend [Shift+1])
         {
          DynamicLineTrend [Shift] =Close [Lowest (NULL, 0, MODE_CLOSE, MaxPeriod, Shift+1)] +Percent*point;
         } 

      if (Close [Shift+3]> DynamicLineTrend [Shift+2])              
      if (Close [Shift+2] <DynamicLineTrend [Shift+3])
             BUYSignals [Shift] =Low [Shift]-10*point;
         else
             BUYSignals [Shift] =0;
        
         else
             BUYSignals [Shift] =0;
             
      if (Close [Shift+2] <DynamicLineTrend [Shift+1])       
      if (Close [Shift+2]> DynamicLineTrend [Shift+3])
             SELLSignals [Shift] =High [Shift]-10*point;
         else
             SELLSignals [Shift] =0;
       
         else 
             SELLSignals [Shift] =0;
   } 
return (rates_total);
} 
版权所有转载请注明标题及链接:峰汇在线 » 价格通道 Dynamic trend cleaned up.mq4
上一篇:
下一篇:
分享到: 更多 (0)