Williams’ 3 bar trailing stop

Williams’ 3 bar trailing stop

This is one of the very best trading techniques I have ever developed. The reason why is that it often rides mega trend markets for a long , long time, yet does not give back much profit when the correction begins as conventional moving average and channel. 

This technique can be used not only as an exit techniques, but as an entry technique as well. It is really quite simple. Once the market is in a run away move, as I call it a “rock and roll” market – then and only then – do we use this exit. Price must be out of a trading range. 

As a trailing stop: Make certain prices are out of congestion, they have begun to run, then, and only then, implement this as your trailing stop (i.e. exit).

For entry: Make certain the market is really set up. Sometimes the first entry will be false as a straight up or down market usually “bases” before the next trend move begins.

(excerpt from the author’s description of this trend following indicator)

This indicator has been requested by Maximus 78 here (https://www.prorealcode.com/topic/3-bar-trailing-stop-di-larry-williams/).

Blue skies!!!

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Franz1234 • 07/13/2017 #

    Hi gabri,
     
    great work! I am currently working on this 3 bar trailing stop for trading view and I have coded pretty much the same indicator as you. 
    But, the original requirement is to start counting at the highest close in an up move (and lowest close in a down move). So in particular once this highest/lowest close is found then apply then find the lowest/highest low of the last three bars which are not an inside bar.
    The result would be an indicator the keep a bigger distance from the price action when the price moves sideways and does not make new highst/lowest closes.
    So far my thoughts are that it is crucial to define first: “When did the up/down move begin!” This could be done by the indicator which you have already programmed. And then take this as a starting point to find the highst/lowest closes to calculate the further progression of the stop.
    I haven’t found a way to do so. Would be great I you could think about this an share your ideas!
    Thank you in advance!

  2. gabri • 07/13/2017 #

    Franz,
    I see what you mean. I will try to work some code for that but I cannot make any promise.
    G

  3. gabri • 07/13/2017 #

    Franz,
    can this code work for you?
    count=1
    i=0
    j=i+1
    tot=0
    //calcolo 3 barre
    while count<4 do
    tot=tot+1
    if (low[j]<low[i]) and (high[j]>high[i]) then
    //inside bar
    i=i+1
    j=j+1
    else
    count=count+1
    i=i+1
    J=i+1
    endif
    wend
    if close>close[1] then
    basso=lowest[tot](close)
    endif
    if close<close[1] then
    alto=highest[tot](close)
    endif

    if barindex>1 then
    if close > ref[1] then
    ref=basso
    endif
    if close < ref[1] then
    ref=alto
    endif
    endif
    return ref
    I also changed something between lines 5 and 14 to calculate the inside bars. I considered up trend any close above “ref” and downtrend any close below “ref”. Let me know if it works better.
    G

  4. Francesco78 • 07/13/2017 #

    Hi, can you show at least one strategy that works well with this indicator?
    The idea is nice.
    Thank you 

  5. gabri • 07/13/2017 #

    Francesco,
    I just tried to code an idea from Maximus 78 (https://www.prorealcode.com/topic/3-bar-trailing-stop-di-larry-williams/). I am sure he has all the info about strategies connected with this indicator. If I had to guess though I’d say that, being this a trailing stop indicator, it has to be used in conjunction with some other sort of trend indicator.
    G
     

  6. Paul • 07/13/2017 #

    Good work ! I was looking for way to maximise profits and this serves it’s purpose well !

  7. gabri • 07/13/2017 #

    Thanks!!

    • Kris75 • 07/13/2017 #

      Hi Gabri

      I launched a very simple strategy based on the 3 bars trailing stop that you created and plugged it with a dynamic trailing stop from Nicolas;
      it kikcked me out immediately but I don’t understand why;

      Can you see the reason?
      What should have been the code?

      Very best,

      Chris

      PS : the insert code is not working here;

      //————————————————————————-
      // Code principal : STOP LOSS MM
      //————————————————————————-
      defparam preloadbars = 150
      defparam cumulateorders = false

      entry = 32.30

      // trailing stop
      count=1
      i=0
      j=i+1
      tot=0
      while count=low[i]) and (high[j]alto[1] then
      TrailATR=basso
      endif
      if close entry

      if condition then
      buy n shares at market
      //first stoploss:
      SL = TrailATR
      set stop ploss SL
      dynamicSL = SL
      endif

      //dynamicSL
      if longonmarket then
      if(TrailATR>dynamicSL) then
      dynamicSL=TrailATR
      endif
      sell at dynamicSL stop
      endif

  8. TimDeCat • 07/13/2017 #

    Hi. Has anyone coded a version that you could alter it to say 5 bar trailing stop? ie make the number of trailing bars a variable?

    • Nicolas • 07/13/2017 #

      Please open a new topic in forums so we can code it there, thanks.

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+13 more likes

Related users ' posts
Iván
2 weeks ago
Madrosat Bonjour ivan Quelle différence il y a t il entre Extra trend et ultra trend lequel est le p...
MaoRai54 dear Ivan, it seems to be very interesting but please clarify what are all the lines I see i...
Iván Hi! you have the answer in the last line of code... MacdMiddle as "histo" style(histogra...
kats Le Top , a utiliser avec le nuage violet et alerte TN pour plus de précision.
roccafragius Hello Ivan, very good job! May I ask you to translate teh script from TradingView named Tre...
Iván Hi! yes. You can ask for it here: https://www.prorealcode.com/free-code-conversion/
roccafragius Thank you so much Ivan! I created this request in english Translate from TradingView Indicat...
Regisnew très bel indicateur merci
Jean2139 Bonjour Yvan, Merci pour ton indicateur que je trouve très intéressant. Je suppose que tu ...
Suffi Hier eine kleine Korrektur: //-----Inputs-----------------------------------------// MALengt...
kats Bonjour, J'ai une question etes vous trader? Je m'explique , j'ai téléchargé tous les indi...
Faisalx Hola Ivan. Thanks for your great job. I would appreciate if you have look at my request http...
roccafragius Thank you for all these useful information!! Very great job Ivan! THank you so much
geroniman Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations su...
Stenozar Ciao mi restituisce errore line 1; forse è perchè utilizzo la versione 11 ? in questo caso d...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
the_giorgio Hi, nice work I would like to understand something about prorealtime code. With your ...
Iván Hello. When you use the drawcandle() instruction then in the configuration window you add ...
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
Iván
7 months ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
Bernard13 (Je réécris mon commentaire -français- en français car certains mots ne correspondaient pas ...
Iván 1000 indicateurs !!! brutaux
Lean Me parece muy buen indicador, y se complementa muy bien en mi sistema, ¿podrías crear un scr...
Iván Gracias! Para el screener sólo tienes que copiar el indicador y poner como condición de búsq...
Lean Muchas gracias Iván, ya lo he podido crear.
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
Iván
9 months ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...
Iván
9 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...

Top