Trailing Stop Loss and Reverse - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Trailing Stop Loss and Reverse
Started:February 26th, 2011 (10:50 PM) by shergenr Views / Replies:2,927 / 3
Last Reply:March 1st, 2011 (10:05 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Trailing Stop Loss and Reverse

Old February 26th, 2011, 10:50 PM   #1 (permalink)
Just starting out...
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: ES
Posts: 3 since Jan 2011
Thanks: 0 given, 0 received

Trailing Stop Loss and Reverse

I'm not a programmer, but have some skills in this area and have been helping a trader develop a custom indicator and now I am trying to hook it up to an automated strategy to backtest it. The strategy reverses in one of two ways: (1) a signal is violated during a bar and an order to reverse is submitted (EnterLong/Short @ market) the next day or (2) the bar moves through a stop loss point and triggers a stop and reverse (these are typically 5-10 ticks from our signals). Along the way, the stop loss price gets modified as the trend lengthens.

I have been advised to use unmanaged orders and now (by ninja support) quasi-managed orders (highly overloaded and provided an orderid ...e.g., .stopLoss = EnterLongStop(.........). Within OnBarUpdate I am evaluating incoming bars against my indicator values and trading rules and enter a first position, reverse a position, or amend a stop/reverse order. I am creating the stop/reverse order in OnExecutionUpdate. I have some processing going on in OnOrderUpdate (primarily setting orderids to null for unfilled or cancelled orders).

Everything seems to work through the first pair of EnterLong or EnterShort and EnterShort/LongStops, after that first entry and reverse everything seems to fall apart. The tendency is to get gaps where for some reason instead of exiting the position and reentering in the other direction, it simply exits.... Does anyone have any suggestions for coding this? Should I go back to coding unmanaged order entries? Any advice?

Reply With Quote

Old February 26th, 2011, 10:50 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old March 1st, 2011, 06:46 AM   #3 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,558 received

Unmanaged orders == major experience required.

If you truly need unmanaged orders, you would probably benefit from hiring the strategy done by an experienced NT programmer. Then if you want to learn to program, you can use this as a foundation going forward.


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Old March 1st, 2011, 10:05 AM   #4 (permalink)
Just starting out...
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: ES
Posts: 3 since Jan 2011
Thanks: 0 given, 0 received

Thanks Mike. Yes the thought of boot-strapping had occured to me as I have used it often. In fact, my plan was to get the backtesting done and then sub it out for the automated trading. I was hoping that the real complexity of unmanaged orders lies in the error and message trapping required for automated trading and not the mere submission of orders into a historical backtest.

Since I had been advised by NT Support that alternatively either managed or unmanaged orders would work, I was hoping that someone could confirm which was really true.

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Trailing Stop Loss and Reverse

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trailing stop following an indicator nanobiotech NinjaTrader Programming 9 October 3rd, 2011 09:50 AM
trailing stop la LeBeau kiasom EasyLanguage Programming 4 May 13th, 2011 05:13 PM
Stop and Reverse MWinfrey NinjaTrader Programming 2 January 25th, 2011 07:02 AM
"Stop If Bid" command for entry's and stop loss arjfca EasyLanguage Programming 4 October 7th, 2010 05:05 PM
Trailing stop loss kavin729 NinjaTrader Programming 1 August 20th, 2010 01:17 PM

All times are GMT -4. The time now is 04:13 AM.

Copyright © 2016 by 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 2016-10-23 in 0.10 seconds with 20 queries on phoenix via your IP