HOW!!?? Turn SetStopLoss into a ExitLongLimit - NinjaTrader Programming | futures trading

Go Back

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

HOW!!?? Turn SetStopLoss into a ExitLongLimit
Started:March 23rd, 2011 (06:57 PM) by Trader.Jon Views / Replies:1,061 / 2
Last Reply:March 26th, 2011 (11:38 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

HOW!!?? Turn SetStopLoss into a ExitLongLimit

Old March 23rd, 2011, 06:57 PM   #1 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
Trader.Jon's Avatar
Posts: 500 since Jul 2009
Thanks: 401 given, 172 received

HOW!!?? Turn SetStopLoss into a ExitLongLimit


I have (for me) intriguing idea after taking a long look ayt how the SetStopLoss was having my automated strategy trades finish: it looks like there could be another 3 or more ticks of profit available beyond what price was selected as the 'stop loss limit'.

I tried just adding another 3 ticks to the calculation I was using, with a small amount of success (ie same# of trades are taken, small increase in net points) but if I try to make the process into a ExitLongLimit the results are not fruitful (ie dont ask)

                //          Adjust TrailLong Exit
				double TRAILtickAdjustLONG = 0;
						if (  (BarsSinceEntry(0, "",0)) >= iTrailStartBarNum )
				{	 // Rule#1   flat for 3 bars in a row
					if(	iTrailUseTSr1 == 1	&& sTrailSS[0] == 1 && vTrailCt >= 3) 
					// Rule#2    flat for 2 bars in a row  
					if(	iTrailUseTSr2 == 1	&& sTrailSS[0] == 1 && vTrailCt >= 2)
					// Rule#3  TSST EXIT DOWNtrending
					if(	iTrailUseTSr3 == 1	&& sExitSS[0] == -1)
					// Rule#4  fast period EXITing EMA1 is in a DOWNslope
					if(	iTrailUseEMA1r4 == 1 && Falling(sExitMA1) )
					// Rule#5  slow period EXITing EMA2 is in a DOWNslope
					if(	iTrailUseEMA2r5  == 1	&& Falling(sExitMA2))
					// Rule#6  Filter UPslope > EMA3 UPslope 
					if(	iTrailUseK2EMA3r6 == 1	
                                                                                                && Rising(sTrailUKF) && sTrailUKF[0] > sTrailMA3[0]	
                                                                                                && Rising(sTrailMA3) )
					// Rule#7  EXITing KFilter is in a DOWNslope
					if(            iTrailUseUKFr7 == 1 && Falling(sExitUKF)) 
						tVars.cStopLossTicks -= TRAILtickAdjustLONG;
		// this is what I tried to substitute into the code line 'SetStopLoss( )' with horrible results
			//	if ( Lows[1][0] <=  (Position.AvgPrice - tVars.cStopLossTicks * vTickMult))
			//		ExitLongLimit( (Position.AvgPrice - tVars.cStopLossTicks * vTickMult) + 3*TickSize);
			SetStopLoss(CalculationMode.Ticks, tVars.cStopLossTicks * vTickMult + 3*TickSize);															
			DrawSquare(CurrentBar.ToString() + "sl", true, 0, Position.AvgPrice - tVars.cStopLossTicks * TickSize * vTickMult, Color.Crimson);
Any suggestions on how this can be coded effectively? My guess is that this may apply to several people that use SetStopLoss.


update: swapped out
 if ( Lows[1][0]
  if ( Low[0]
and looks more normal but still looking for ideas
more update: I started another thread on MIT / LIT ... I feel that the question posed in this thread will be in the same context as the other discussion

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!

Last edited by Trader.Jon; March 25th, 2011 at 01:24 PM.
Reply With Quote

Old March 23rd, 2011, 06:57 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 26th, 2011, 11:38 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,560 received

Sorry I am not following, maybe someone else will


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

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > HOW!!?? Turn SetStopLoss into a ExitLongLimit

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
Markets To Turn Attention Back to Economy and Earnings Quick Summary News and Current Events 0 August 16th, 2011 11:10 PM
Students of 'Facebook Class' Turn Homework Into a Fortune Quick Summary News and Current Events 0 May 8th, 2011 12:40 PM
Mortgage Delinquencies Are Starting to Turn the Corner Quick Summary News and Current Events 0 February 17th, 2011 07:50 PM
How many have turn profitable because of a thread on BMT? jonc Psychology and Money Management 4 January 9th, 2011 05:17 AM
Question: Turn off indicator titles, info drago1 NinjaTrader Programming 3 April 7th, 2010 10:59 PM

All times are GMT -4. The time now is 05:42 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.08 seconds with 20 queries on phoenix via your IP