once per bar, working on open or close of a candle
-
Hi,
I'm working at a new EA in a short time frames (m5-m10), I put "once per bar" at the top of my flow, because I need to pass only at the beginning of a candle (EA should work only on open price, at the second 00 of a minute and on the rest of time do nothing) There are obviously other conditions below "once per bar" block.
The question is: If conditions below "once per bar" are met after the second "zero" of a candle, does the EA pass when the condition are met or not ?
I need to work only at the beginning (or on the end) of a candle and do nothing on the rest of the time because open and close price are well known and they are good for backtesting.
For the moment i have results in the MT5 backtesting that don't match at all in a real situation. My theory is: if i write a flow that works only in O-C (open or close prices) a simulation in OHLC should be perfect (apart slippage). I don't know if there's a real synchronization of candle in backtesting.
Thanks. -
__
The question is: If conditions below "once per bar" are met after the second "zero" of a candle, does the EA pass when the condition are met or not ?
[/quote:2pl3363t]
No. A block runs only if the one above passes. The block on the top runs depending on the event where it is placed. Under "on Tick" it like you have a block "On Every Tick" above all "first" blocks.I have ideas to add a new workplace where things will be different, serial, if I can use this word. Many people are actually expecting things to be like that. If "Once per bar" passes to some "Condition", to stay on that "Condition" until it passes. It's not like that at the moment. Under "on Tick" everything is fresh when a new tick comes, blocks on the top run once, and those below them... depends.
-
So if i understand in this simple case:
Once per bar (first block) --> condition ---> do something
If condition is met in the second "zero of a candle" my EA "do something" in the open price of a candle
In case of condition met in the second 20 of a bar my EA "do nothing" because "once per bar" passes only 1 time in the beginning of candle
Right ?What about synchronization of candles in real and in backtesting ?
-
Yes. "Once per bar" means this: I am a block and I can pass if you run me, but not more than 1 time while I am in the same candle. Try me on the first tick - I will pass. Try me in the middle of the candle - I will pass. But only once.
What synchronization?
-
Perfect, thank you.
About synchronization: I was wondering if there's the possibility of a mismatch between candle in the graph or candle in backtesting and candle calculation by the EA (due to different clock time or other reasons...) I say this because I saw strange things in my backtest...
-
I don't know, it depends
