Trying to set trailing stop to be two ticks below the low>> HELP! - NinjaTrader Programming | futures.io
futures.io futures trading


Trying to set trailing stop to be two ticks below the low>> HELP!
Started: by budfox Views / Replies:994 / 22
Last Reply: Attachments:0

Welcome to futures.io.

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

Reply
 
Thread Tools Search this Thread
 

Trying to set trailing stop to be two ticks below the low>> HELP!

  #1 (permalink)
Membership Temporarily Revoked
Toronto
 
Futures Experience: Beginner
Platform: Sierra
Broker/Data: MB
Favorite Futures: ES
 
Posts: 313 since Jun 2013
Thanks: 182 given, 58 received

Trying to set trailing stop to be two ticks below the low>> HELP!

Hi there,

I am hoping more experienced futures.io (formerly BMT) members such as @Beljevina @bukkan @ratfink @sam028 @vvhg @KennyK @vantojo @ would be kind enough to provide some assistance.

I am brand new to the world of coding, so please be a bit patient with me.

My objective is to have a profit target that is 1 ATR below the low of the entry candle (Short).

I developed the bulk of the strategy in the wizard , but I was informed by NT staff, the wizard does not have the ability to subtract the ATR, and has to be manually coded.

If someone could be so kind as to show me how to manually alter the code I would greatly appreciate it.

I would be more than happy to PM you my code.

Thank You,

BF.


Last edited by budfox; September 14th, 2014 at 04:33 PM.
Reply With Quote
 
  #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.

 
  #3 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,257 since Jun 2009
Thanks: 3,480 given, 3,847 received


Not compiled nor tested but something like this :
 
Code
                            
int AtrPeriod=14;

SetProfitTarget(CalculationMode.Price,Low[0]-ATR(AtrPeriod)[0]); 

Usually in trading, those who know don't talk, and those who talk don't know. (Al Brooks)
success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #4 (permalink)
Membership Temporarily Revoked
Toronto
 
Futures Experience: Beginner
Platform: Sierra
Broker/Data: MB
Favorite Futures: ES
 
Posts: 313 since Jun 2013
Thanks: 182 given, 58 received


sam028 View Post
Not compiled nor tested but something like this :
 
Code
                            
int AtrPeriod=14;

SetProfitTarget(CalculationMode.Price,Low[0]-ATR(AtrPeriod)[0]); 

Hello Sam, @sam028

Thank you so much for providing me with this code. I am trying my best to learn C#.

Just curious, have you ever experienced a situation where there was a particular model, that you could not code/backtest?

Have a great day!

BF

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 27 since Jul 2013
Thanks: 14 given, 1 received

Futures Edge on FIO
So this thread seems to be on a similar topic ...

I'm looking to use the "Percent Trailing" code for easylanguage and turn it into a "point trailing" code. This is what the % trailing looks like:

 
Code
inputs: 
	PositionBasis( true ), 
	FloorAmt( 1 ), 
	TrailingPct( 20 ) ;                              

if PositionBasis then
	SetStopPosition
else
	SetStopShare ;

SetPercentTrailing( FloorAmt, TrailingPct ) ;
Now what I'm looking to do is substitute "FloorAmt" with something like "PointAmt" (<-- not a reserved word) and "SetPercentTrailing" with "SetPointTrailing" (<--- also not a reserved word).

I've looked at the reserved words and can't seem to find a solution to this. Does anyone have an idea of how I could go about coding this? ANY info would be very much appreciated!

thanks,
brandon

Reply With Quote
 
  #6 (permalink)
Elite Member
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,212 since Jul 2012
Thanks: 1,010 given, 4,017 received


djvie11 View Post
So this thread seems to be on a similar topic ...

I'm looking to use the "Percent Trailing" code for easylanguage and turn it into a "point trailing" code. This is what the % trailing looks like:

 
Code
inputs: 
	PositionBasis( true ), 
	FloorAmt( 1 ), 
	TrailingPct( 20 ) ;                              

if PositionBasis then
	SetStopPosition
else
	SetStopShare ;

