In my code, I do the following:
Global Vars
-----------
private string _entrySignalName = null;
private string _stopSignalName = null;
...
// Set the signal Entry Order Signal Name
_entrySignalName = "SELL " + _orderQuantity.ToString() + " @ " + entryPrice.ToString();
// Send a Market Order
_entryOrder = EnterShort( _PrimaryBars, _orderQuantity, _entrySignalName );
...
// Set the Stop Order signal name
_stopSignalName = "Trailing_Stop";
// Now set the Trailing stop
_stopOrder = ExitLongStop( _PrimaryBars, true, _stopOrder.Quantity, stopPrice, _stopSignalName, _entrySignalName );
Nothing wrong so far, untill I realised that my Trailing Stops were not being executed. A trace through the program reveals the following:
When created, this is what the "_entryOrder" has as properties:
Action : SellShort
AvgFillPrice : 98.26
Filled : 1
FromEntrySignal : ""
Instrument : {$USDJPY Default}
LimitPrice : 0.0
LiveUntilCancelled : false
Name : "SELL 1 @ 98.27"
Oco : ""
...
Clearly the property 'FromEntrySignal' which should equal my 'entrySignalName' is not, instead, the 'Name' property has the 'entrySignalName' value !!!!
So, my "ExitLongStop()" calls are not tied to any "Entry Order"!!!
How do I solve this unexplained 'feature'?
Cheers,
Obi
Comment