Make a trade once per indicator signal
-
Lets say I want a buy trade when a SAR dot has appared under a candle and when its over EMA 20. Both have to be fullfilled.
Now to the problem.
It now hits my stoploss, SAR is still active upwards and now candle is once again above 20 EMA, so the bot makes another trade, but I dont want that, I just want a trade ONCE per SAR indicator, so first when there is created a new SAR situation downward or once again upward. How can I do this? -
Set flags, if trade can be placed set flag to tree, if not leave a false, check with a check flag block, you can switch on/off as you like.
-
Thanks for the reply, never used Flags before is there another way. Also have in mind Im no coder. I though maybe there where a blog once per indicator

-
There is no once per signal, you have to create it with flags, once per bar may do it, but SAR will be the same on many candles,.
-
Is there some info here how this flag thing work
-
This should do it, you'll have have to add sells and change conditions to how you want:
-
What can I say, works perfectly, it help that I had this example, MANY thanks.
-
@Fireblade You are welcome
-
So we have once per indicator signal, which is good, but what if i want a limit, lets say ex.
A buy trade can just go in with the first 3 dots from sar under the candle, but not further with that signal from the indicator.
So if it was on 1 H chart it can just go in the first 3 hours, if the sar dots continues its to late, so a possible trade must wait until next signal.
I looked at once per min but it dont really work the way I did it -
Principle is the same "if this = this do this", but if different timeframes mean different settings. You have the flags to allow/stop trades, now new trees that will set these, condition PSAR is < or > candle ID4, this means that as soon as the dot is on 4 (so when 3 closes) you can set the flag false.