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)
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.
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.
This was just to explain the mechanics. If you prefer a simple solution, you can also use
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.
@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.
HOLA, buenas tardes soy de EL SALVADOR, he leído la explicación a @Kush, puedes ayudarme a explicar más sobre SetTrailStop(), tengo una estrategia automática que me hace mis entradas y cierres en el take Profit, pero me gustaría optimizar la con un trail stop, pero me gustaría que el trail stop fuera tick a tick que siga al precio pero entiendo cómo configurar el código para que cuando ya esté dentro de la operación el SetTrailStop() siga tick a tick al precio a una distancia
Puedes por favor enseñarme y mostrarme cómo programar ese código, por favor ? Gracias
Is it possible to help me to code a trailing stop that is defined by me rather than just a satic trailing stop in ninjatrader.
Want to initial paramteres to be met
#1 when trail that a certain number of ticks the trail price improves and continues to act as a trail.
#2 similar to that, instead of a crtain number of ticks price may reach, second is if the first target profit order in a pos is hit the trail improves to a set number of ticks behind price and continues to trail price.