Hi all
Can anyone help me with the following.
Im trying to write an EA that runs on an hourly chart, but I want to look at whats happening on the 5 minute window too. A couple of expressions I have....
TriggerMovingAverage = iMA(Symbol(),PERIOD_M5,8,0,MODE_EMA,0,1);
and
iClose(Symbol(),PERIOD_M5,1)
both constantly return the value 0
Any ideas what I'm doing wrong, or can this just not be done?
Many thanks for any help.
Andy
Try NULL instead of Symbol() and 5 instead of PERIOD_M5 and see what happens => iClose(NULL, 5, 1)
Or do you actually have the M5 data?
Hi all
Can anyone help me with the following.
Im trying to write an EA that runs on an hourly chart, but I want to look at whats happening on the 5 minute window too. A couple of expressions I have....
TriggerMovingAverage = iMA(Symbol(),PERIOD_M5,8,0,MODE_EMA,0,1);
and
iClose(Symbol(),PERIOD_M5,1)
both constantly return the value 0
Any ideas what I'm doing wrong, or can this just not be done?
Many thanks for any help.
Andy
- Maybe you don't have requested PERIOD_M5 data. You have to open M5 chart and check if the requested history exists. Usually H1 go far away behind M5 history.
- If your code wants to "look" at another timeframe you have to check if the requested timeframe is already loaded/refreshed to your terminal. See https://www.mql5.com/en/forum/231717/page2#comment_6809758
- AndyBill66: both constantly return the value 0On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum - iRick:
Try NULL instead of Symbol() and 5 instead of PERIOD_M5 and see what happens => iClose(NULL, 5, 1)
Or do you actually have the M5 data?
- You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, MarketInfo does not. OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don''t hard code numbers.
- No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all
Can anyone help me with the following.
Im trying to write an EA that runs on an hourly chart, but I want to look at whats happening on the 5 minute window too. A couple of expressions I have....
TriggerMovingAverage = iMA(Symbol(),PERIOD_M5,8,0,MODE_EMA,0,1);
and
iClose(Symbol(),PERIOD_M5,1)
both constantly return the value 0
Any ideas what I'm doing wrong, or can this just not be done?
Many thanks for any help.
Andy