Reputation: 11
My stratedy is based on conditions:
From the last 4 candles, if:
3 out of 4 candles are with the trend, take the trade. BUT: if the last candle is against the trend, don't take the trade.
It sounds confusing but I attached the picture, so is stupid simple, however I have NO IDEA how to do this on pine, I am new at this and a little help would be appreciated. Thanks.
Upvotes: 1
Views: 206
Reputation: 153
A little bit update to Daveatt's answer, because you say you won't take the trade if the last candle is not in the trend:
ThreeValidInLastFour = ta.sum(condition ? 1 : 0, 4) >= 3 and condition
Upvotes: 0