Action executed once per candle

Post Reply
Tomasz Kot
Posts: 73
Joined: Sun Dec 18, 2022 8:09 pm

Action executed once per candle

Post by Tomasz Kot »

Could you help me how to define an action that would be executed only once per candle?
For example I would like to pause the backtest at the moment (minute) that previous H1 candle high is broken for the first time.
NakedMarkets
Posts: 251
Joined: Tue Feb 22, 2022 11:06 am

Re: Action executed once per candle

Post by NakedMarkets »

Hi,

There is no way at the moment to do it without false positive.
But if you are using it in a semi-automated backtesting process, you could define the following rule:
RuleBreakPreviousH1High.png
RuleBreakPreviousH1High.png (103.29 KiB) Viewed 804 times

As you can see, this will trigger the rule when the M1 reaches the high of the previous H1 for a second time, if the price dropped just between the first and the second time.
So, you will have some occasional false positive cases but we think it's not an issue in a semi-automated process. If it's a full automated process, it could be an issue.
We could think about solving this use case by adding more conditional but the user would need to define the opposite condition (say to the software that the condition is reset when a new H1 candle is displayed).
Tomasz Kot
Posts: 73
Joined: Sun Dec 18, 2022 8:09 pm

Re: Action executed once per candle

Post by Tomasz Kot »

I understand your logic, however when I try to use it as a rule it doesn't work as expected.

Please find screenshot and backtest attached below.
When you hit play, during the next candle the backtest should stop at the break of previous bullish candle high, but it will not.
Screen 2024-02-18 145609.png
Screen 2024-02-18 145609.png (79.09 KiB) Viewed 233 times
GER30 - debug.bkt
(5.69 MiB) Downloaded 100 times
Post Reply