Swing Line indicator by Ron Black

v10.3
Swing Line indicator by Ron Black

A precise picture of the short-term price swings is basic to understanding the market direction. The Clear method is an effective way to identify and visualize short-term price swings. The method benefits the individual trader because it is simple, objective, requires no calculation, and has no delay.

This indicator is the implementation of the swing line indicator presented in Ron Black’s article in this issue (“Getting Clear With Short-Term Swings”).

Code converted from TradeStation programming language by a request in the English forum.

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. luxrun • 09/20/2017 #

    Nicolas, ho realizzato un screener dall’indicatore swingline ron-black, che allego. Vorrei però intercettare il cambiamento di swing da ribassista a rialzista, al cambiamento di posizione. Invece lo screener mi restituisce tutti i titoli che al momento sono in fase rialzista. Ho provato a mettere un supertrend per limitare i risultati ma non sono ancora soddisfatto. E’ possibile, a tuo parere, avere una soluzione che trovi i titoli che hanno cambiato swing nella barra precedente alla ricerca dell screener?

    //PRC_SwingLine Ron Black | screener al rialzo
    //20.09.2017
    //Nicolas @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge

    if upsw=1 then
    if high>hH then
    hH=high
    endif
    if low>hL then
    hL=low
    endif

    if high<hL then
    upsw=0
    lL=low
    lH=high
    endif
    endif

    if upsw=0 then
    if low<lL then
    lL=low
    endif
    if highlH then
    upsw=1
    hH=high
    hL=low
    endif
    endif

    if upsw=1 then
    swingline=hL

    else
    swingline=lH

    endif

    indicator1=Supertrend[3,10]
    cond1 = (close > indicator1[1])

    screener [swingline=hL AND cond1]

  2. supertiti • 09/20/2017 #

    Bonjour,

    Ajouter une moyenne au code c’est bien aussi :

  3. supertiti • 09/20/2017 #

    // SLRB SwingLine Ron Black PRC indicator 20.09.2017
    //Nicolas @ http://www.prorealcode.com Sharing ProRealTime knowledge

    if upsw=1 then
    if high>hH then
    hH=high
    endif
    if low>hL then
    hL=low
    endif

    if high<hL then
    upsw=0
    lL=low
    lH=high
    endif
    endif

    if upsw=0 then
    if low<lL then
    lL=low
    endif
    if highlH then
    upsw=1
    hH=high
    hL=low
    endif
    endif

    if upsw=1 then
    swingline=hL
    r=255
    g=228
    b=196
    else
    swingline=lH
    r=255
    g=0
    b=55
    endif

    maSL = average [p,m](swingline)

    return maSL coloured (r,g,b) as ” maSwingLine ” , customclose as ” customeclose SLRB ” // swingline coloured(r,g,b) style(line,3) as “Swing Line” ,

    // Variables :
    // p = 20 entier
    // m = Matype = pondérée

  4. luxrun • 09/20/2017 #

    Grazie Supertiti, provo questo tuo codice con la media pesata!

  5. luxrun • 09/20/2017 #

    Questo è il codice completo, perché mancavano delle righe di codice, nella versione di Supertiti. Ho anche cambiato i colori.
    // SLRB SwingLine Ron Black PRC indicator modified Supertiti 20.09.2017
    //Nicolas @ http://www.prorealcode.com Sharing ProRealTime knowledge
    if upsw=1 then
    if high>hH then
    hH=high
    endif
    if low>hL then
    hL=low
    endif

    if high<hL then
    upsw=0
    lL=low
    lH=high
    endif
    endif

    if upsw=0 then
    if low<lL then
    lL=low
    endif
    if highlH then
    upsw=1
    hH=high
    hL=low
    endif
    endif

    if upsw=1 then
    swingline=hL
    r=0
    g=0
    b=255
    else
    swingline=lH
    r=255
    g=0
    b=0
    endif

    maSL = average [p,m](swingline)
    return maSL coloured (r,g,b) as ” maSwingLine ” , customclose as ” customeclose SLRB ”

    // swingline coloured(r,g,b) style(line,3) as “Swing Line” ,
    // Variables :
    // p = 20 entier
    // m = Matype = pondérée

  6. Stenozar • 09/20/2017 #

    Hi Nicolas, could this indicator be used on forex?

  7. Francesco • 09/20/2017 #

    Hi Nicolas,

    the Swing Line Indicator translate by You seems to be good.
    I thought that it can be used into a screener, simply replacing the “swingline” output variable with the “upsw” as output variable.
    Then, it can be built a new screener that gives the ticker which shows a change from 0 to 1 or from 1 to 0, simply comparing current candle with the previous one.

    I added code for Your review, if You like.

    Ciao

  8. MattD • 09/20/2017 #

    Hi Nicolas,
    Just to confirm, h=previous high and H =todays high, l=previous low and L=Todays low?? Just wanted to place the formula in excel and trying to get my head around writing it.
    Thanks
    Matt

    • Nicolas • 09/20/2017 #

      hH = highest high lH = lowest high etc..

    • MattD • 09/20/2017 #

      Hi Nicolas, Can you assist me with writing this in excel? I’m missing something, because l’m not getting the specified numbers in that chart to match. Mainly around selecting the high & low.
      Thanks
      Matt

    • Nicolas • 09/20/2017 #

      You can ask for other platforms coding through the programming services: https://www.prorealcode.com/trading-programming-services/

    • MattD • 09/20/2017 #

      Hi Nicolas, (me again)

      Can you please clarify the following.

      maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
      maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
      maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
      maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod

      I’m trying to understand where/what these figures are derived from.
      Starting from O,H,L,C figures. maOpen(1) (what does the (1) signify, and is Maperiod -1 essentially the setting “maperiod less1?

      trying to match the numbers on PRT.
      Can you please help with this one?
      Thanks
      Matt

  9. Juan Kumi • 09/20/2017 #

    It seems to be very interesting! Can somebody better explain how they are created? Given my limited knowledge of programming language I failed to give me a precise idea of how it functions.

  10. mcha • 09/20/2017 #

    Bonjour
    Merci pour ce travail, par contre, un petit bug dans le code de Supertiti à la ligne 23 mais sûrement corrigé de vous-même . if high< lH then (mine de rien on essaie de suivre…) le ''<'' avait disparu.

  11. Juan Kumi • 09/20/2017 #

    Is it possible to create a binary indicator for this indicator? What?

    • Nicolas • 09/20/2017 #

      Should be possible but what do you think of precisely?

  12. Juan Kumi • 09/20/2017 #

    I would like the indicator to +1 when swing line is light blue, and opposite -1 when the swing line is purple.

    • Nicolas • 09/20/2017 #

      Just add the r and g variables to the return instruction and you’ll get the information of the current color (r or g would be equal to 255 if the actual trend is bearish or bullish, otherwise it would be equal to 0):
      return swingline coloured(r,g,b) style(line,2) as “Swing Line”, r, g

  13. Juan Kumi • 09/20/2017 #

    Thanks but I did not succeed. Can someone help me?

    • nwesterhuijs • 09/20/2017 #

      //PRC_SwingLine Ron Black | indicator
      //20.09.2017
      //Nicolas @ http://www.prorealcode.com
      //Sharing ProRealTime knowledge

      if upsw=1 then
      if high>hH then
      hH=high
      endif
      if low>hL then
      hL=low
      endif

      if high<hL then
      upsw=0
      lL=low
      lH=high
      endif
      endif

      if upsw=0 then
      if low<lL then
      lL=low
      endif
      if highlH then
      upsw=1
      hH=high
      hL=low
      endif
      endif

      if upsw=1 then
      swingline=hL
      r=0
      g=255
      b=255
      swup=1
      swdwn=0
      else
      swingline=lH
      r=255
      g=0
      b=255
      swup=0
      swdwn=-1
      endif

      return swingline coloured(r,g,b) style(line,2) as “Swing Line”,swup,swdwn

  14. sally31120 • 09/20/2017 #

    Bonjour,
    Je n’arrive pas à faire fonctionner cet indicateur?
    Quel est le bon code dans sa totalité?
    Merci

    • Nicolas • 09/20/2017 #

      Il suffit de le télécharger, de l’importer et de l’appliquer sur le graphique du prix.

  15. avatar
    fabioerliam • 09/20/2017 #

    Nicolas…loving this indicator that you have created!!! Thanks for sharing with everyone! I’m not a profectional indicator’s builder…can you please, when you have time, insert a link here of this indicator (your original version with no MM) but with the signal for long/short enter indicated with the bars below the graphic…green to buy and red to sell…like the one you created for the divergences…I know that someone already asked for it and you have answered him, but following that instructions I’m not able to modify it correctly…if it is not a disturb!
    Thanks so much!
    And another request…don’t hate me:)….how can I indicated, inside a TS, to go long only if this indicator is setting in long way(coloured blu) or short if it indicates to go short(coloured pink)?
    Thanks again

    • Nicolas • 09/20/2017 #

      Sorry but I don’t understand what you are talking about the “original version with no MM” ?

  16. avatar
    fabioerliam • 09/20/2017 #

    I’m reffering to the first code you posted here…after that, someone has add a ponderate average (sorry…in italian called media mobile MM) but I don’t need it… I would like that you can modify for me the original code indicator you posted:)…
    Thanks

  17. giankhy • 09/20/2017 #

    Hi Nicholas, congratulations always for your work and sharing.
    I wanted to ask if with the ron black indicator you can program a trading system.
    Thank you

    • Nicolas • 09/20/2017 #

      Please post your code request in a specific topic in the ProOrder forum, thank you.

  18. Ayoub86 • 09/20/2017 #

    Hi,
    I get this error:

    “Errore di sintassi: Linea 48, carattere 27 Uno dei seguenti caratteri sarebbe più appropriato di “r”: – a color value (0 – 255)”

    how can I solve it?

    thank you

    • Nicolas • 09/20/2017 #

      Your PRT version is inferior to 10.3? So the code in its default state is not compatible. A solution is to delete all references to variables r,g and b in the code.

  19. Mbulelo • 09/20/2017 #

    Hi Nicolas

    Hope all is well your side, do you have a specific strategy for the MFT Swing Line indicator Alert?

    • Nicolas • 09/20/2017 #

      No I don’t, try to make it on your own, or ask in forums (follow the posting rules please).

