Ninjatrader 8: straegy with 2 stop orders help! - futures io
futures io



Ninjatrader 8: straegy with 2 stop orders help!


Discussion in NinjaTrader

Updated
    1. trending_up 1,207 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 1 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
 

Ninjatrader 8: straegy with 2 stop orders help!

(login for full post details)
  #1 (permalink)
 endystrike 
Turin Italy
 
Experience: Master
Platform: MultiCharts, NinjaTrader
Broker: Interactive Brokers + TradeStation
Trading: CL, FDAX, ES, NG, GC, ZS, GF, RB, HO, NQ, PA, PL
 
Posts: 7 since Apr 2013
Thanks: 2 given, 1 received

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, 48 views)
Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Ninjatrader 8: straegy with 2 stop orders help!


Last Updated on December 9, 2016


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
 

Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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