Hello,
Is it possible to create boolean expression which is similar to SellAtTrailingStop ?
i.e instead of using "SellAtTrailingStop", use bool condition with SellAtMarket
But they don't give same results.
I tried replacing this
CODE:
Please log in to see this code.
with this
CODE:
Please log in to see this code.
Thanks,
Sofia
Size:
Color:
Anything's possible. The right question is "How do I ..." ;)
Like SellAtTrailingStop does, you just have to keep track of the highest value of the stop during the life of the Position and use that value in your condition.
Size:
Color:
Thanks, but how do I code it. Can you please help.
Size:
Color:
QUOTE:
But they don't give same results.
If you open the QuickRef, you'll see the difference. SellAtTrailingStop is not equal to selling at market after a crossunder: it maintains a level that can't go down (unlike SellAtStop, for example). You might want to add a PlotStops() to visualize stop/limit exits.
Additionally, your SellAtMarket does not have a chance to trigger. A closing price can not be lower than the 20-day lowest close. The level has to be shifted one bar ahead:
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
Thanks, but how do I code it. Can you please help.
For example:
CODE:
Please log in to see this code.
Size:
Color: