If you do this on the first tick of a day OHLC are equal.
And what does "The loop value printing is also wrong with e_P" mean ?
change double OPEN = iOpen(Symbol(),PERIOD_D1,0); double HIGH = iHigh(Symbol(),PERIOD_D1,0); double LOW = iLow(Symbol(),PERIOD_D1,0); double CLOSE = iClose(Symbol(),PERIOD_D1,0); to double OPEN = iOpen(Symbol(),PERIOD_D1,1); double HIGH = iHigh(Symbol(),PERIOD_D1,1); double LOW = iLow(Symbol(),PERIOD_D1,1); double CLOSE = iClose(Symbol(),PERIOD_D1,1);
I applied your suggestion. But does shows different data but its shows last days data as it get changed from 0 to 1.
So I applied again with little customisation:
double OPEN = iOpen(Symbol(),PERIOD_D1,0); double HIGH = iHigh(Symbol(),PERIOD_D1,1); double LOW = iLow(Symbol(),PERIOD_D1,1); double CLOSE = iClose(Symbol(),PERIOD_D1,1);
Now it shows open price correct, but HIGH LOW is last day. Plus CLOSE Price is always wrong.
I tested the EA from 1st October, 2016 to 26th October, 2016. Today is 27th. So on the last row of CSV file it shows 26th October 2 times, on 2nd time it shows HIGH LOW correctly with 26th Data. But CLOSE Price is wrong again. (please see the picture)
I am totally clueless.
If you do this on the first tick of a day OHLC are equal.
And what does "The loop value printing is also wrong with e_P" mean ?
Currently I am using OnTick(), If I use Start() function then will it make any differences?
e_P variable contains string data either in this format
e_P = "A";
or
e_P = "A,B,C" as long as condition satisfies.
In current case e_P is printing wrongly see the picture please.
from 2016.10.13 to 2016.10.18 its e_P is showing F, but e_P is actually get calculated with Open_DG which is different. According to the calculation 17 to 18th October it should Not be printing F.
So its wrong. Hope I am clear.
I applied your suggestion. But does shows different data but its shows last days data as it get changed from 0 to 1.
that is what it is supposed to do.
Think of it this way, using 0 you are trying to read data which has not yet been produced, except for the Open, all are incomplete.
cashcube: I am back testing this EA on daily chart with Open price only.
... Currently I am using OnTick(), If I use Start() function then will it make any differences? ...
- If you are only testing with "Open price only", you will only get Open=High=Low=Close for every emulated tick of data tested. However, as by "rod178" suggestion, previous bars will have the full OHLC values. The current bar however, will only have the Open Price, so consider using another method of testing, such as for every tick method.
- Start() is the older format for the newer OnTick() event handler. So use the updated modern style!
Thank you rod178 & FMIC for pointing out. I can not use every tick method because, it produces lots of data for each tick. Then I guess I have to part it, one part where Open price can flawlessly used & another part I download the .csv file of OHLC directly from Metatrader & merge two files.
Those job will be hectic, that's why gone out for coding, but that's ok now.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am back testing this EA on daily chart with Open price only.
Any idea?
Thank you in advance.