Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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...