I appreciate the great contributions on this board and wondering if someone could help with a stop loss question.
Is there’s a way to have separate long and short stops for a single strategy that trades long and short, but models differently from each side.
The following code compiles, but I’m certain it’s not doing what I want it to…which is to have a separate stoploss for longs vs shorts, a separate max bar stop for longs vs shorts, and a separate target profit stop for longs vs shorts.
Is it possible to do this?
Thank you for your consideration and advice.
LongStopLoss = ApplyStop(stopTypeLoss, stopModePercent, 5);
ShortStopLoss = ApplyStop(stopTypeLoss, stopModePercent, 8);
LongMaxBars = ApplyStop(stopTypeNBar, stopModeBars, 95);
ShortMaxBars = ApplyStop(stopTypeNBar, stopModeBars, 5);
LongTargetProfit = ApplyStop(stopTypeProfit, stopModePercent, 100);
ShortTargetProfit = ApplyStop(stopTypeProfit, stopModePercent, 5);
Buy = (buy condition);
Sell = (sell condition)
OR ConditionalStopLoss = IIf(Short, ShortStopLoss, LongStopLoss)
OR ConditiionalMaxBars = IIf(Short, ShortMaxBars, LongMaxBars)
OR ConditionalTagetProfit = IIf(Short, ShortTargetProfit, LongTargetProfit);
Short = (Short Condition);
Cover = (Cover Condition)
OR ConditionalStopLoss = IIf(Short, ShortStopLoss, LongStopLoss)
OR ConditiionalMaxBars = IIf(Short, ShortMaxBars, LongMaxBars)
OR ConditionalTagetProfit = IIf(Short, ShortTargetProfit, LongTargetProfit);