avatar
Register or

Likes

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

+11 more likes

Related users ' posts
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
Genotik Thank you for your important contribution this week which is much appreciated! Happy New Yea...
Vonasi No problem. I hope they are useful to someone. Happy and hopefully prosperous New Year to y...
DarioMazza Hi Vonasi, i have a question for you, the comand "pricetype" where did you found it in the ...
Vonasi PriceType is just a variable that I use. The value decides what type of price is used in the...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
Violet Abz, the arrows and circles are only the *first part* of a trade setup. If certain conditio...
gabri Violet, you did an excellent job. I attached here https://www.prorealcode.com/prorealtim...
fab.ub HI GABRI, if the cirled arrow is the intermediate point in which You can define your entry a...
Matt B RolanBay, L'ellipse apparaît-elle à la bougie notifiée et reste ?
gianlucapegaso scusa Gagry ma il programm da copiare è quello con tutte le modifiche di cui ho letto nei va...
Valentinocorse bonjour a tous , superbe travail j'aimerai si possible une indication pour modifier l'indic...
Nicolas Oui pourquoi pas? :)
claudiofred Bonjour Nicolas, merci encore pour ce super indicateur. se demander s'il est possible d'écr...
Nicolas Screener déjà présent sur le forum ici: https://www.prorealcode.com/topic/indicador-lastmans...
bazilou pouvez expliquer donchian bias merci
Jessar Hello, could you tell me how to use this indicator? I think the simplest things can still be...
WarningTrading Comment peut on la comparer ? comme ceci ? cela ne me donne plus le message d'erreur manque...
sally31120 Bonjour, je n'arrive pas à créer ce screener close > supertrend extended2[1] la réponse...
Nicolas voir ce sujet pour un screener basé sur Supertrend Extended: https://www.prorealcode.com/top...
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...
rafadonl2 is not taken into account in the procedure. It considers only if it is a doji or when candle...
Guibourse Okay thanks, just a question : how do you plot your two lines in the same window as price ? ...
rafadonl2 sorry, I don't understand your question. Indicator draws Heikin Ashi candle, not price cand...
JR1976 Dear Mike , your screener seem interest and simple... Do you try to envelope an automat...
Player Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards Marc
Igor Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards
Bougnat bonjour, ton screener semble intéressant .... merci pour le partage
guytrc Hi Nicolas - many thanks for your screener. One question if I may - how does condition 5 wor...
Nicolas In the last 20 periods, the SMA 10 periods was above the SMA 20 periods.
stratobast Good afternoon everyone. Thanks Doctrading for your work. I have an issue while using this ...
stratobast My bad guys. I understood what was the problem. The indicator uses highs and lows for the Re...
samwarduk Has anyone tried this on Bitcoin GBP1? The results look amazing but every time mine trie...
rispardin no entiendo como funciana este indicador, por favor alguien podria explicar como utilizarlo???
AVT No se trata de un solo indicador, pero cada linea muestra otra información, de abajo hacia ...
IV Mcm Your indicator is interesting, I evaluated its relevance with the squeeze to detect the phas...
Kris75 Hi Gabri I launched a very simple strategy based on the 3 bars trailing stop that you cre...
TimDeCat Hi. Has anyone coded a version that you could alter it to say 5 bar trailing stop? ie make ...
Nicolas Please open a new topic in forums so we can code it there, thanks.
finplus bonjour, il y a un problème à la fin du code avec elsif (close 0 then ... ne manque t il pas...
kj1988 Hello Nicolas, thank you for this useful indicator. Could you tell me how I can remove the...
Nicolas remove lines 101 to 103
GraHal Yes sorry, I set up a link to a screen shot on my google drive and then I got locked into th...
gabri Here's the thread https://www.prorealcode.com/topic/multiframe-rsi-of-rsi/
Bernard13 Bonjour Nicolas, Pourriez-vous m'indiquer si cet indicateur fonctionne avec la V11 ? Le di...
jens_kittner This strategy was posted 2 years ago. I tested it today and it works perfect with the new da...
giustim Hallo I am not able to use it on daily TF What have I to change? Thanks a lot
pac.ros Ciao Francesco, ti scrivo per un aiuto a proposito della strategia di Hofmann che anch'io ho...
David Balance thanks for sharing this excellent indicator.  Here are some thoughts.  please ad...
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Inertia newlevel then multiplier=multiplier+1 oldlevel=newlevel newlevel=strategyprofit+startequi...
Inertia Hi Bjoern, I was playing around with your code this morning (EUR/USD 5'). Thank you to the...

Top