NexusFi: Find Your Edge


Home Menu

 





OnOrderUpdate questions


Discussion in NinjaTrader

Updated
    1. trending_up 1,427 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?
Cheap historycal L1 data for stocks
Stocks and ETFs
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
 
  #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