NexusFi: Find Your Edge


Home Menu

 





Ninjatrader order event handler


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one DoobyWho with 3 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (1 thanks)
    3. looks_3 shuglu with 1 posts (3 thanks)
    4. looks_4 Sazon with 1 posts (0 thanks)
    1. trending_up 2,455 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Ninjatrader order event handler

  #1 (permalink)
 DoobyWho 
Austin,TX
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, GC, CL, NQ, 6E
Posts: 15 since Jun 2014
Thanks Given: 2
Thanks Received: 3

Hi all. I'm looking to be able to send an HTTP request whenever an order is placed on NT via the dom or chart trader. I do not want to have to trade any differently than I already am, I just want a transparent method for sending an HTTP request whenever I do trade.

In speaking with NT, they say there are not any supported/documented ways for an indicator to do this. I also cannot find any information out there about any undocumented methods for an indicator to listen for order execution.

Thoughts? Suggestions?

Thanks.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


I would think that OnExecution is a hook, where you can add on additional logic
to be triggered, when an order gets filled...

You could test it with ReplayMode...


// Example #1
// Finding the executions of a particular IOrder object
private IOrder entryOrder = null;

protected override void OnBarUpdate()
{
if (entryOrder == null && Close[0] > Open[0])
entryOrder = EnterLong();
}

protected override void OnExecution(IExecution execution)
{
if (entryOrder != null && entryOrder == execution.Order)
Print(execution.ToString());
}


// Example #2
// Generic execution logic not specific to a particular IOrder object
protected override void OnExecution(IExecution execution)
{
// Remember to check the underlying IOrder object for null before trying to access its properties
if (execution.Order != null && execution.Order.OrderState == OrderState.Filled)
Print(execution.ToString());
}

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 DoobyWho 
Austin,TX
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, GC, CL, NQ, 6E
Posts: 15 since Jun 2014
Thanks Given: 2
Thanks Received: 3


rleplae View Post
I would think that OnExecution is a hook, where you can add on additional logic
to be triggered, when an order gets filled...

You could test it with ReplayMode...


// Example #1
// Finding the executions of a particular IOrder object
private IOrder entryOrder = null;

protected override void OnBarUpdate()
{
if (entryOrder == null && Close[0] > Open[0])
entryOrder = EnterLong();
}

protected override void OnExecution(IExecution execution)
{
if (entryOrder != null && entryOrder == execution.Order)
Print(execution.ToString());
}


// Example #2
// Generic execution logic not specific to a particular IOrder object
protected override void OnExecution(IExecution execution)
{
// Remember to check the underlying IOrder object for null before trying to access its properties
if (execution.Order != null && execution.Order.OrderState == OrderState.Filled)
Print(execution.ToString());
}

The OnExecution isn't available from within an indicator. Won't compile.

Started this thread Reply With Quote
  #5 (permalink)
 
Sazon's Avatar
 Sazon 
Roswell, GA
 
Experience: Advanced
Platform: NinjaTrader
Trading: Futures
Posts: 238 since Feb 2013
Thanks Given: 930
Thanks Received: 472


DoobyWho View Post
The OnExecution isn't available from within an indicator. Won't compile.

Maybe you can have a strategy that runs throughout the day. The strategy does not issue orders. The only thing that this strategy does is look for order executions.

Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


Sazon View Post
Maybe you can have a strategy that runs throughout the day. The strategy does not issue orders. The only thing that this strategy does is look for order executions.

I haven't used NT in a long while, but quite certain that won't work. OnExecution() would only work for orders the strategy itself execute.

There are other undocumented hooks. I think if you look at some of the more complex examples on futures.io (formerly BMT) Elite section you'll find code that uses these hooks already. I just can't give a specific link, since I don't use these tools I only have a passing knowledge of them.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
 
shuglu's Avatar
 shuglu 
Melbourne
 
Experience: None
Platform: NinjaTrader
Broker: Amp/CQG
Trading: NQ
Posts: 71 since Jul 2012
Thanks Given: 312
Thanks Received: 94

From NinjaTrader forum and works for my needs.

Hope this helps.

J

Reply With Quote
Thanked by:
  #8 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425

Hi @DoobyWho, @Big Mike, @Sazon, @rleplae

Thanks to the example provided by @shuglu, I can now confirm that the first release I mentioned here will support an 'on execution' save/post capability, the hooks seems to work fine, and I think should be ok for manual and bot triggered trades, testing will reveal all.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 DoobyWho 
Austin,TX
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, GC, CL, NQ, 6E
Posts: 15 since Jun 2014
Thanks Given: 2
Thanks Received: 3


shuglu View Post
From NinjaTrader forum and works for my needs.

Hope this helps.

J

Was able to modify this to do what I need. Thanks so much!

Started this thread Reply With Quote




Last Updated on August 5, 2014


© 2024 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 - Privacy Policy - Downloads - Top
no new posts