Learn
Scripting Tips and Tricks

How to prevent secondary orders from executing within your strategy pack/scripts

in strategy packs with smart rebalancing enabled, it is logical that realized profits will get allocated to secondary signals on other strategies within the pack there is a method to prevent that by adding this small section of code to your script with the necessary logic adjustments to suit your buy/long and sell/short needs tuned script longapproved = and(longopen,not(position long)) shortapproved = and(shortopen,not(position short)) //signal push out(signalif(longapproved, shortapproved)) pine alpha what this will do, is only open a trade if there is not already a position open on this strategy (long, short or open)