Also I get this error on every tick.
I have tried to look at the code over and over and cannot see what is different or wrong.
Hello Everyone, I need help with this error. Any and every help is appreciated.
I have created an EA and when I load it up, I am getting the error - I have three commands which are all similar but only the one above is failing please find below my code.
Thank You
This is working for me clockwork. Are you sure you have access to "Moving Average" manually from indicators menu?
Thank You Yashar, I do have access to Moving Averages. My High and Low moving average is working its the Median one that isn't. Yet I can set all these up via the Indicator menu.
So not sure why the code is failing.
Thank You Yashar, I do have access to Moving Averages. My High and Low moving average is working its the Median one that isn't. Yet I can set all these up via the Indicator menu.
So not sure why the code is failing.
//+------------------------------------------------------------------+ //| TradeMATester.mq5 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" int maHigh; int maLow; int maMid ; input int maLength = 4; int OnInit() { maHigh=iMA(_Symbol,PERIOD_CURRENT,maLength,0,MODE_SMA,PRICE_HIGH); maMid=iMA(_Symbol,PERIOD_CURRENT,maLength,0,MODE_SMA,PRICE_MEDIAN); maLow=iMA(_Symbol,PERIOD_CURRENT,maLength,0,MODE_SMA,PRICE_LOW); if ( maHigh<0 || maLow<0 || maMid<0 ) // if (adxHandle<0 || maHandle<0) { Alert("Error Creating Handles for indicators - error: ",GetLastError(),"!!"); } return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- IndicatorRelease(maHigh); IndicatorRelease(maMid); IndicatorRelease(maLow); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- ChartIndicatorAdd(ChartID(),0,maHigh); ChartIndicatorAdd(ChartID(),0,maMid); ChartIndicatorAdd(ChartID(),0,maLow); double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits); // dynamic arrays to hold the values of the indicators double maH[] ; double maM[] ; double maL[] ; //so the values of in the arrays as set with last bar as 0 ArraySetAsSeries(maH, true) ; ArraySetAsSeries(maM, true) ; ArraySetAsSeries(maL, true) ; if (CopyBuffer(maHigh,0,0,50,maH) < 0 ){Print("CopyBUfferMaH error =", GetLastError());} if (CopyBuffer(maMid,0,0,50,maM) < 0 ) {Print("CopyBUfferMaM error : ", GetLastError());} if (CopyBuffer(maLow,0,0,50,maL) < 0 ) {Print("CopyBUfferMaL error =", GetLastError());} }
Thanks when I use the tester - no error shows up, but when I try to trade I continue to get the error below
Well. I don't know what is causing it for sure (are you sure you have the error with the posted coded ?), but your code is a bit "crazy" because it requests 50 values for 3 indicators on each tick, while 49 of these values are not changing.
It should also not use "ChartIndicatorAdd()" on each tick but only once (or not at all as it's not mandatory).
Do you have a lot of chart with indicators or EA running ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Everyone, I need help with this error. Any and every help is appreciated.
I have created an EA and when I load it up, I am getting the error - I have three commands which are all similar but only the one above is failing please find below my code.
Thank You