Bear and Bull volume indicator

v10.3
Bear and Bull volume indicator

This code is mainly for Wyckoffians and can be used in accumulation/distribution phases to spot the change of forces.

The volume bars are showing who is stronger in the period defined in the timeframe (more green means that bulls are running the show, in this case, in the weekly period).

The moving averages are showing the same information but based on an historical point of view (when the bull line crosses over the bear line bulls are becoming stronger in the longer period).

I suggest to use a period of 22 or more and always based on the timeframe in use.

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. swapping • 02/05/2018 #

    very interesting, thank you gabri

  2. supertiti • 02/05/2018 #

    Bonjour a tous,

    Au vu de la disparite des histogramme ne peut-on pas ramener cet indicateur sur une echelle de 0 a 100
    pour avoir une idee plus precise de l evolution des bulls and bears
    ¡ Nicolas devrait pouvoir nous le faire ! ?

  3. supertiti • 02/05/2018 #

    Bonjour
    manque de temps ou impossible de ramener cet indicateur sur une echelle de 0 à 100 ?

  4. gabri • 02/05/2018 #

    //stocperiod= period of choice

    a=mmred-mmgreen
    alto=highest[stocperiod](a)
    basso=lowest[stocperiod](a)
    sto=100*(a-basso0/(alto-basso)

    return sto

  5. supertiti • 02/05/2018 #

    Bear and Bull Volume %
    //stocperiod= period of choice

    a=mmred-mmgreen
    alto=highest[stocperiod](a)
    basso=lowest[stocperiod](a)
    sto=100*(a-basso/(alto-basso))

    return sto

    Buonasera Gabri apparentemente codifica come non funziona ?!
    stocperiod = 50

  6. gabri • 02/05/2018 #

    period=22
    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif
    //media volumi rossi e verdi per media mobile semplice
    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    stocperiod= 100
    a=mmgreen-mmred

    alto=highest[stocperiod](a)
    basso=lowest[stocperiod](a)
    sto=100*(a-basso)/(alto-basso)
    return sto

  7. gabri • 02/05/2018 #

    Prorealcode sometimes cuts the codes, I hope it works now

  8. supertiti • 02/05/2018 #

    Hello Gabri

    This is not what I would like because we do not distinguish the strength of red and green histograms (their junction reported on a scale of 0 to 100 showing us the trend)

    the idea is to induce the trend by the biased volumes of the indicator.

    thank you for your support

    have a good day

  9. gabri • 02/05/2018 #

    I am not sure I understand what you mean.

  10. supertiti • 02/05/2018 #

    https://www.prorealcode.com/topic/volume-bear-bull-gabri-100/

  11. supertiti • 02/05/2018 #

    Hello Gabri ,

    From this indicator can we have a screener that highlights the histograms entirely red in the last x periods.

    thanks for your help

  12. gabri • 02/05/2018 #

    Do you want a screener or a code to highlight bars? I don’t understand

  13. supertiti • 02/05/2018 #

    I want a screener please

  14. gabri • 02/05/2018 #

    I don’t think you will never find an histogram completely red…if that’s what you mean.

  15. supertiti • 02/05/2018 #

    Yes yes there are many completely red histograms, it is to set up a strategy.

  16. gabri • 02/05/2018 #

    period=11
    lookback=10
    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif

    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    onlyred=mmgreen=0
    c2=summation[lookback](onlyred)

    SCREENER [c2] (mmred as “res”)

  17. supertiti • 02/05/2018 #

    Hello Gabri

    The code as it does not work, I tested it in different markets and countries daily. I also changed the value of lookback to 1 to test, I will only like the results on the last day side.

    good Sunday

  18. gabri • 02/05/2018 #

    When I run the screener I found only starbucks on the italian market matching the criteria and no stocks on the us market. As I told you I am not sure you can get many all-red bars. Lowering the period (not the lookback value) might help but this will not be a useful result. When I created this code I did it with the idea to help people using the Wyckoff techniques…and this has nothing to do with automatic trading or screening of stocks.

  19. supertiti • 02/05/2018 #

    I recently read “the method Wyckoff” by Enrique Diaz Valdecantos, and I found interesting leads following his explanations on volumes.

    Your volume indicator comes very well in support of the book.

    I like you Starbucks in return.

    To isolate the days when the volumes are 100% negative would have helped me to develop my observations, a pity.

    thank you for your help cordially

  20. poldoposta • 02/05/2018 #

    Purtroppo su versione 10.2 non funziona….mi stavo cominciando a documentare su Wyckoff!! qualcuno ha modificato x versione 10.2 PRT ??? Grazie

  21. gabri • 02/05/2018 #

    Che errore riporta?

  22. poldoposta • 02/05/2018 #

    Errore nell’indicatore: PRC_CandlesticksPatterns
    Errore di sintassi: Linea 12, carattere 9 Uno dei seguenti caratteri sarebbe più appropriato di “(“:
    – “,”
    – “=”

  23. poldoposta • 02/05/2018 #
  24. poldoposta • 02/05/2018 #

    https://ibb.co/izCTCx

  25. poldoposta • 02/05/2018 #

    al link trovi screen shot…non sono riuscito a postare immagine. GRAZIE MILLE

  26. gabri • 02/05/2018 #

    Se hai copiato e incollato il codice che ho scritto non dovresti avere quel messaggio. Alla riga 12 non ci sono parentesi da generare errori. Riesci a copiare e incollare la tua riga 12?

  27. poldoposta • 02/05/2018 #

    scusami se ti scrivo solo ora, ma non mi arrivano le notifiche e pensavo non mi avessi risposto.
    Comunque io ho importato il file *.itf e non ho copiato il codice.
    Essendo nuovo del forum ti dispiacerebbe farmi capire quale copiare ed incollare? quello in alto o quello in qualche post che avete discusso?
    Grazie mille

  28. poldoposta • 02/05/2018 #

    scusami non appena sono a casa ti posto la riga 12 (ma non è altro che quella del file itf. Rigrazie

  29. poldoposta • 02/05/2018 #

    https://ibb.co/hpjcuc

  30. poldoposta • 02/05/2018 #

    LINEA 20 CARATTERE 35 ….. link sopra con screenshot. Grazie mille

  31. gabri • 02/05/2018 #

    Cambia la riga cosi’:
    return volbear coloured (205,0,0) , volbull coloured (0,190,0) , mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”

    non verra’ visualizzato un istogramma ma una linea normale

    • Kris75 • 02/05/2018 #

      Hi Gabri,

      I am trying to set a simple strategy based on your very cool indicator

      Here are the conditions:

      BUY = ENTRY :

      if the bull-volume-green-bar CROSSES (i.e is superior) the simple moving average of the past 23 bull-volumes
      if the bull-volume-green-bar CROSSES (i.e is superior) the simple moving average of the past 23 bear-volumes

      SELL = EXIT:

      if the bear-volume-green-bar CROSSES the simple moving average of the past 23 bull-volumes
      if the bear-volume-green-bar CROSSES the simple moving average of the past 23 bear-volumes
      I tried to use the automatic coding system but it does not work; I tried also to code it myself using moving average but it is not working either.

      Can you help me on this?

      Thanks !

      Chris

  32. gabri • 02/05/2018 #

    Kris, I will answer on the forum at the following address https://www.prorealcode.com/topic/strategie-sur-bull-bear-volumes/#post-66030.
    Give me a few days since I am in the process of moving.

  33. segie • 02/05/2018 #

    Hi Guys,

    Will it be possible to add “Texts” to this code. When the bull line crosses over the bear line I would like to insert a “BULL” text on the:
    1.Corresponding volume bar or histogram on this indicator
    2.On the corresponding Price candle. I would like the “Bull” text to appear just above the candle stick.
    3.Vice versa for when the bear line crosses the bull line.

    Regards,
    Segie

  34. gabri • 02/05/2018 #

    Segie, I can add text on the graph of THIS indicator. To add text ALSO on the price graph you need to do another code and everytime you change the settings on the bear bull volume indicator you need to change the settings also on the second one….you might end up having not the same info and this is not good in my opinion.

  35. inder1211 • 02/05/2018 #

    bro volume indicator works on mt 4 ?

    • Nicolas • 02/05/2018 #

      This indicator is for ProRealTime (PRT), you can ask for private job on this page: https://www.prorealcode.com/trading-programming-services/

  36. 427trading • 02/05/2018 #

    hello, im getting an error when i paste in the code…

    return volbear coloured (205,0,0) style (histogram), volbull coloured (0,190,0) style (histogram), mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”

    this is the issue, please can you adise me on this

    many thanks

    • Nicolas • 02/05/2018 #

      This code should work for all prorealtime trading platform v10.3 onwards.

  37. 427trading • 02/05/2018 #

    when pasted into the indicator area it says THE FOLLOWING VARIABLE IS UNDEFINED:PERIOD any idea why?

    ref=(close-low)/range
    volbull=ref*volume
    volbear=volume

    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif
    //media volumi rossi e verdi per media mobile semplice
    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    return volbear coloured (205,0,0) style (histogram), volbull coloured (0,190,0) style (histogram), mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”

    • Nicolas • 02/05/2018 #

      yes, because it is not defined in the code. I would recommend to download the itf file and import it into your platform to get all the extern variables.

  38. marcov66 • 02/05/2018 #

    Very useful indicator! Great! just a question. According to you is it possible to create a double Accumulation-Distribution indicator, with two lines? one for buy volume and one for sell volume. Thanks for your feedback. M

    • gabri • 02/05/2018 #

      Hi, this would be the idea behind.

  39. marcov66 • 02/05/2018 #

    What I mean is not a bear/bull Average as integrated in the indicator but a new Accumulation-Distribution Indicator able to splitted the buy volume and the sell volume. It means AD buy line + AD sell line. Ho fatto una simulazione in Excel con 3 linee (AD/ADbuy/ADsell). Thanks M

  40. gabri • 02/05/2018 #

    Si, dovrebbe essere un accumulation/distribution indicator in grado di dirti quando il mercato diventa bull o bear

  41. marcov66 • 02/05/2018 #

    Ciao Gabry, provo a spiegarmi meglio in italiano. Innanzitutto complimenti per l´indicatore. Trovo che la suddivisione che hai fatto tra i volumi in buy e i volumi in sell sia la parte + geniale. Abbinato ai volumi Buy/sell utilizzo l´indicatore Accumulation-Distribution (indicatore di default). L´indicatore classico AD tuttavia, nel calcolo considera i volumi totali per ogni barra senza scindere quelli in buy o in sell. Io ho fatto una simulazione in Excel (non so come condividertela) dove oltre all´AD classico ci sono AD buy e Ad sell. Io non sono un programmatore, ma vedo che tu sei molto bravo. Saresti in grado eventualmente di programmare questo nuovo indicatore con 3 linee AD/AD buy/AD sell? Grazie per il supporto. Un saluto Marco

    • gabri • 02/05/2018 #

      Ciao, ora ho capito. Devi aggiungere le seguenti righe:

      riga 4:
      ADvolbull = volbull
      ADvolbear = volume – ADvolbull

      riga 5:
      BullAD = sum[ADvolbull*((Close-Low) – (High-Close)) / (High-Low)]
      BearAD = sum[ADvolbear*((Close-Low) – (High-Close)) / (High-Low)]

      alla fine dell’istruzione return aggiungi una virgola e poi il seguente testo:
      BullAD as “AD volume Bull”, BearAD as “AD volume Bear”

      la visualizzazione potrebbe diventare un problema a causa delle scale, disattiva magari quali linee non vedere dalla finestra principale

  42. marcov66 • 02/05/2018 #

    Ho provato in questo modo ma da errore:
    ref=(close-low)/range
    volbull=ref*volume
    volbear=volume
    ADvolbull = volbull
    ADvolbear = volume – ADvolbull
    BullAD = sum[ADvolbull*((Close-Low) – (High-Close)) / (High-Low)]
    BearAD = sum[ADvolbear*((Close-Low) – (High-Close)) / (High-Low)]
    Return BullAD as “AD volume Bull”, BearAD as “AD volume Bear”

    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif
    //media volumi rossi e verdi per media mobile semplice
    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    return volbear coloured (205,0,0) style (histogram), volbull coloured (0,190,0) style (histogram), mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”

  43. gabri • 02/05/2018 #

    che errore da?

  44. gabri • 02/05/2018 #

    ho capito….. hai aggiunto due istruzioni return. Avevo detto qualcosa di differente io

    alla fine dell’istruzione return aggiungi una virgola e poi il seguente testo:
    BullAD as “AD volume Bull”, BearAD as “AD volume Bear”

  45. gabri • 02/05/2018 #

    ref=(close-low)/range
    volbull=ref*volume
    volbear=volume
    ADvolbull = volbull
    ADvolbear = volume – ADvolbull
    BullAD = sum[ADvolbull*((Close-Low) – (High-Close)) / (High-Low)]
    BearAD = sum[ADvolbear*((Close-Low) – (High-Close)) / (High-Low)]

    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif
    //media volumi rossi e verdi per media mobile semplice
    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    return volbear coloured (205,0,0) style (histogram), volbull coloured (0,190,0) style (histogram), mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”,BullAD as “AD volume Bull”, BearAD as “AD volume Bear”

  46. marcov66 • 02/05/2018 #

    Ciao, mi da il seguente errore: “la seguente variabile non è definita: sum”

  47. gabri • 02/05/2018 #

    ref=(close-low)/range
    volbull=ref*volume
    volbear=volume
    ADvolbull = volbull
    ADvolbear = volume – ADvolbull
    BullAD = summation[ADvolbull*((Close-Low) – (High-Close)) / (High-Low)]
    BearAD = summation[ADvolbear*((Close-Low) – (High-Close)) / (High-Low)]

    if close>=open then
    greenbarcount=1
    greenvolume=volume
    redbarcount=0
    redvolume=0
    else
    greenbarcount=0
    greenvolume=0
    redbarcount=1
    redvolume=volume
    endif
    //media volumi rossi e verdi per media mobile semplice
    mmred=summation[period](redvolume)/summation[period](redbarcount)
    mmgreen=summation[period](greenvolume)/summation[period](greenbarcount)

    return volbear coloured (205,0,0) style (histogram), volbull coloured (0,190,0) style (histogram), mmred coloured (255,0,0) as “Bear average”,mmgreen as “Bull average”

  48. marcov66 • 02/05/2018 #

    non riconosce su riga 6 e 7 summation. Ho aggiunto anche su ultima riga ,BullAD as “AD volume Bull”, BearAD as “AD volume Bear”

  49. gabri • 02/05/2018 #

    Ha ragione in computer, ho sbagliato io
    BullAD = summation[period](ADvolbull*((Close-Low) – (High-Close)) / (High-Low))
    BearAD = summation[period](ADvolbear*((Close-Low) – (High-Close)) / (High-Low))

  50. marcov66 • 02/05/2018 #

    Perfetto! Funziona. Grazie di tutto!

  51. SkrHugo • 304 days ago #

    Bonjour,
    J’essaye d’utiliser le script avec le graphique renko mais sa ne marche pas, quelqu’un pourrait m’aider.
    Merci Hugo

avatar
Register or

Likes

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

+18 more likes

Related users ' posts
Iván
1 month ago
Iván I personally like it in daily timeframe
oliTR Many thanks Ivan, I copy/paste your code to try it but could only get a constant stable unif...
Iván Hi, I've copied the code above and it works... what asset are you trying? $indices array ...
Ciccarelli Franco Sembra molto interessante e volevo dei chiarimenti se possibile :Le righe commentate vanno l...
KumoNoJuzza Thank you @philippe59139 !! We finally have the VAL / VAH to play with. Could you attach th...
JS
9 months ago
luxrun
9 months ago
Nicolas Il doit y avoir impérativement plus d'unités affichées que le paramètre "BarsLimit". Ceci ét...
steffen_burat Hello Nicolas, I have a cumulative histogram update problem, the indicator often updates ...
taklause Hello Nicolas, if I try to use your indicator in a trading system, the error on prc pops up ...
Rafa Hi Nicolas! I can´t install this indicator. it installs in a separate window not as an av...
Nicolas Add it on the price, see how: https://www.prorealcode.com/blog/video-tutorials/how-to-add-an...
Frankyslo1 No consigo instalarlo en el precio en PRL-version 10
Khaled As this section of the forum is in English, I'll reply in English. I'm using PRT v11, so I d...
sal157011 Don't understand where it says: "Volume Pressure Histogram: Columns plotted in positive are ...
Khaled Not sure to understand the question. However, the columns (Histogram) represent the variable...
Alai-n Cela fonctionne très bien !!! Super Merci
andreabarbuscia Ciao Nicolas, molto bello questo indicatore, l'ho apprezzato molto. Lo sto testando insieme...
Alai-n Je poste ici un lien afin de mieux appréhender le CVD-Cumulative Volume Delta : https://www....
Nicolas
2 years ago
DELBERT Bonsoir , Nicolas , j'ai transféré votre indicateur sur ma PRT 10,3 et j'ai un méssage d'ére...
Nicolas Vous pouvez essayer en remplacant la ligne avec: vwapsd = sqrt(average[lengthz](square(clo...
DELBERT Bonsoir , merci Nicolas , a bientôt .
ChemaGeek Bonjour Nicolas, j'ai récemment découvert cet indicateur (Regularized Momentum 2017) et je l...
YvesRobert Bonjour, nouveau sur PRT (qq jours), j'essaie un peu de voir quel type d'indicateur me convi...
Ichimoku Reading I don't know in this case, I just downloaded it again and no problem for me. Try to downloa...
Ichimoku Reading What's the error that appears ?
Suzu Yuk Yes, it worked with 1Tick with 200 K . Thank you very much.
Daniele Maddaluno If you need to use it in PRT v11 take a look at this topic: https://www.prorealcode.com/top...
Monobrow Hi Daniele Thank you for the indicator, it looks very good. However, I have a problem so...
avatar
Anonymous Thanks very much for sharing, look forward to testing this idea out.
Barrabas15 Apparently, according to the attached data, there is an error in the indicator code. Attach...
Barrabas15 The files are at the end of the following link: https://www.prorealcode.com/topic/time-seg...
robertogozzi Thank you Barrabas15, the correct code is at https://www.prorealcode.com/topic/time-segmente...
Nicolas esta possible
bolsatonimora2 Hola Nicolas, perdona la molestia, pero podrias codificar el screener para rupturas de sopor...
Nicolas Utilice los foros para solicitar una codificación personalizada.
GARNIEPI hello I am looking for an anchored vwap intraday, indicator which allows you to visualize th...
withoutwings To be able to flexibly wrap around the full 24h (i.e. past midnight), or to use just a singl...
yeoreum Thank you very much for the screener, it reminds me on Minervini VCP. How to change th...
reecet any codes like this but in minutes and hours rather than days?
PHAN100 bonjour, je viens de tester ce screener, je constate une anomalie...il ne renvoie pas l'e...
jaginho Bonjour Vivien, je n'arrive pas à comprendre ce screener... En tout cas merci pour tes contr...
avatar
Anonymous Superb, merci!

Top