mt4 and mt5 are not compatible!
please give up mql4
Oooops, I think I posted this in the wrong forum! Sorry. I've copied it here in the hope that someone may be able to help me. After I got no reply I tried again to sort it out myself but just cannot seem to be able to work it out.
Hi All
Yesterday I had MT4 and on it I had a simple indicator that showed me both the 14 day ATR and the current range of today's price action in numbers in a 'Comment' in the top left corner of the chart. The code I used was this-
double My_ATR=iATR(NULL,1440,periods,1);
double todays_range=iHigh(NULL,1440,0)-iLow(NULL,1440,0);
Comment("\n14 day ATR = ",My_ATR," Todays Range = ",todays_range);
As you can see it is very simple and displays the extent of my coding skills perfectly!
Today I have MT5 and decided I would like to show the same information in my charts. I have spent the last 5 hours trying to work out MT5 coding and have failed miserably. I have got to the stage where I have lost the will to live! I am sure that the MT5 coding is far more reliable and versatile than its MT4 predecessor but........................it ain't for simple folk!
Can someone convert my little bit of code to the MT5 equivalent for me please along with all the bits and pieces that need to be declared, talked about, eluded to etc?
Thanks in advance.
Regards
Paul Eamonn
It's a sad day when someone is looking for money to display ATR and daily range on a chart. WOW!!!!
#property indicator_chart_window #property indicator_plots 0 //--- User Inputs input int ATR_Period = 14; //--- Global Variables double ATR[1], High[1], Low[1]; int ATRhandle; void OnInit() { ATRhandle = iATR(NULL,PERIOD_D1,ATR_Period); ArraySetAsSeries(ATR,true); return; } void OnDeinit(const int reason) { IndicatorRelease(ATRhandle); Comment(""); return; } int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { CopyBuffer(ATRhandle,0,1,1,ATR); CopyHigh(NULL,PERIOD_D1,1,1,High); CopyLow(NULL,PERIOD_D1,1,1,Low); Comment("\n"+(string)ATR_Period+" day ATR = "+DoubleToString(ATR[0],_Digits)+" Todays Range = "+DoubleToString(High[0]-Low[0],_Digits)); return(rates_total); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Oooops, I think I posted this in the wrong forum! Sorry. I've copied it here in the hope that someone may be able to help me. After I got no reply I tried again to sort it out myself but just cannot seem to be able to work it out.
Hi All
Yesterday I had MT4 and on it I had a simple indicator that showed me both the 14 day ATR and the current range of today's price action in numbers in a 'Comment' in the top left corner of the chart. The code I used was this-
double My_ATR=iATR(NULL,1440,periods,1);
double todays_range=iHigh(NULL,1440,0)-iLow(NULL,1440,0);
Comment("\n14 day ATR = ",My_ATR," Todays Range = ",todays_range);
As you can see it is very simple and displays the extent of my coding skills perfectly!
Today I have MT5 and decided I would like to show the same information in my charts. I have spent the last 5 hours trying to work out MT5 coding and have failed miserably. I have got to the stage where I have lost the will to live! I am sure that the MT5 coding is far more reliable and versatile than its MT4 predecessor but........................it ain't for simple folk!
Can someone convert my little bit of code to the MT5 equivalent for me please along with all the bits and pieces that need to be declared, talked about, eluded to etc?
Thanks in advance.
Regards
Paul Eamonn