Trailing Stop Strategies [SOLVED]
Trailing Stop Strategies
I'm trying to understand how trailing stops work in MC.NET. I see there are some signals related to trailing stops such as Dollar_Trailing, Percent_Trailing that generate the relevant trailing stop order on every CalcBar(). How is this supposed to work? Does that mean that when I apply this strategy to a chart then it is going to generate a new order on every calculation of the bar? That would be weird. Or is it intended to be combined with other strategies? If so, should the other strategies call those signals from their script? In that case how is a signal called from another signal? Please explain this I'm really confused. Thanks!
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Trailing Stop Strategies [SOLVED]
The `Dollar_Trailing` signal uses the `GenerateDollarTrailing()` method for that:I'm trying to understand how trailing stops work in MC.NET. I see there are some signals related to trailing stops such as Dollar_Trailing, Percent_Trailing that generate the relevant trailing stop order on every CalcBar(). How is this supposed to work?
Code: Select all
protected override void CalcBar(){
CurSpecOrdersMode = IsPositionBasis ? ESpecOrdersMode.PerPosition : ESpecOrdersMode.PerContract;
GenerateDollarTrailing(Amount);
}
No, it generates one stop-loss order that is adjusted when needed.Does that mean that when I apply this strategy to a chart then it is going to generate a new order on every calculation of the bar? That would be weird.
Yes, `Dollar_Trailing` has no entry nor exit logic, so it's a "building block signal" instead of a complete strategy.Or is it intended to be combined with other strategies?
Of course, you can also call `GenerateDollarTrailing()` in your own signal. In that case, the `Dollar_Trailing` signal is not needed anymore.
That is not needed. You can add multiple signals to the same chart and they are combined into one strategy.If so, should the other strategies call those signals from their script? In that case how is a signal called from another signal?
So adding the following signals:
* Bollinger_Bands_LE
* Bollinger_Bands_SE
* Dollar_Trailing
Creates one strategy that goes long or short based on the Bollinger Bands and that has a dollar trailing stop.
Re: Trailing Stop Strategies
Thank you JoshM for the detailed response. I also found out that we can use "Study Templates" to group together different strategy building blocks and apply them as a group on the chart. We can also export them to file, for example to check-in to source control. Now with these concepts, many of those existing study examples make more sense.