You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
No free help (2017)
sidra siddiqui:
any programmers add arrow ema cross up or down cross show arrow on chart
indicator is attach below
These are several MAs,which one to cross which or what,you asked round way,please try to explain well if you really want some one to help you
more preferably with some/any demonstrating picture
regards
Its not tested so there maybe a million errors in it .
#property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 7 #property indicator_plots 7 //--- plot Label1 #property indicator_label1 "SMA-1" #property indicator_type1 DRAW_LINE #property indicator_color1 clrYellow #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Label2 #property indicator_label2 "SMA-2" #property indicator_type2 DRAW_LINE #property indicator_color2 clrBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot Label3 #property indicator_label3 "SMA-3" #property indicator_type3 DRAW_LINE #property indicator_color3 clrRed #property indicator_style3 STYLE_SOLID #property indicator_width3 1 //--- plot Label4 #property indicator_label4 "SMA-4" #property indicator_type4 DRAW_LINE #property indicator_color4 clrRed #property indicator_style4 STYLE_SOLID #property indicator_width4 1 //--- plot Label5 #property indicator_label5 "SMA-5" #property indicator_type5 DRAW_LINE #property indicator_color5 clrGreen #property indicator_style5 STYLE_SOLID #property indicator_width5 1 input int fast_ma=1;//fast ma 1-5 (for trigger) input int slow_ma=2;//slow ma 1-5 (for trigger) input string notea="<->";//Moving Average 1 input ENUM_TIMEFRAMES MA1_TFPeriod = 0; input int MA1_Period = 5; input int MA1_Shift = 0; input ENUM_MA_METHOD MA1_Method = MODE_LWMA; input ENUM_APPLIED_PRICE MA1_Applied_Price = PRICE_CLOSE; input string noteb="<->";//Moving Average 2 input ENUM_TIMEFRAMES MA2_TFPeriod = 0; input int MA2_Period = 12; input int MA2_Shift = 0; input ENUM_MA_METHOD MA2_Method = MODE_LWMA; input ENUM_APPLIED_PRICE MA2_Applied_Price = PRICE_CLOSE; input string notec="<->";//Moving Average 3 input ENUM_TIMEFRAMES MA3_TFPeriod = 0; input int MA3_Period = 18; input int MA3_Shift = 0; input ENUM_MA_METHOD MA3_Method = MODE_EMA; input ENUM_APPLIED_PRICE MA3_Applied_Price = PRICE_CLOSE; input string noted="<->";//Moving Average 4 input ENUM_TIMEFRAMES MA4_TFPeriod = 0; input int MA4_Period = 28; input int MA4_Shift = 0; input ENUM_MA_METHOD MA4_Method = MODE_EMA; input ENUM_APPLIED_PRICE MA4_Applied_Price = PRICE_CLOSE; input string notee="<->";//Moving Average 5 input ENUM_TIMEFRAMES MA5_TFPeriod = 0; input int MA5_Period = 50; input int MA5_Shift = 0; input ENUM_MA_METHOD MA5_Method = MODE_SMA; input ENUM_APPLIED_PRICE MA5_Applied_Price = PRICE_CLOSE; //--- indicator buffers double MA1Buffer[]; double MA2Buffer[]; double MA3Buffer[]; double MA4Buffer[]; double MA5Buffer[]; double Up[],Down[]; int deflekt=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnInit(void) { int draw_begin1 = MA1_Period-1; int draw_begin2 = MA2_Period-1; int draw_begin3 = MA3_Period-1; int draw_begin4 = MA4_Period-1; int draw_begin5 = MA5_Period-1; //--- SetIndexBuffer(0,MA1Buffer); SetIndexBuffer(1,MA2Buffer); SetIndexBuffer(2,MA3Buffer); SetIndexBuffer(3,MA4Buffer); SetIndexBuffer(4,MA5Buffer); SetIndexBuffer(5,Up); SetIndexBuffer(6,Down); //--- for(int i=0; i<=4; i++) SetIndexShift(i,0); //--- SetIndexDrawBegin(0,draw_begin1); SetIndexDrawBegin(1,draw_begin2); SetIndexDrawBegin(2,draw_begin3); SetIndexDrawBegin(3,draw_begin4); SetIndexDrawBegin(4,draw_begin5); SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,2,clrDodgerBlue); SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,2,clrCrimson); SetIndexArrow(5,233); SetIndexArrow(6,234); //--- deflekt=MathMax(MA1_Period,MathMax(MA2_Period,MathMax(MA3_Period,MathMax(MA4_Period,MA5_Period)))); //--- IndicatorDigits(Digits); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ 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[]) { int from=rates_total-prev_calculated-deflekt; if(from<0){from=0;} //--- for(int i=from; i>=0; i--) { if(MA1_Period!=0) MA1Buffer[i]=iMA(NULL,MA1_TFPeriod,MA1_Period,MA1_Shift,MA1_Method,MA1_Applied_Price,i); if(MA2_Period!=0) MA2Buffer[i]=iMA(NULL,MA2_TFPeriod,MA2_Period,MA2_Shift,MA2_Method,MA2_Applied_Price,i); if(MA3_Period!=0) MA3Buffer[i]=iMA(NULL,MA3_TFPeriod,MA3_Period,MA3_Shift,MA3_Method,MA3_Applied_Price,i); if(MA4_Period!=0) MA4Buffer[i]=iMA(NULL,MA4_TFPeriod,MA4_Period,MA4_Shift,MA4_Method,MA4_Applied_Price,i); if(MA5_Period!=0) MA5Buffer[i]=iMA(NULL,MA5_TFPeriod,MA5_Period,MA5_Shift,MA5_Method,MA5_Applied_Price,i); int signal=check_signal(MA1Buffer,MA2Buffer,MA3Buffer,MA4Buffer,MA5Buffer,fast_ma,slow_ma,i+1,3); if(signal==1){ Up[i]=Low[i]; } else if(signal==-1){ Down[i]=High[i]; } } return(rates_total); } //+------------------------------------------------------------------+ int check_signal(double &ma1[], double &ma2[], double &ma3[], double &ma4[], double &ma5[], int _fast_ma, int _slow_ma, int i, int maxequals){ bool cross_above=false,cross_below=false; if(_fast_ma==1){ if(_slow_ma==2){find_cross(ma1,ma2,cross_above,cross_below,i,maxequals);} else if(_slow_ma==3){find_cross(ma1,ma3,cross_above,cross_below,i,maxequals);} else if(_slow_ma==4){find_cross(ma1,ma4,cross_above,cross_below,i,maxequals);} else if(_slow_ma==5){find_cross(ma1,ma5,cross_above,cross_below,i,maxequals);} } else if(_fast_ma==2){ if(_slow_ma==1){find_cross(ma2,ma1,cross_above,cross_below,i,maxequals);} else if(_slow_ma==3){find_cross(ma2,ma3,cross_above,cross_below,i,maxequals);} else if(_slow_ma==4){find_cross(ma2,ma4,cross_above,cross_below,i,maxequals);} else if(_slow_ma==5){find_cross(ma2,ma5,cross_above,cross_below,i,maxequals);} } else if(_fast_ma==3){ if(_slow_ma==1){find_cross(ma3,ma1,cross_above,cross_below,i,maxequals);} else if(_slow_ma==2){find_cross(ma3,ma2,cross_above,cross_below,i,maxequals);} else if(_slow_ma==4){find_cross(ma3,ma4,cross_above,cross_below,i,maxequals);} else if(_slow_ma==5){find_cross(ma3,ma5,cross_above,cross_below,i,maxequals);} } else if(_fast_ma==4){ if(_slow_ma==1){find_cross(ma4,ma1,cross_above,cross_below,i,maxequals);} else if(_slow_ma==2){find_cross(ma4,ma2,cross_above,cross_below,i,maxequals);} else if(_slow_ma==3){find_cross(ma4,ma3,cross_above,cross_below,i,maxequals);} else if(_slow_ma==5){find_cross(ma4,ma5,cross_above,cross_below,i,maxequals);} } else if(_fast_ma==5){ if(_slow_ma==1){find_cross(ma5,ma1,cross_above,cross_below,i,maxequals);} else if(_slow_ma==2){find_cross(ma5,ma2,cross_above,cross_below,i,maxequals);} else if(_slow_ma==3){find_cross(ma5,ma3,cross_above,cross_below,i,maxequals);} else if(_slow_ma==4){find_cross(ma5,ma4,cross_above,cross_below,i,maxequals);} } if(cross_above){return(1);} else if(cross_below){return(-1);} return(0); } bool find_cross(double &fast[], double &slow[], bool &is_cross_above, bool &is_cross_below, int i,int maxequals){ int errors=0; is_cross_above=false; is_cross_below=false; //get now double fastNow=fast[i]; double slowNow=slow[i]; fastNow=round_to_digits(fastNow,Digits); slowNow=round_to_digits(slowNow,Digits); //if fast is above slow we look for a recent breach up if(fastNow>slowNow){ int equals=0; int nav=i+1; while(is_cross_above==false&&equals<=maxequals){ double fastThen=fast[nav]; double slowThen=slow[nav]; fastThen=round_to_digits(fastThen,Digits); slowThen=round_to_digits(slowThen,Digits); if(fastThen==slowThen){equals++;nav++;} else if(fastThen<slowThen){ is_cross_above=true;return(true); }else{return(true);//if still above , no interest } } } //else if slow is abvoe fast we look for a recent breach down else if(fastNow<slowNow){ int equals=0; int nav=i+1; while(is_cross_below==false&&equals<=maxequals){ double fastThen=fast[nav]; double slowThen=slow[nav]; fastThen=round_to_digits(fastThen,Digits); slowThen=round_to_digits(slowThen,Digits); if(fastThen==slowThen){equals++;nav++;} else if(fastThen>slowThen){ is_cross_below=true;return(true); }else{return(true);//if still below , no interest } } } else if(fastNow==slowNow){return(true);} return(false); } double round_to_digits(double value,int digits){ double result=MathRound((value)*(MathPow(10.0,((double)digits)))); result/=(MathPow(10.0,((double)digits))); return(result); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
any programmers add arrow ema cross up or down cross show arrow on chart
indicator is attach below