NexusFi: Find Your Edge


Home Menu

 





Can't close triggered Long Limit order


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vetl with 4 posts (0 thanks)
    2. looks_two Fat Tails with 1 posts (0 thanks)
    3. looks_3 monpere with 1 posts (0 thanks)
    4. looks_4 NinjaTrader with 1 posts (0 thanks)
    1. trending_up 3,196 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 vetl 
Toronto, Ontario
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 11 since Nov 2011
Thanks Given: 0
Thanks Received: 1

Hi all,

I'm trying to put together template for entry exit logic so it would be easy to code new strategies and got stuck on one portion where I can't close triggered long limit order. So, basically scenario is my 3 long limit orders are being triggered and when I try to to Exit long ninja doesn't close it, here is log from traceorder:


code to place the orders :

Order1 = EnterLongLimit(0,true,LotSize1, ePrice, "Order1");
Order2 = EnterLongLimit(0,true,LotSize2, ePrice, "Order2");
Order3 = EnterLongLimit(0,true,LotSize3, ePrice, "Order3");

Log :


4/10/2012 7:45:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:45:00 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=101.08 StopPrice=0 SignalName='Order1' FromEntrySignal=''
4/10/2012 7:45:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:45:00 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=101.08 StopPrice=0 SignalName='Order2' FromEntrySignal=''
4/10/2012 7:45:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:45:00 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=101.08 StopPrice=0 SignalName='Order3' FromEntrySignal=''


execution event:
Execution='NT-00000' Instrument='CL 05-12' Account='Replay101' Name='Order1' Exchange=Default Price=101.08 Quantity=1 Market position=Long Commission=0 Order='NT-00000' Time='4/10/2012 7:50:00 PM'


Execution='NT-00001' Instrument='CL 05-12' Account='Replay101' Name='Order2' Exchange=Default Price=101.08 Quantity=1 Market position=Long Commission=0 Order='NT-00001' Time='4/10/2012 7:50:00 PM'

Execution='NT-00002' Instrument='CL 05-12' Account='Replay101' Name='Order3' Exchange=Default Price=101.08 Quantity=1 Market position=Long Commission=0 Order='NT-00002' Time='4/10/2012 7:50:00 PM'

here is the code that I'm executing to close orders:
ExitLong("Order1");
ExitLong("Order2");
ExitLong("Order3","");
ExitLong();

result:
4/10/2012 7:50:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:50:00 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='Order1'
4/10/2012 7:50:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:50:00 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='Order2'
4/10/2012 7:50:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:50:00 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='Order3' FromEntrySignal=''
4/10/2012 7:50:00 PM Entered internal PlaceOrder() method at 4/10/2012 7:50:00 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''


Any suggestion pleaseee ??? I'm trying to close all orders at that time, if there is opposite signal.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
Hormuz Completely Closed: US Strikes Day 2, Iran Shoots …
Traders Hideout
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117

ExitLong() reliably closes orders. If it does not close your orders, there is a problem in your code elsewhere.

As you have not posted the entire strategy, nobody can help you unless you post it.


Reply With Quote
  #3 (permalink)
 vetl 
Toronto, Ontario
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 11 since Nov 2011
Thanks Given: 0
Thanks Received: 1


I did a check with print message, condition is being triggered with "ExitLong" statements, i'm really confused where else can be the problem :S Can you confirm that ExitLong would close triggered LongLimitOrder ? if it is then probably I will need to comment out everything and enable block by block


Started this thread Reply With Quote
  #4 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,375


vetl View Post
I did a check with print message, condition is being triggered with "ExitLong" statements, i'm really confused where else can be the problem :S Can you confirm that ExitLong would close triggered LongLimitOrder ? if it is then probably I will need to comment out everything and enable block by block

Are you sure NT is not ignoring the exits because they might violate their internal order rules? That's one of the reasons I now only use Unmanaged orders. You may want to also open a post on the NT support forum.


Reply With Quote
  #5 (permalink)
 vetl 
Toronto, Ontario
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 11 since Nov 2011
Thanks Given: 0
Thanks Received: 1

Thank you for your input, I don't see any errors related to the internal handling rules in logs. Also another question iOrder object, will it become null after order is closed? or it will still have details from the last order ?


Started this thread Reply With Quote
  #6 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,715 since May 2010
Thanks Given: 203
Thanks Received: 2,689


vetl View Post
Thank you for your input, I don't see any errors related to the internal handling rules in logs. Also another question iOrder object, will it become null after order is closed? or it will still have details from the last order ?

The variable that holds the IOrder object will always contain the object untill you set the variable to null. The IOrder object itself will hold values in its properties for the order.


Follow me on X Reply With Quote
  #7 (permalink)
 vetl 
Toronto, Ontario
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 11 since Nov 2011
Thanks Given: 0
Thanks Received: 1

Thank you for your information! I got Visual Studio for debugging now it became waaay easier. Now I need another word of advice, on how to track\distinguish orders that hit TP and got closed at tp ? For example I have 3 orders rolling with 3 different target prices, orderstatus is filled. But I can't find the way to say which one is filled and which one is not, this is to close any open orders on opposite signal or to know when to clear iOrder objects. Thank you for your help everyone. Should I use opposite stop order to simulate TP ? and when its hit have action done on that event ? Limit order for TP and stop orders for SL ?


Started this thread Reply With Quote




Last Updated on April 26, 2012


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts