How do I make an EA to trade exactly the same on "open bars" and "Every real tick" settings on history?
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
New
candle - MQL4 programming forum #3
2014.04.04
Thank you! They look much more similar now. Still not exactly, but that might come down to price history errors?
void OnTick() { if(TradeFrequenzy==WilliamCandle && !NewWilliamCandle(TF)) return; } bool NewWilliamCandle(ENUM_TIMEFRAMES TimeFr) { static datetime timeCur; datetime timePre = timeCur; timeCur=iTime(Symbol(),TimeFr,0); bool isNewBar = timeCur != timePre; return(isNewBar); }
Cristian, I am trying to solve the same problem, having a discrepancy between test results. My EA operates on bar 1 however "Every Tick" generates terrible results.
In the example above, what is TradeFrequenzy and WilliamCandle?
Thank you!
The only way to make a strategy behave the same on both "Open Prices" and "Every Tick", is to have the positions both open and close on the opening of the bar. That means that positions can't be allowed to exit at a Stop-Loss or a Take-Profit. The position needs to also closed at the open price of a bar only.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How do I make an EA to trade exactly the same on "open bars" and "Every real tick" settings on history?
I did create a function that only allows the EA to trade on the first tick
if (iVolume(Symbol(),PERIOD_M15,0 )!= 1)return;
But I get a diffrent equity graph than when setting the settings to "Every tick based on real ticks" than "Open prices only".
Can someone explain what is going on here. I thought the history of open bars was the first tick of each bar recorded?