NexusFi: Find Your Edge


Home Menu

 





OnOrderUpdate questions


Discussion in NinjaTrader

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




 
Search this Thread

OnOrderUpdate questions

  #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

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
Battlestations: Show us your trading desks!
18 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


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 Twitter Reply With Quote
Thanked by:




Last Updated on February 1, 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