Asad Ali
Asad Ali

Reputation: 151

How to add a break between orders

Is it possible to add a break between trades in pinescript strategy?

I can ensure there is only one trade active, but a new trade starts as soon as the condition is met, I would like to add a delay, for example after a trade is finished, I would like to not start a new trade for an hour.

Upvotes: 0

Views: 380

Answers (1)

bbnm
bbnm

Reputation: 1094

You could try finding the time at which a trade closed using strategy.closedtrades.exit_time() and then adding a 1 hour delay.

You can also use the ta.barssince() function.

conditionFilter = not ta.barssince(ta.change(strategy.closedtrades)) == 5 
//this will skip trades for 5 bars after each closed trade, just add it to your long/short conditions

Upvotes: 1

Related Questions