Trail Stop - NinjaTrader Programming | futures io social day trading
futures io futures trading


Trail Stop
Updated: Views / Replies:1,641 / 4
Created: by Kush Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Trail Stop

  #1 (permalink)
Trading Apprentice
San Sebastian/Spain
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: Futures
 
Posts: 12 since Sep 2011
Thanks: 0 given, 0 received

Trail Stop

Hi can anyone please show me to programm a 1000$ Dollar Trail from Close. This calculates a stop point from Highest close in the direction of the trade. And a 1000$ Dollar Trail from High. In this case this calculate a stop point from Highest High reached during the course of the trade.

I just know this type of trailing stop.

SetTrailStop("", CalculationMode.Ticks, 100, false);

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)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary



Kush View Post
Hi can anyone please show me to programm a 1000$ Dollar Trail from Close. This calculates a stop point from Highest close in the direction of the trade. And a 1000$ Dollar Trail from High. In this case this calculate a stop point from Highest High reached during the course of the trade.

I just know this type of trailing stop.

SetTrailStop("", CalculationMode.Ticks, 100, false);


You would need to convert the $ amount into ticks. For every instrument you know the $ value for a point and you know the tick size.

For example for ES the ticksize is 0.25 and the point value is $ 50. The number of ticks that correspond to $ 1000 are

number of ticks = $ 1000 / (point value * ticksize) = 1000 / (50 * 0.25) = 80


To use this with a trail stop you will first have to calculate the number of ticks that correspond to $ 1000 and then enter that value into SetTrailStop. The first calculation can be done in OnStartUp(), as you will only need to do it once.


 
Code
protected override void OnStartUp()
{
        ......
        // declare trailStopInTicks in the Variables region, as you need it in OnBarUpdate()
        double pointValue = Instrument.MasterInstrument.PointValue;
        double tickSize = Instrument.MasterInstrument.TickSize;
        double trailingAmount = 1000.00 // selected $ amount
        trailStopInTicks =  trailingAmount / (pointValue * tickSize);
        ......
}

....

protected override void OnBarUpdate()
{
        ......
        SetTrailStop(CalculationMode.Ticks, trailStopInTicks);
        ......
 }



This was just to explain the mechanics. If you prefer a simple solution, you can also use

 
Code
SetTrailStop(1000);

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Trading Apprentice
San Sebastian/Spain
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: Futures
 
Posts: 12 since Sep 2011
Thanks: 0 given, 0 received

Thank you for the explanation. What I want to know it's difference in point of programming between Dollar Trail from Close and Dollar Trail from High. I mean to see the code in both trail stops... so I can see the difference.

According to page 188 of the book The Computer Analysis of The Futures Market a Dollar Trail from Close is calculated from highest close or lowest close in the direction of the trade.

And a Dollar Trail from High is calculated from highest high or lowest low reached during the course of the trade. What I need is the code to see the difference between both stops.

Thank you.....

Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


Kush View Post
Thank you for the explanation. What I want to know it's difference in point of programming between Dollar Trail from Close and Dollar Trail from High. I mean to see the code in both trail stops... so I can see the difference.

According to page 188 of the book The Computer Analysis of The Futures Market a Dollar Trail from Close is calculated from highest close or lowest close in the direction of the trade.

And a Dollar Trail from High is calculated from highest high or lowest low reached during the course of the trade. What I need is the code to see the difference between both stops.

Thank you.....


@Kush: Whether you want to calculate a trailing stop from the highest high or the highest close is your personal choice. Both is possible.

The book you are referring to dates back to 1991. Charles LeBeau and David Lucas traded futures on daily data, so they used the daily close (probably the settlement price) to trail the stops. If you look at more recent publications by Charles LeBeau, you will realize that he meanwhile trails his stops from the highest high for long and lowest low for short positions. This is what he calls the "Chandelier" exit, as he uses the high points of the candles of the chandelier.

If you run a strategy on NinjaTrader, you will probably run in safe mode, that is set to "CalculateOnBarClose = true". In that case NinjaTrader should adjust the stop price to the close and not to the high or low of the bar. In that case SetTrailStop() cannot be used to build a chandelier exit, as it does not take into account the high or low, when the strategy is set to "CalculateOnBarClose = true".

Actually I never use SetTrailStop(). Instead I use SetStopLoss() and calculate the stop price myself, either from the high, low or from the close. I don't leave that to NinjaTrader.

Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > > Trail Stop

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to trail a stop per Parabolic SAR? christhesquid NinjaTrader Programming 12 August 30th, 2013 06:33 PM
Audit Trail of Trades ab456 Traders Hideout 1 November 28th, 2011 03:41 PM
BE and Trail Stop Strategy Code vegasfoster NinjaTrader 1 September 14th, 2011 10:30 PM
ATR Stop Trail need help pls Falco11 NinjaTrader Programming 6 January 20th, 2011 05:53 AM
Help wanted! Long/short strategy with cancel order and trail stop mrticks NinjaTrader Programming 9 October 26th, 2010 05:15 PM


All times are GMT -4. The time now is 05:30 AM.

Copyright © 2017 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
Page generated 2017-12-16 in 0.54 seconds with 19 queries on phoenix via your IP 54.160.245.121