If SMA(Fast) CrossAbove SMA(Slow) then
1. Exit Short @ Market Price
2. Entry Limit Long @ ( High[1]+Low[1] ) / 2
3. Cancel the Limit Order if Not Filled within One Bar
If SMA(Fast) CrossBelow SMA(Slow) then
1. Exit Long @ Market Price
2. Entry Limit Short @ ( High[1]+Low[1] ) / 2
3. Cancel the Limit Order if Not Filled within One Bar
So I try to program my strategy as following:
// Condition set 1
if ( CrossAbove(SMA(N_Fast), SMA(N_Slow), 1) )
{
ExitShort( "Exit Short", "Crossover Short" );
double lmtPrice = ( High[1] + Low[1] ) / 2;
EnterLongLimit( lmtPrice, "Crossover Long" );
}
// Condition set 2
if ( CrossBelow(SMA(N_Fast), SMA(N_Slow), 1) )
{
ExitLong( "Exit Long", "Crossover Long" );
double lmtPrice = ( High[1] + Low[1] ) / 2;
EnterShortLimit( lmtPrice, "Crossover Short" );
}
However, when CrossBelow occurs, it will enter new sell limit order only if I have no existing long position. When I have long position, it will exit my Long @ market price, but never entry a new sell limit order. Same thing happens on CrossAbove.
I have checked the TraceOrders output, it stated the reason as: "An Enter() method to submit an entry order has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation."
What I need is to exit position at market price and summit a new limit order. Is it possible get around the "Internal Order Handling Rules" restriction without going into unmanaged order approach?
Comment