NexusFi: Find Your Edge


Home Menu

 





OnOrderUpdate questions


Discussion in NinjaTrader

Updated
    1. trending_up 1,782 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 ericson 
Sacramento, CA
 
Experience: Advanced
Platform: NinjaTrader
Broker: NA
Trading: Stocks, Forex
Posts: 64 since Nov 2013
Thanks Given: 14
Thanks Received: 19

Ok so this is for forex 1 minute bars. I want to trigger a market order if my limit order doesn't trigger after 30 seconds into the 1 minute bar.

Will the below code trigger correctly or is only called once and isn't called again after the elapsed 30 seconds?

I was originally just going to use
OrderState.Cancelled == order.OrderState,
but thats not until the next bar


 
Code
protected override void OnOrderUpdate(IOrder order)
{
if ( (order.Time.AddSeconds(30) == Time[0]) && (OrderState.Filled != order.OrderState) && (order.OrderState == OrderState.Working) ) { market order logic here}
}


Started this thread Reply With Quote

 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,756 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,632


OnOrderUpdate is called when an order status is updated, not every X seconds.
In your case, I think you should use TriggerCustomEvent() with an EventHandler(), so you can have "something" called exactly every X seconds.


Success requires no deodorant! (Sun Tzu)
Follow me on X Reply With Quote
Thanked by:




Last Updated on February 1, 2014


© 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