this is a simple code to show you what I mean, there are stop losses for both long and short positions but the problem is that I want to be able to open short positions without closing the already opened long position. as you've probably guessed, I want to test this strategy when the market is tight and you could make profit on, either way, it just needs two accounts.
strategy("bothways", overlay=true)
leverage=input(5,"leverage",step=.25)
partoftrade=input(1,"partoftrade",step=.01)
StoplosssS=input(0.025,"StopLOSS SHORT",step=0.001)
StoplosssL=input(0.025,"StopLOSS LONG",step=0.001)
pertpS = input(0.02,"TP Short",step=0.01)
pertpL = input(0.02,"TP Long",step=0.01)
narrow=bbw(open,20,2)<0.005
red=open>close
green=open<close
longCondition = narrow and green
if (longCondition and strategy.opentrades<2)
strategy.entry("L", strategy.long,qty=(strategy.equity/1)*partoftrade*leverage/open,oca_name="ocg",oca_type=strategy.oca.cancel)
strategy.exit("LE",from_entry="L",profit=close*pertpL/syminfo.mintick,loss=open*StoplosssL/syminfo.mintick,oca_name="ocg")
shortCondition = narrow and red
if (shortCondition and strategy.opentrades<2)
strategy.entry("S", strategy.short,qty=(strategy.equity/1)*partoftrade*leverage/open,oca_name="ocg",oca_type=strategy.oca.reduce)
strategy.exit("SE",from_entry="S",profit=close*pertpS/syminfo.mintick,loss=open*StoplosssS/syminfo.mintick,oca_name="ocg")
thanks for help