Ninjatrader 8: straegy with 2 stop orders help! - NinjaTrader | futures io social day trading
futures io futures trading

Ninjatrader 8: straegy with 2 stop orders help!
Updated: Views / Replies:635 / 0
Created: by endystrike Attachments:1

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

Ninjatrader 8: straegy with 2 stop orders help!

Elite Member
Turin Italy
Futures Experience: Advanced
Platform: MultiCharts, NinjaTrader
Broker/Data: AMP+IQFeed
Favorite Futures: CL, FDAX, ES, NG, GC, ZS, GF
Posts: 6 since Apr 2013
Thanks: 2 given, 1 received

Ninjatrader 8: straegy with 2 stop orders help!

Hello everybody!
I coded a sample strategy in NinjaTrader 8 that would be the base for many breakout strategies (changing order type from "stop" to "limit" also for reversals) and I also coded Alert part in this script to receive email for entries and exits...
The sample strategy would be quiet simple to be coded in mc because there's no problem to send more than 1 stop/limit pending order at the same time for entries, while in NinjaTrader it seems that would be required to use "Unmanaged Approach" instead of "Managed Approach" to send more that 1 stop/limit entry order simultaneously... In fact in this code short entry order in most cases is skipped because there's yet a long entry order written before into the script...

Can anyone help me please to transform this code from "Managed Approach" to "Unmanaged Approach"?

The rules of the strategy are quiet simple:
- maximum 1 trade long + 1 trade short a day
- entries: long buy stop on high of yesterday, sell short on low of yesterday during TimeWindow and respecting "dayofweek" and "month to skip" inputs;
- stoploss: the nearest price level between technical stop and max points stop from entryprice (for long I set lowd1 and 100 points, for short highd1 and 100 points);
- breakeven: if Breakeven input>0 set breakeven stop to 150 points;
- Take profit: if takeprofit input>0 set profit to 200 points;

Note1: previous day OHLC levels are calculated when day changes (like in mc if d<>d[1] then begin.... ) from DataSeries[1] (= data2 of MC) as 1440 mins, to take those values from intraday data...
Note2: you can set additional techical filters (like those in PtnbaseSA) changing longcondition, shortcondition, longfalsecondition and shortfalsecondition, there you can set dailyfactor and any other pattern.
Note3: I coded alert part of the script taking parts from NT Guide and from a previous code I created for NinjaTrader 7 that worked fine, but haven't sill tested it in NT8. Anyway different functions between the different versions of NT have been changed in the script.

I coded the script so that for other users would be easy to filter dayofweek and month and set a time windows with pauses, all those parameteres are visible into the input mask and grouped for categories...
In this way, once stop/limit order problem will be solved, other users who want to code using NinjaTrader 8 would have a good sample to start taking confidence with the platform language...

Note4: Another alternative solution would be to convert stop/limit entry orders to market orders when stop/limit price is touched (eg. in MC language "if high>highd1 then buy next bar market" instead of "buy next bar highd1 stop"), but for now I'd prefer to use stop/limit orders and anyway there's the possibility that breakeven orders would give problems too...

Thanks a lot to anyone who would help me!!!

Attached Files
Register to download File Type: cs Sample2EntryOrdersNT8.cs (18.6 KB, 26 views)


futures io > > > > Ninjatrader 8: straegy with 2 stop orders help!
Thread Tools

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

September Journal Challenge (sponsored by TopstepTrader)


Battlestations! Win $947 in prizes for showing us your trading desk!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sell Stop/Buy Stop Orders huzaifamf The Elite Circle 2 August 31st, 2016 01:33 AM
Automating buy stop and sell stop orders when trading renko? mannya Traders Hideout 3 September 3rd, 2015 04:41 AM
using volatility to submit limit/stop and exit/target orders in ninjatrader strategy Cachevary NinjaTrader Programming 3 September 8th, 2014 07:52 PM
Ninjatrader strategy for Trailing Stop and stop loss. skann NinjaTrader 2 August 20th, 2013 07:34 PM
Code for Entering Orders with Profit Target and Stop Loss orders aguison NinjaTrader Programming 4 June 24th, 2013 01:52 PM

All times are GMT -4. The time now is 10:14 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-10-19 in 0.09 seconds with 15 queries on phoenix