entryTime=ObjectGet(name,OBJPROP_TIME1+900); : int shift = iBarShift(Symbol(),0, entryTime); |
entryTime=ObjectGet(name,OBJPROP_NO_SUCH_PROPERTY); : int shift = iBarShift(Symbol(),0, entryTime); |
entryTime=0; : int shift = iBarShift(Symbol(),0, entryTime); |
entryTime=0; : int shift = Bars - 1; |
Thanks for the reply.
I modified this:
entryTime=ObjectGet(name,OBJPROP_TIME1+900);
To this and no difference:
entryTime=ObjectGet(name,OBJPROP_TIME1)+900;
OBJPROP_PRICE1 is a constant and part of object property.
Regarding:
int shift = Bars - 1;
Bars is a count of all bars on the chart. So it wouldn't satisfy the need of getting the Next 15 bars from the plot of the given arrow object.
entryTime=ObjectGet(name,OBJPROP_TIME1)+900;
For large amounts of code, attach it- Of course it made a difference. Now what is object 'name' Is it an object you created, something the tester created. Is is a horizontal line?
Add some Print statements and find out. string candle15=CandleUpDown(shift-1); : string CandleUpDown(int barnum){ double openprice =iOpen(Symbol(),PERIOD_M1,barnum);
Shift is on the current chart. Then you use it (barnum) on the M1 chart. Fails is the current chart is NOT M1.
This not gonna be easy
if(TimeCurrent() == entryTime)
datetime is actually an integer represents the amount of seconds elapse since 00:00 Jan 1, 1970. We probably won't have every second in every tick, so try this ...
if(TimeCurrent() >= entryTime)
This not gonna be easy
datetime is actually an integer represents the amount of seconds elapse since 00:00 Jan 1, 1970. We probably won't have every second in every tick, so try this ...
Good eye. I've been testing with '>', I must have tweaked the code before I pasted it here.
With:
if(TimeCurrent() >= entryTime)
The result in the CSV file is:
down 2012.11.28 10:41:14 Strategy11;EURUSD;;;;;;;;;;;;;;;
the candle states are not being captured correctly.
Does iBarShift return correctly ?
int shift = iBarShift(Symbol(),0, entryTime); Print ("entry time ",TimeToStr (entryTime, TIME_DATE|TIME_SECONDS)," shift ",shift," err ",GetLastError());
Good eye. I've been testing with '>', I must have tweaked the code before I pasted it here.
With:
if(TimeCurrent() >= entryTime)
The result in the CSV file is:
down 2012.11.28 10:41:14 Strategy11;EURUSD;;;;;;;;;;;;;;;
the candle states are not being captured correctly.
- 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 have an MQL4 function that plots an arrow object on a chart for backtesting purposes. I am working on another function that writes whether the next 15 bars after the object closed up or down and I am running into problems... The up/down stats written to the file don't mesh with what I see on the chart and I don't understand why barshift isn't working at expected.
My code is below. Help?