I have a question about a problem i'm having with my automated strategy.
I use IOrder objects to make sure my stops are moved to BE after the scalper target is hit. This is the way i programmed it now:
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
private IOrder LongEntryOrder = null;
private IOrder ShortEntryOrder = null;
private IOrder LongScalper = null;
private IOrder LongTarget1 = null;
private IOrder LongTarget2 = null;
private IOrder ShortScalper = null;
private IOrder ShortTarget1 = null;
private IOrder ShortTarget2 = null;
private IOrder LongStop = null;
private IOrder ShortStop = null;
protected override void OnExecution (IExecution execution)
{
// On entry bar:
if (LongEntryOrder != null && LongEntryOrder == execution.Order)
{
LongStop = ExitLongStop(0, true, 99000, Low[LowestBar(Low, 96)] - (ATR(7)[0] * 2), "StoppedOutLong", "");
}
if (ShortEntryOrder != null && ShortEntryOrder == execution.Order)
{
ShortStop = ExitShortStop(0, true, 99000, High[HighestBar(High, 96)] + (ATR(7)[0] * 2), "StoppedOutShort", "");
}
// On Scalper bar:
if (LongScalper != null && LongScalper == execution.Order)
{
LongStop = ExitLongStop(0, true, 66000, Position.AvgPrice + (1 * TickSize), "BreakEvenLong", "");
}
if (ShortScalper != null && ShortScalper == execution.Order)
{
ShortStop = ExitShortStop(0, true, 66000, Position.AvgPrice - (1 * TickSize), "BreakEvenShort", "");
}
But i just want it to move the origional stop loss order to BE and change the quantity.
What am I doing wrong here? Because i refer to the same IOrder object to change this order in "//On scalper bar" section.
Many thanks in advance.
Grtz, Dennis

Comment