1

I would like to move my stop loss to where my first take profit is IF it reaches it. And also as of now when my stop loss is hit it only sells half the position and then the left is left lingering until it hits the second take profit if it ever does. Any suggestions are greatly appreciated.

shortCondition = close < lowerBand and close[1] > lowerBand
if (shortCondition)
strategy.entry("short", strategy.short, qty=pos_size)
if strategy.position_size < 0
strategy.exit("exit short TP", qty=size_trim, profit = 400, comment="close first 50%")
strategy.exit("exit short SL", loss = 400, profit = 800, comment="SL/last50%")

longCondition = close > upperBand and close[1] < upperBand
if (longCondition)
strategy.entry("long", strategy.long, qty=pos_size)
if strategy.position_size > 0
strategy.exit("exit long TP", qty=size_trim, profit = 400, comment="close first 50%")
strategy.exit("exit long SL", loss = 400, profit = 800, comment="SL/last50%")
mrdood
  • 13
  • 2

0 Answers0