I'm trying to integrate some analytics into my strategy.
If a buy or sell signal has been generated, I would like to the strategy to record the price a few bars after which is stored as an integer "TimeFrame". As I would only like this to be called once, I have used FirstTickOfBar as well.
if FirstTickOfBar && BarsSinceEntry() == TimeFrame
When I modify the code to BarsSinceEntry() => TimeFrame, it seems to work just fine (even though this is not what I want).
I know I could do a workaround by adding another variable called IsChecked which switches true from within the if segment and is then added as a condition so that it only triggers once. However, I'd prefer a simple solution which doesn't require adding variables, or if I'm using the functions wrongly, would like to learn how I've misused them.
Thanks!

Comment