Custom strategy inheriting from MTDoubleShotStrategy - cancelling a working stop ...
Originally from ticket #3573.
Hi, Tom
Re: Custom strategy inheriting from MTDoubleShotStrategy (MTDS 7.0.1.13) - cancelling a working stop market entry order (with custom entry price)
The strategy uses public override bool TradeEntryValidate(bool isLong) to trigger stop market entry orders.
However, when a reverse entry signal occurs, I want to cancel the order.
How do I cancel the stop market entry order?
Thanks,
Ben
************************************************************************************************************************************************************************************
Please install 7.0.1.18 or above from here:
http://downloads.microtrends.co/MTDoubleShotStrategyFoundation/
We are up to 7.01.18- but expecting 7.0.1.19 later today- this gives you Close and Reverse (CAR) and Stop and Reverse (SAR) options for Stop Entry orders.
Entry Order Mode=0 (CAR)
Entry Order Type= 2
Entry Order TTL = 3 - cancel after 3 bars (actually uses trade exit on versions prior to 7.0.1.18 - which uses cancel)
With MODE CAR and SAR
1. The Reverse Signal will automatically cancel the existing opposite entry order
2. Simply run the SDK strategy MTDoubleShotPriceAction to see that in effect
There should be no need to program that
Not sure if you got my code for how to place a custom order
I put samples of custom methods in the SDK sample price action strategy
@MicroTrends.MTDoubleShot.SDK.Strategy.MTDoubleShotPriceAction.cs
MEthods
ValidateTradeEntry - triggers a buy or sell signal + confluence from all other filters
For custom order calculations use this method
public override double CustomEntryOrderCalcPrice(bool isLong, int entryOrderType, int customEntryOrder, int offset)
Programmatically Cancel an Order in MTDS derived Strategies -
if(OrderIsActive(orderEntry1))CancelOrder(orderEntry1);
if(OrderIsActive(orderTarget1))CancelOrder(orderTarget1);
if(OrderIsActive(orderStop1))CancelOrder(orderStop1);
if(OrderIsActive(orderStop2))CancelOrder(orderStop2);
if(OrderIsActive(orderStop3))CancelOrder(orderStop3);
NOTE:
For reversals you should not have to do the above at all it is 100% automatic
the opposite entry order is cancelled - and confirmed...
It could be we need to inspect your strategy and verify its using the MTDS in the way intended etc?
As the custom stop order is really only a few minutes++ work to implement
There is no need to cancel it on a system reversal that is is already provided.
N.B you must be using MTDSUltraLiteMode=0 - ie using the workflow
MicroTrends Support
support@microtrends.co
http://www.microtrends.co/support/
Tip! You can visit the help desk forum to see previous answered frequently asked questions:
http://microtrends.zendesk.com/forums
Please sign in to leave a comment.
Comments
0 comments