Have either an additional D1 chart open (may be minimized),
or call iBars(Symbol(),PERIOD_D1) a couple of minutes before you call the iHigh.
What should it suppose to do? iBARS returns only number of bars right?
Why to have opened D1 graph? Do you think it will recalucate and will it help? Ill give it try. Thank you
It only triggers the asynchronous chart fetch, you do not need to care about the return value.
I wrote it here several times here - ERR_HISTORY_WILL_UPDATED does not signal the history state is (or is not) ready, but rather it signals the last command initiated asynchronous chart download.
And if you had looked at my code you would have seen that it loops until the "asynchronous chart download" has downloaded.
WHRoeder:
And if you had looked at my code you would have seen that it loops until the "asynchronous chart download" has downloaded.
And if you had looked at my code you would have seen that it loops until the "asynchronous chart download" has downloaded.
Ok, disregard my remark., my fault, sometimes it happens to me. Anyway, I noticed that the correct zero index candle time seemed to be present even if the rest of the chart, i.e. indexes >=1 were still missing, so not sure if it was 100% reliable.
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
Hello guys,
I need advice. I have never met with anything like this. I have EA, where in code I have this ( Im using high of previous day in my calculation)
[source]
if(den==0) // for historical reason, all is same
{
y_high=iHigh(Symbol(),PERIOD_D1,1);//previous day
y_low=iLow(Symbol(),PERIOD_D1,1); //previous day
}
else if(den==1) // for historical reason, all is same
{
y_high=iHigh(Symbol(),PERIOD_D1,1); //previous day
y_low=iLow(Symbol(),PERIOD_D1,1); //previous day
}
else // for historical reason, all is same
{
y_high=iHigh(Symbol(),PERIOD_D1,1); //previous day
y_low=iLow(Symbol(),PERIOD_D1,1); //previous day
}
[source]
Im using it for DAX. I have two brokers - one with night session (u can trade at night) and another one where I can trade only since 8am til 22 pm.
So my problem is that this code is not taking "yesterdays" high, but its taking high of 2 - 3 days before. On monday it took high of thursday of last week. On wednesday it took mondays high.
Im working with yesterday's high 5 minuts after market opens, so my problem can not be caused beacause of - like "Todays is not yte even a tick, so PERIOD_D1 is not yesterday but yesterday-1. EA is on H1 TF.
While backtesting in MT4 everything is fine and ok, but on DEMO account with live data, its causing my problem.
Im really confused. Im programmer a little bit, but this is ridiculous.
Could anyone help me please? Sorry for my english.