Volume Based Buy & Sell Momentum

Forums ProRealTime English forum ProBuilder support Volume Based Buy & Sell Momentum

Viewing 9 posts - 1 through 9 (of 9 total)
  • #242797
    This is a TradingView Pinescript Indicator that I would like to run on ProRealTime in a separate pane and be able to adjust the EMA length please:
    study(title=”Volume Based Buy and Sell Momentum by 2tm”, shorttitle=”VBSM”)
    EMA_Len = input(25, title=”Lenth”, minval=1)
    xROC = roc(close, 1)
    nRes1 = iff(volume < volume[1], nz(nRes1[1], 0) + xROC, nz(nRes1[1], 0))
    nRes2 = iff(volume > volume[1], nz(nRes2[1], 0) + xROC, nz(nRes2[1], 0))
    nRes3 = nRes1 + nRes2
    nResEMA3 = sma(nRes1, EMA_Len) + sma(nRes2, EMA_Len)
    PNVI = plot(nRes3, color=blue, title=”PVI + NVI”)
    PEMA = plot(nResEMA3, color=red, title=”EMA”)
    pCol = nRes3 > nResEMA3 ? blue : red
    fill (PNVI, PEMA, pCol)
    #242845

    Hi, here you have the code translated:

    #242894

    Ivan, Thank you, Thank you Thank you.

    Perfect – Very grateful

    Would it be possible to include the option to paint the EMA line completely red as it is now OR green if Rate of Change is > zero and Red if ROC is < zero and black if ROC = zero?  Not necessary on the other line, just the EMA.

    Hope that is not pushing the boundaries too much.

    Thyank you

    Bruce

    #242899

    No problem. Here you have it

    #242908

    Thank you Ivan.  Only issue now is that the colour of the EMA line changes based on the Rate of Change (ROC) of the PVI+NVI Line, not the ROC of the EMA line itself.

    Thank you

    Bruce

    #242925
    JS

    Hi,

    Do you mean like this…?

    1 user thanked author for this post.
    #242973

    Hi Ivan, Apologies for delay in getting back to you.

    I think the green (up trend) and red (down trend) of the EMA is now painting correctly on the EMA line on the chart, based on the slope of the EMA – see Pane 4 on attached chart.  However, the plot of the EMA in the latest iteration of the code doesn’t look correct.

    I’ve attached a screen shot of the PRT chart showing:
    Pane 1 – Price Candles
    Pane 2 – Version 1 of the VBSM converted from Tradingview, without alternate color plots on EMA  (weren’t asked for at the time)
    Pane 3 – Version 2 showing alternate color plots on EMA, but color coding incorrectly based on the trend/slope of the PVI+NVI line and not the EMA line
    Pane 4 – Version 3 (and latest) showing alternate color plots on EMA, correctly based on the slope of the EMA line, but with incorrect EMA plot.

    The plot of the EMA in latest version (Pane 4) is different to the previous two plots.  The plots in Panes 2 and 3 are correct as I have compared them to the plot of the original indicator in Tradingview.

    So grateful for your work to date and wondering if you could have a look at for me please and resolve?  That will be all that is required then thank you.

    Thank you

    Bruce

    #242978
    JS

    In the first two versions, the “EMA” was calculated as a “Simple Moving Average.”
    See, for example, line 28 in the first and second versions:

     nResEMA1=Average[EMALen](nRes1)

    Here, a “Simple Moving Average” was used for the calculation…

    I changed this in the third version, where the calculation was correctly done using EMA’s instead of SMA’s.

    This explains the difference compared to the first two versions…

    1 user thanked author for this post.
    #242989

    Thank you so much Ivan.

    Very grateful

    Bruce

Viewing 9 posts - 1 through 9 (of 9 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login