NexusFi: Find Your Edge


Home Menu

 





Order Status (OnOrderUpdate) in indicator?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 5 posts (4 thanks)
    2. looks_two Blash with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 asfax with 1 posts (2 thanks)
    1. trending_up 2,239 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Order Status (OnOrderUpdate) in indicator?

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Calling NT Gurus....

Is there any way to get the functionality of OnOrderUpdate in an Indicator?

The orders are submitted by the indicator through OIF or an automated Chart Trader button press.

Thanks

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
Blash's Avatar
 Blash 
Chicago, IL
Legendary Market Chamois
 
Experience: None
Platform: NT8,NT7,TWS
Broker: InteractiveBrokers, S5T, IQFeed
Trading: The one I'm creating in the present....Index Futures mini/micro, ZF
Posts: 2,311 since Nov 2011
Thanks Given: 7,341
Thanks Received: 4,518



vantojo View Post
Calling NT Gurus....

Is there any way to get the functionality of OnOrderUpdate in an Indicator?

The orders are submitted by the indicator through OIF or an automated Chart Trader button press.

Thanks

NT8 or NT7 please.............?

...My calamity is My providence, outwardly it is fire and vengeance, but inwardly it is light and mercy...
The steed of this Valley is pain; and if there be no pain this journey will never end.
Buy Low And Sell High (read left to right or right to left....lol)
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

This is for NT7.....

Quite awhile before I port to NT8.

Thanks

Started this thread Reply With Quote
  #5 (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


vantojo View Post
Calling NT Gurus....

Is there any way to get the functionality of OnOrderUpdate in an Indicator?

The orders are submitted by the indicator through OIF or an automated Chart Trader button press.

Thanks

Only way I found was by searching account.Orders.

Code in rfkChartMinder but simpler in rfkChartOrders:



Cheers

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (permalink)
 
Blash's Avatar
 Blash 
Chicago, IL
Legendary Market Chamois
 
Experience: None
Platform: NT8,NT7,TWS
Broker: InteractiveBrokers, S5T, IQFeed
Trading: The one I'm creating in the present....Index Futures mini/micro, ZF
Posts: 2,311 since Nov 2011
Thanks Given: 7,341
Thanks Received: 4,518


vantojo View Post
This is for NT7.....



Quite awhile before I port to NT8.



Thanks



I completely understand.

But, I just wanted to emphasize the massive improvement over NT7 with NT8. Gone are the one chart dominates or Market Analyzer etc on loading or refreshing .... over the entire NT7 platform etc etc

Ron


Sent from my iPhone using futures.io

...My calamity is My providence, outwardly it is fire and vengeance, but inwardly it is light and mercy...
The steed of this Valley is pain; and if there be no pain this journey will never end.
Buy Low And Sell High (read left to right or right to left....lol)
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Yes, probably lots of improvements in NT8....but I think they still separate Strategy base from Indicator base code...that is many methods for orders and positions probably are still not available in the indicator base?

Is that true?

I trade primarily from the chart and have had to write a lot of code to do it the way I need/want. My indicators are a hybrid....they can submit orders or just let me manually place trades with a single click, et cetera. Automated exits (not ATM), etc.

That means porting a good portion of my code to NT8 is probably going to be a big effort.

Unless NT8 has dissolved the difference between an indicator and a strategy, I am going to wait as long as I can to port.

Started this thread Reply With Quote
  #8 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

will study the code you point to

Started this thread Reply With Quote
  #9 (permalink)
 asfax 
Prague, Czech Republic
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: NQ
Posts: 57 since Sep 2009
Thanks Given: 34
Thanks Received: 79


vantojo View Post
Calling NT Gurus....

Is there any way to get the functionality of OnOrderUpdate in an Indicator?
The orders are submitted by the indicator through OIF or an automated Chart Trader button press.
Thanks

Hi @vantojo
I am not sure if your problem is still actual, however I solve this problem in an Indicator (NT7) by using own version of OnOrderUpdate() and by subscribe OrderStatusEventHandler().
 
Code
protected override void OnStartUp()
{
   //...
   foreach (NinjaTrader.Cbi.Account a in NinjaTrader.Cbi.Globals.Accounts)
   {
      a.OrderStatus += new OrderStatusEventHandler(OnOrderUpdate); // subscribe handler for all accounts

      // subscribe another useful event handlers
      // a.Execution += new ExecutionUpdateEventHandler(OnExecution);
      // a.PositionUpdate += new PositionUpdateEventHandler(OnPositionUpdate);
      // a.Connection.ConnectionStatus += new ConnectionStatusEventHandler(OnConnectionStatus);
      // a.AccountUpdate += new AccountUpdateEventHandler(OnAccountUpdate);
   }
   //...
}

protected override void OnTermination()
{
   //...
   foreach (NinjaTrader.Cbi.Account a in NinjaTrader.Cbi.Globals.Accounts)
   {
      a.OrderStatus -= OnOrderUpdate;	// unsubscribe handler

      // unsubscribe another useful event handlers
      // a.Execution -= OnExecution;
      // a.PositionUpdate -= OnPositionUpdate;
      // a.Connection.ConnectionStatus -= OnConnectionStatus;
      // a.AccountUpdate -= OnAccountUpdate;

   }
   //...
}

// handle event
private void OnOrderUpdate(object sender, OrderStatusEventArgs e)
{
   if (e.Order.Account == acc && e.Order.Instrument == Instrument)  // order status changed for order on my account and instrument only
   {
      // do something useful
      Print(e.Order.ToString());	
      Print("Order state = " + e.Order.OrderState);
      Print("Order action = " + e.Order.OrderAction)
      if (e.Order.OverFill)	
      {
         // handle overfill
      }		
      // etc
   }
}

// private void OnExecution(object sender, ExecutionUpdateEventArgs e)
// {
//     ...
// }

// private void OnPositionUpdate(object sender, PositionUpdateEventArgs e)
// {
//     ...
// }

// private void OnConnectionStatus(object sender, ConnectionStatusEventArgs e)
// {
//     ...
// }

// private void OnAccountUpdate(object sender, AccountUpdateEventArgs e)
// {
//     ...
// }

Reply With Quote
Thanked by:
  #10 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012


Yes, it looks like this is a much better solution that what I came up with...which was to scan the Cbi account and order collections each time I needed to get an update on order status (in an indicator)

I'm not really a C# guy but have been able to do amazing things by reading code here at Futures.IO and of course, from suggestions and tips from its members.

Thank you Asfax, as well as everyone here.

Started this thread Reply With Quote




Last Updated on January 20, 2017


© 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