TRUE Forex

Просмотр кода форекс индикатора !ForbiARROWS-1.02.mq4

//+------------------------------------------------------------------+
//|                ForbiArrows.mq4 modified from                  |
//+------------------------------------------------------------------+
  
#property copyright "Copyright © 2013, Tehnobyte"


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DarkGreen
#property indicator_width1 2
#property indicator_color2 Red
#property indicator_width2 2



extern string note5 = "--------------------------------------------";
extern string note6 = "Arrow Type";
extern string note7 = "0=Thick, 1=Thin, 2=Hollow, 3=Round";
extern string note8 = "4=Fractal, 5=Diagonal Thin";
extern string note9 = "6=Diagonal Thick, 7=Diagonal Hollow";
extern string note10 = "8=Thumb, 9=Finger";
extern int ArrowType=1;
extern string note11 = "--------------------------------------------";
extern string note12 = "turn on Alert = true; turn off = false";
extern bool AlertOn = true;
extern string note13 = "--------------------------------------------";
extern string note14 = "send Email Alert = true; turn off = false";
extern bool SendAnEmail=false;
extern bool alertsNotify = true;
extern int Barlimit=500;
extern string StandardDev = "Volatilyti Filter settings";
extern bool VolatilityFilter=false;
extern double level=0.0003;
 int StdDev_MA_Period=8;  // D1=20
 int StdDev_MA_Shift=0;    //
 int StdDev_MA_Method = 0; // 0=SMA 1=EMA 2=Smoothed 3=Linear Weighted
 int StdDev_MA_Price = 4;  // 0 Close price, 1 Open price, 2 High price, 3 Low price, 4 Median price, (high+low)/2, 5 Typical price, (high+low+close)/3, 6 Weighted close price, (high+low+close+close)/4



double CrossUp[];
double CrossDown[];
double     STDBuffer[];
string AlertPrefix;
string GetTimeFrameStr() {
   switch(Period())
   {
      case 1 : string TimeFrameStr="M1"; break;
      case 5 : TimeFrameStr="M5"; break;
      case 15 : TimeFrameStr="M15"; break;
      case 30 : TimeFrameStr="M30"; break;
      case 60 : TimeFrameStr="H1"; break;
      case 240 : TimeFrameStr="H4"; break;
      case 1440 : TimeFrameStr="D1"; break;
      case 10080 : TimeFrameStr="W1"; break;
      case 43200 : TimeFrameStr="MN1"; break;
      default : TimeFrameStr=Period();
   } 
   return (TimeFrameStr);
   }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   if (ArrowType == 0) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 233);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 234);
   }
   else if (ArrowType == 1) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 225);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 226);
   }
   else if (ArrowType == 2) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 241);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 242);
   }
   else if (ArrowType == 3) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 221);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 222);
   }
   else if (ArrowType == 4) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 217);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 218);
   }
   else if (ArrowType == 5) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 228);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 230);
   }
   else if (ArrowType == 6) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 236);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 238);
   }
   else if (ArrowType == 7) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 246);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 248);
   }
   else if (ArrowType == 8) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 67);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 68);
   }
   else if (ArrowType == 9) {
      SetIndexStyle(0,DRAW_ARROW);
      SetIndexArrow(0, 71);
      SetIndexStyle(1,DRAW_ARROW);
      SetIndexArrow(1, 72);
   }
IndicatorBuffers(3);
   SetIndexBuffer(0, CrossUp);
   SetIndexBuffer(1, CrossDown);
   SetIndexBuffer(2, STDBuffer);
   AlertPrefix=Symbol()+" ("+GetTimeFrameStr()+"):  ";
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i,counter;
  // double stochastic1now, stochastic2now, stochastic1previous, stochastic2previous, stochastic1after, stochastic2after;
   double Range, AvgRange;
   static bool barp;  
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Barlimit;
   
   for(i = 0; i <= limit; i++) {
   
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;      
      double FM = iCustom(NULL,0,"Forbi_system_momentum",1,i);
      double FT = iCustom(NULL,0,"Forbi_system_timing",1,i);
      double FTS = iCustom(NULL,0,"Forbi_system_timing",0,i);
      double FM1 = iCustom(NULL,0,"Forbi_system_momentum",1,1+i);
      double FT1 = iCustom(NULL,0,"Forbi_system_timing",1,1+i);
      double FM2 = iCustom(NULL,0,"Forbi_system_momentum",1,2+i);
      double FT2 = iCustom(NULL,0,"Forbi_system_timing",1,2+i);
     
    
    
      STDBuffer[i]=iStdDev(NULL,0,StdDev_MA_Period, StdDev_MA_Shift, StdDev_MA_Method, StdDev_MA_Price, i);
     
      if (VolatilityFilter && STDBuffer[i]<level) bool volat=true; else volat=false;
    
      CrossUp[i+1]  = EMPTY_VALUE;
      CrossDown[i+1] = EMPTY_VALUE;
            
      if ((!volat&&(FM1>0)&&(FM>0) &&(FM2<=0)&& (FT1>0)&& (FT>0)&& (FTS>FT)) || (!volat&&(FT1>0)&& (FTS>FT)&&(FT2<0)&&(FM>0)) ) {
                   CrossUp[i+1] = Low[i+1] - Range*1;
                   if (AlertOn && barp!=Bars) {
                      Alert(AlertPrefix+"ForbiUP",Ask,"; Bid = ",Bid,"\nDate & Time = ",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()));
                      SendMail(Symbol(),"Forbi UP");
                       if (alertsNotify) SendNotification(StringConcatenate(Symbol(), Period() ," Forbi Up"));
                       barp=Bars;
                      
                   }   
                      
                      
                      
      }
         
      if ((!volat&&(FM1<0)&&(FM<0) &&(FM2>=0)&& (FT1<0)&& (FT<0)&& (FTS<FT)) || (!volat&&(FT1<0)&&(FT2>0)&& (FT<0)&& (FTS<FT)&&(FM<0)) ) {
                 CrossDown[i+1] = High[i+1] + Range*1;
                   if (AlertOn && barp!=Bars){
                      Alert(AlertPrefix+"ForbiDOWN ",Ask,"; Bid = ",Bid,"\nDate & Time = ",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()));
                       SendMail(Symbol(),"Forbi DOWN");
                        if (alertsNotify) SendNotification(StringConcatenate(Symbol(), Period() ," Forbi Down"));
                       barp=Bars;
                      
                   }
                     
                    
                      
      }

   }
   
   return(0);
}

Комментарии к исходному коду форекс индикатора !ForbiARROWS-1.02.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !FT mCODE.mq4
индикатор !MT4 TF DUO.mq4 »