In the Supported Brokers page it indicates that for most of the brokers OCO and Trailing Stops are tracked by MultiCharts, and sent when appropriate. Does that mean that the strategy developer has to do the monitoring in the CalcBar method and send orders or is it totally handled by MC.NET? I haven't been able to find any code example of OCO, Bracket OCO, or OSO for MC.NET.
Also for Trailing Stops, are they only available through GenerateDollarTrailing and GeneratePercentTrailing special orders? They don't handle the case where profit amount is not reached. For example if a long position is opened at price 100 and GenerateDollarTrailing(2) is called that does not stop at price 98 because it has not reached the profit amount of 2. Instead if it goes to 102 it will activate a Trailing Stop at price 100. For that I think the developer has to write code to set a stop at price 98 and when the profit amount is reached and Trailing Stop is generated then cancel the original stop. I can't find any examples that can help me to implement this. Please help.
Thanks!
orad
Algorithmic orders, OCO, OSO, TRSTP [SOLVED]
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Algorithmic orders, OCO, OSO, TRSTP
Hello orad,
All orders generated at a particular calculation are in the same OCO group.In the Supported Brokers page it indicates that for most of the brokers OCO and Trailing Stops are tracked by MultiCharts, and sent when appropriate. Does that mean that the strategy developer has to do the monitoring in the CalcBar method and send orders or is it totally handled by MC.NET? I haven't been able to find any code example of OCO, Bracket OCO, or OSO for MC.NET.
GenerateDollarTrailing and GeneratePercentTrailing are regular stop orders that are triggered and moved based on a certain built-in logic. You can do the same and even more by creating your own logic for regular stop orders.Also for Trailing Stops, are they only available through GenerateDollarTrailing and GeneratePercentTrailing special orders? They don't handle the case where profit amount is not reached. For example if a long position is opened at price 100 and GenerateDollarTrailing(2) is called that does not stop at price 98 because it has not reached the profit amount of 2. Instead if it goes to 102 it will activate a Trailing Stop at price 100. For that I think the developer has to write code to set a stop at price 98 and when the profit amount is reached and Trailing Stop is generated then cancel the original stop. I can't find any examples that can help me to implement this. Please help.
Re: Algorithmic orders, OCO, OSO, TRSTP
Hi Andrew,
Thanks!
I'm not sure if I understand. Does this mean that if there is a market order and stop order generated on the same bar then they are sent as a OCO bracket? What if there are two limit orders generated on the same bar? If the first limit order is filled will that cancel the second limit order?All orders generated at a particular calculation are in the same OCO group.
Is the code for GenerateDollarTrailing or GeneratePercentTrailing available to use as sample, or is there any other code sample available that shows how a simple TRSTP can be implemented in MC.NET?GenerateDollarTrailing and GeneratePercentTrailing are regular stop orders that are triggered and moved based on a certain built-in logic. You can do the same and even more by creating your own logic for regular stop orders.
Thanks!
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Algorithmic orders, OCO, OSO, TRSTP [SOLVED]
No, market orders is the exception. They are processed with a higher priority and are not sent in OCO.Does this mean that if there is a market order and stop order generated on the same bar then they are sent as a OCO bracket?
Yes.What if there are two limit orders generated on the same bar? If the first limit order is filled will that cancel the second limit order?
Unfortunately the code is available. The idea is to place a stop order at a certain price when a certain condition is satisfied, then monitor current price and move the stop order following the price, when it moves in your dircetion.Is the code for GenerateDollarTrailing or GeneratePercentTrailing available to use as sample, or is there any other code sample available that shows how a simple TRSTP can be implemented in MC.NET?