I have the following trailing stop statement in one of my strategies:
CODE:
Please log in to see this code.
How do you plot the trailing stop on the PricePane?
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
OK, that gives me a point.
What I want is a continuous curve of the value of the trailing stop for past bars up to the present so I can look at the curve and see right away how far the stock is away from the trailing stop for today's bar.
Size:
Color:
You can either:
1. Make DataSeries of stop values and PlotSeries, or,
2. Use DrawLine() to connect the dots.
If you do #1, make sure to fill the series with some value (like the most recent stop) so that it doesn't plot at the zero level and distort the scaling.
Size:
Color:
I am new to Wealth-lab. Trying to do too many things at once, learning the language, reading the online guides, trying some of the canned strategies, etc...
I'm trying to write the following stop rule
Initial stop at position entry price less (for longs) some multiple of an n day ATR
Subsequent stops at the higher of previous stop or the previous days high less some multiple of that days n-day ATR
I appreciate the help (and the learning experience for me) if someone can display that relatively painlessly
Thanks!
Size:
Color:
PlotStops() is pretty painless, isn't it?
QUOTE:
so I can look at the curve and see right away how far the stock is away from the trailing stop for today's bar
The dots show precisely the price at which a stop will take place on the bar plotted. It's exactly what you want except that they're dots, not a line.
Size:
Color:
Have you tried the canned Bandwagon Trade strategy? Its code can serve as a good illustration of mostly all what you requested. Also you might like to replace SellAtStop/CoverAtStop with SellAtTrailingStop/CoverAtTrailingStop to better suit the "at the higher of previous stop..." part.
Size:
Color:
Will look
Thanks!
Size:
Color:
Cone, you're right. PlotStops() does exactly what I want. Thanks, Eugene.
Size:
Color: