Custom Time Event for a ATM - futures io
futures io

Custom Time Event for a ATM

Discussion in NinjaTrader

      Top Posters
    1. looks_one jthom with 2 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (4 thanks)
    3. looks_3 MXASJ with 1 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,293 views
    2. thumb_up 6 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Custom Time Event for a ATM

(login for full post details)
  #1 (permalink)
Sydney / Australia
Experience: Intermediate
Platform: NT
Broker: AMP
Trading: Oil
Posts: 118 since Jun 2009
Thanks: 128 given, 105 received

Im looking for the correct method to initiate a custom timer event as soon as a
AtmStrategyCreate order is initiated. If the order is not filled say within 30 secs, a AtmStrategyCancelEntryOrder cancels the current order.
Also CalculateOnBarClose = true;
#region Variables
private string atmStrategyId string.Empty;
string orderId string.Empty;
System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
overridevoid Initialize()
CalculateOnBarClose true;

/// Called on each bar update event (incoming tick)
protected overridevoid OnBarUpdate()
if (

myTimer.Interval 1000;

orderId.Length == 
&& atmStrategyId.Length == && BLAH BLAH)
atmStrategyId GetAtmStrategyUniqueId();
orderId GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.Action.BuyOrderType.LimitClose[0] -TickSize0TimeInForce.DayorderId"BLAH"atmStrategyId);


else if (
myTimer.ToString 30000)


Any ideas in the right direction would be greatly appreciated.


Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Futures education program reviews
Trading Reviews and Vendors
MBoxWave for Sierra Chart for sale 50%
Platforms and Indicators
need help writing easylanguage radarscreen weekly perfor …
EasyLanguage Programming
EasyLanguage: fetch option price using Stock ticker
EasyLanguage Programming
Multichart NET: where can i find esplanation on CustomIn …
Best Threads (Most Thanked)
in the last 7 days on futures io
How much do you know about Bitcoin?
129 thanks
I finally blew up an account
43 thanks
The Crude Dude Oil Trading System
35 thanks
Spoo-nalysis ES e-mini futures S&P 500
30 thanks
Big Mike in Ecuador
30 thanks
(login for full post details)
  #3 (permalink)
Madison, WI
Experience: Advanced
Platform: ALT
Trading: ES
aslan's Avatar
Posts: 622 since Jan 2010
Thanks: 351 given, 1,116 received

If you search the Ninja forums for "timer" you will find several examples. It should be the same for NT 6.5/7.

The basics are to use a timer event callback routine, start the timer when you initiate an order, check the order status when the timer routine is called, turn the timer off when the order fills. You will need to deal with timing windows though, as a timer could go off while you are processing an order, so you could get a timer event even though you thought you turned it off already. Also consider the case of initiating a timer when it is already running (if you had long timers).

Reply With Quote
(login for full post details)
  #4 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
Big Mike's Avatar
Posts: 50,094 since Jun 2009
Thanks: 32,558 given, 98,593 received

Something like this:

private System.Windows.Forms.Timer myTimerClock             = new System.Windows.Forms.Timer();
bool init false;
// ---

private void OnTimerTick(object senderEventArgs e)

void DoTime(Object myObjectEventArgs myEventArgs)

void UpdateTime(object state)
// your timer related stuff here

protected override void OnBarUpdate()

if (!
init && !Historical)
myTimerClock.Tick += new EventHandler(DoTime);
myTimerClock.Interval 1000;
init    true;


override void Dispose()
// timer dispose

Rest of your ATM-specific stuff is up to you.


We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following 4 users say Thank You to Big Mike for this post:
(login for full post details)
  #5 (permalink)
Sydney / Australia
Experience: Intermediate
Platform: NT
Broker: AMP
Trading: Oil
Posts: 118 since Jun 2009
Thanks: 128 given, 105 received

Cheers Mike. That helped out. Many thanks

Started this thread Reply With Quote
(login for full post details)
  #6 (permalink)
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received

If you are on NT7 you will need a barsIndex overload in TriggerCustomEvent. This appears to be different than 6.5 where barsIndex was optional:

private void OnTimerTick(object senderEventArgs e)

Note the Zero between UpdateTime and myTimer.Interval

Reply With Quote
The following 2 users say Thank You to MXASJ for this post:

futures io Trading Community Platforms and Indicators NinjaTrader > Custom Time Event for a ATM

Last Updated on May 18, 2010

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Our 12-year anniversary w/ $$,$$$ prizes (check soon)


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, 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.
no new posts