2009-05-11 10:07:57 AM Ignored PlaceOrder() method: Action=Sell OrderType=Stop Quantity=2 LimitPrice=0 StopPrice=8419 SignalName=TRAIL_STOP' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place'
as you can see from teh screenshot of the control center, this orginal order got cancelled.
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// look for 1 ATR profit [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((take1ATRProfits) && (currentProfitVariable >= ATRValue)) { CancelOrder(exitOrder); [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].MarketPosition) { [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]MarketPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Long: ExitOrderPosition1 = ExitLong(0,position1Quantity, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"1_ATR_PROFIT_TARGETS"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], entryOrder.FromEntrySignal); [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]MarketPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Short: ExitOrderPosition1 = ExitShort(0,position1Quantity, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"1_ATR_PROFIT_TARGETS"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], entryOrder.FromEntrySignal); [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; } take1ATRProfits = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; } [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// set 1 ATR trailing stop. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] currentStop; [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] trailstopVolume = (ExitOrderPosition1 == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ? entryOrder.Filled : entryOrder.Filled - ExitOrderPosition1.Quantity); Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"trailstopVolume"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + trailstopVolume + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ExitOrderPosition1 "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ExitOrderPosition1 + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" Position.Quantity "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Quantity); [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (trailstopVolume > 0) { spread = [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Math[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Abs(GetCurrentAsk() - GetCurrentBid()) ; [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (tradedirection) { [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Direction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Long: currentStop = highestHigh - ATRValue - spread ; Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" highestHigh "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + highestHigh + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ATRValue "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ATRValue + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" spread "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + spread); [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((exitOrder == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){ exitOrder = ExitLongStop(0,[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal); } [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{ [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((exitOrder.OrderState == [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]OrderState[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Cancelled) || (currentStop != exitOrder.StopPrice) ) { [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// create the exit stop for first time [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]exitOrder = ExitLongStop(0,[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal); [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitLongStop(entryOrder.Filled, currentStop, SIGNALZLREXIT_TRAIL + trailStopPercent + "%", entryOrder.FromEntrySignal); [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]} } [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//else if (currentStop != exitOrder.StopPrice) [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//{ [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// // fire it as it changes. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitLongStop(trailstopVolume, currentStop, "TRAIL_STOP", entryOrder.FromEntrySignal); [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//} [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Direction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Short: Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" lowestLow"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + lowestLow + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ATRValue "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ATRValue + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" spread "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + spread); currentStop = lowestLow + ATRValue + spread ; [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// if ((exitOrder == null) || (currentStop != exitOrder.StopPrice)) [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((exitOrder == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) ) { [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// create the exit stop for first time [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]exitOrder = ExitShortStop(0, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal); } [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{ [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((exitOrder.OrderState == [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]OrderState[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Cancelled) ||(currentStop != exitOrder.StopPrice) ){ exitOrder = ExitShortStop(0, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal); } } [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//else if (currentStop != exitOrder.StopPrice) [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//{ [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// // fire it as it changes. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitShortStop(entryOrder.Filled, lowestLow + MFEProfit * trailStopPercent / 100, SIGNALZLREXIT_TRAIL, entryOrder.FromEntrySignal); [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//} [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; } } } [/SIZE]
Comment