SetPercentTrailing( FloorAmt, TrailingPct ) ;
Now what I'm looking to do is substitute "FloorAmt" with something like "PointAmt" (<-- not a reserved word) and "SetPercentTrailing" with "SetPointTrailing" (<--- also not a reserved word).

I've looked at the reserved words and can't seem to find a solution to this. Does anyone have an idea of how I could go about coding this? ANY info would be very much appreciated!

thanks,
brandon

Try SetDollarTrailing. But, both of the trailing functions will give overly optimistic results, unless you use LIBB at the 1 tick level. Personally, I'd avoid both of them.

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 27 since Jul 2013
Thanks: 14 given, 1 received


kevinkdog View Post
Try SetDollarTrailing. But, both of the trailing functions will give overly optimistic results, unless you use LIBB at the 1 tick level. Personally, I'd avoid both of them.

Gotcha, thanks for the suggestion!

I also just got the below code to work too, if anyone needs it


Quoting 
PositionBasis( true ),
TrailingPts ( 1 ),
TrailingPct ( 50 ) ;


Reply With Quote
 
  #8 (permalink)
Elite Member
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,212 since Jul 2012
Thanks: 1,010 given, 4,017 received


djvie11 View Post
Gotcha, thanks for the suggestion!

I also just got the below code to work too, if anyone needs it

Just don't believe the results. Once you see them, you will certainly want to believe them.

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
The following user says Thank You to kevinkdog for this post:
 
  #9 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 27 since Jul 2013
Thanks: 14 given, 1 received


kevinkdog View Post
Just don't believe the results. Once you see them, you will certainly want to believe them.

Kevin -

I agree with you - in my past experience these results were much, muuuuch better than how the strategy actually performed in the live market. What's your opinion of this occurrence? Slippage? The trailingPct not actually being able to see the fluctuations of the market in real-time?

If so, wouldn't using the back-testing resolution of "Use look-inside-bar Back Testing" be of use in this situation?

thanks
-brandon

Reply With Quote
 
  #10 (permalink)
Elite Member
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,212 since Jul 2012
Thanks: 1,010 given, 4,017 received



djvie11 View Post
Kevin -

I agree with you - in my past experience these results were much, muuuuch better than how the strategy actually performed in the live market. What's your opinion of this occurrence? Slippage? The trailingPct not actually being able to see the fluctuations of the market in real-time?

If so, wouldn't using the back-testing resolution of "Use look-inside-bar Back Testing" be of use in this situation?

thanks
-brandon

Yes, as I previously mentioned, you can get accurate results if you use Look Inside Bar Backtesting at the 1 tick level. But that usually means you can only test 6 months back, unless you have a tick database stored on your PC.

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
The following user says Thank You to kevinkdog for this post:

Reply



futures.io > > > > > Trying to set trailing stop to be two ticks below the low>> HELP!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

2016 True Edge Awards: Voting is open until Jan 21!

Now
 

Anthony Drager: Pulling the trigger with confidence

Elite only
 

Leo Murphy: The Art and Science of Technical Analysis

Elite only
 

FuturesTrader71: Ask Me Anything

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
CLICK HERE if you are landlord>>> Creditor trying to garnish my precious rent budfox Off-Topic 16 May 12th, 2014 12:25 PM
ACD System>>>A & C Values for the ES budfox Index Futures Trading 3 October 28th, 2013 05:20 PM
Difference in simulator trading the ES and live trading with a small account>>> budfox Traders Hideout 8 July 6th, 2013 11:59 PM
BLUELINE DELIGHT >>>Intraday Trading Strategy Guide<<< Gabriyele The Elite Circle 407 May 30th, 2013 08:29 AM
TIP : Search for free NinjaTrader Indicator on BMT ? >> How to use our searchtools ! max-td Beginners and Introductions 2 July 19th, 2010 07:16 AM


All times are GMT -4. The time now is 04:10 PM.

no new posts
Page generated 2017-01-20 in 0.16 seconds with 19 queries on phoenix via your IP 54.163.112.69