Are ATM orders Suitable in a NinjaScript (or better avoid it) - NinjaTrader | futures io social day trading
futures io futures trading

Are ATM orders Suitable in a NinjaScript (or better avoid it)
Updated: Views / Replies:1,313 / 1
Created: by benwincky Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Thread Tools Search this Thread

Are ATM orders Suitable in a NinjaScript (or better avoid it)

  #1 (permalink)
Brussels Belgium
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: Forex
Posts: 14 since Mar 2013
Thanks: 5 given, 0 received

Are ATM orders Suitable in a NinjaScript (or better avoid it)

Hello sir,

This is a copy of a question I asked the support forum

I’m wondering if it is suitable to use ATM orders within a NinjaScript

I quote you Help section considering the “AtmStrategyClose()” method

Cancels any working orders and closes any open position of a strategy by first modifying any existing target orders so they are filled or submitting a market order if no target orders exist.

Method Return Value

Returns true if the specified ATM strategy was found; otherwise false. [COLOR="YellowGreen"]True in NO WAY indicates that the strategy in fact has been closed
. It indicates that the the specified ATMstrategy was found and the internal close routine was triggered”[/COLOR]

The green colored part worries me a lot because I based all my entries on ATM

I enter “Short” (let’s say) with the following code

private void GoShort(){


Print(ChartName + " VENTE EST LANCE "+String.Format("{0:HH:mm:ss}",DateTime.Now)+" "+Price);

if (orderId.Length == 0 && atmStrategyId.Length == 0)


atmStrategyId = GetAtmStrategyUniqueId();

orderId = GetAtmStrategyUniqueId();

AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Market, Low[0], 0, TimeInForce.Gtc, orderId, "MoBenOrder", atmStrategyId);


Positions[0].MarketPosition = MarketPosition.Short;


Disregard the Print and the last market position is short. We know it is short, but since I hired a C# programmer, I don’t want to change his code

And I close (and this is where I’m worried) with the following code

private void StopOrder(){

if(Positions[0].MarketPosition == MarketPosition.Long){


Print(ChartName + " STOP ACHAT "+String.Format("{0:HH:mm:ss}",DateTime.Now)+" "+Price);

if(orderId.Length > 0)


atmStrategyId = string.Empty;

orderId = string.Empty;


if(Positions[0].MarketPosition == MarketPosition.Short){


Print(ChartName + " STOP VENTE "+String.Format("{0:HH:mm:ss}",DateTime.Now)+" "+Price);

if(orderId.Length > 0)


atmStrategyId = string.Empty;

orderId = string.Empty;


Positions[0].MarketPosition = MarketPosition.Flat;


What would you tell me

1. ReWrite all the entries so that I don't use ATM in the script

2. Carry on with The Atm. they are OK to initiate orders in a ninja strategy

Shortly rephrased. How does one makes 100% sure that the ATM order was closed" whether or not a Target or a stop loss" has been reached

Thanks In Advance,

Benoit Winckelmans

Last edited by benwincky; August 11th, 2013 at 08:29 AM.
Reply With Quote
  #2 (permalink)
Elite Member
Mumbai, India
Futures Experience: Intermediate
Platform: MT4, NT7,eSignal
Broker/Data: AMP/CQG
Favorite Futures: Index,currencies
indiantrader's Avatar
Posts: 105 since Jul 2010
Thanks: 314 given, 134 received

This post has been selected as an answer to the original posters question Answer

Its okay to use ATM strategy in ninjascript, only thing is you cannot backtest them, but only test them on market replay or live.
However, if you want to backtest, then unmanaged approach would be the best with orders handling as an IOrder object.

Instead of Position.MarketPosition==MarketPosition.Short
you should have

Check out this post of a sample ATM based ninjascript strategy.

Reply With Quote


futures io > > > > Are ATM orders Suitable in a NinjaScript (or better avoid it)

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

July Journal Challenge - $500 in Amazon Gift Cards!


AXESS Trader: Powerful Cloud Based Trading Platform w/GFF Brokers

Jul 17

TBA: FuturesTrader71 w/Morad Askar

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced managed orders ninjascript with intrabar granularity iPipper427 NinjaTrader Programming 7 June 4th, 2013 11:21 PM
Strategy creating to many orders with ATM ryangillespie NinjaTrader Programming 3 January 22nd, 2012 10:22 AM
NOT Suitable for delicate Americans!! dee50 Jokes 0 December 4th, 2011 10:15 AM
White House Orders Review Of Energy Department Loans To Avoid Solyndra Subpoena And E Quick Summary News and Current Events 0 October 28th, 2011 03:59 PM
ATM and Limit Orders spinnybobo NinjaTrader Programming 6 June 12th, 2010 08:06 PM

All times are GMT -4. The time now is 03:39 PM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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
Page generated 2018-07-16 in 0.10 seconds with 18 queries on phoenix