Rob hoffman method indicator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #226276 quote
    flipcashflipcash
    Participant
    Junior

    Hi i wanna use and test some things with the rob hoffman method, but i get an error and dont know exactly the right code.

    I want a arrow being plotted when the signal comes. but there i get an error at these lines
    if bulltrend
    drawcandle(open, high, low, close, color.green)
    else
    if beartrend
    drawcandle(open, high, low, close, color.red)

    // Define inputs
    
    
    c = 2.8 // factor used to calibrate the shape of the hammer candle used as a signal
    
    gradient = 1 // slope of moving averages
    
    // Calculate moving averages
    average1 = average[5](close)
    average2 = average[20](close)
    average3 = average[50](close)
    average4 = average[100](close)
    
    // Define trend conditions
    bulltrend1 = average1 - average1[2] > gradient and average1 < close
    bulltrend2 = average1 - average2[2] > gradient and average2 < close
    bulltrend3 = average3 - average3[2] > gradient and average3 < close
    bulltrend4 = average4 - average4[2] > gradient and average4 < close
    bulltrend = bulltrend1 and bulltrend2 and bulltrend3 and bulltrend4
    
    beartrend1 = average1 - average1[2] < -gradient and close < average1
    beartrend2 = average1 - average2[2] < -gradient and close < average2
    beartrend3 = average3 - average3[2] < -gradient and close < average3
    beartrend4 = average4 - average4[2] < -gradient and close < average4
    beartrend = beartrend1 and beartrend2 and beartrend3 and beartrend4
    
    // Plot candles based on trend
    if bulltrend
        drawcandle(open, high, low, close, color.green)
    else
        if beartrend
            drawcandle(open, high, low, close, color.red)
    
    // Plot hammer candles
    hammerup = abs(open - close) < (high - low) / 2 and close > high - (high - low) / c and open > high - (high - low) / c
    hammerdown = abs(open - close) < (high - low) / 2 and close < low + (high - low) / c and open < low + (high - low) / c
    
    plotshape(series=hammerup, title="Hammer Up", color=color.green, style=shape.triangleup, location=location.belowbar)
    plotshape(series=hammerdown, title="Hammer Down", color=color.red, style=shape.triangledown, location=location.abovebar)
    
    #226280 quote
    prorpror
    Participant
    Veteran
    // Plot candles based on trend
    if bulltrend then
    drawcandle(open, high, low, close)COLOURED("green") 
    elsif beartrend then
    drawcandle(open, high, low, close)COLOURED("red")
    ENDIF
    #226281 quote
    prorpror
    Participant
    Veteran
    // Define inputs
    c = 2.8 // factor used to calibrate the shape of the hammer candle used as a signal
    
    gradient = 1 // slope of moving averages
    
    // Calculate moving averages
    average1 = average[5](close)
    average2 = average[20](close)
    average3 = average[50](close)
    average4 = average[100](close)
    
    // Define trend conditions
    bulltrend1 = average1 - average1[2] > gradient and average1 < close
    bulltrend2 = average1 - average2[2] > gradient and average2 < close
    bulltrend3 = average3 - average3[2] > gradient and average3 < close
    bulltrend4 = average4 - average4[2] > gradient and average4 < close
    bulltrend = bulltrend1 and bulltrend2 and bulltrend3 and bulltrend4
    
    beartrend1 = average1 - average1[2] < -gradient and close < average1
    beartrend2 = average1 - average2[2] < -gradient and close < average2
    beartrend3 = average3 - average3[2] < -gradient and close < average3
    beartrend4 = average4 - average4[2] < -gradient and close < average4
    beartrend = beartrend1 and beartrend2 and beartrend3 and beartrend4
    
    // Plot candles based on trend
    if bulltrend then
    drawcandle(open, high, low, close)COLOURED("green")
    elsif beartrend then
    drawcandle(open, high, low, close)COLOURED("red")
    ENDIF
    // Plot hammer candles
    hammerup = abs(open - close) < (high - low) / 2 and close > high - (high - low) / c and open > high - (high - low) / c
    hammerdown = abs(open - close) < (high - low) / 2 and close < low + (high - low) / c and open < low + (high - low) / c
    
    return
    //plotshape(series=hammerup, title="Hammer Up", color=color.green, style=shape.triangleup, location=location.belowbar)
    //plotshape(series=hammerdown, title="Hammer Down", color=color.red, style=shape.triangledown, location=location.abovebar)
    
    #226282 quote
    prorpror
    Participant
    Veteran
    // Define inputs
    //c = 2.8 // factor used to calibrate the shape of the hammer candle used as a signal
    
    //gradient = 1 // slope of moving averages
    
    // Calculate moving averages
    average1 = average[5](close)
    average2 = average[20](close)
    average3 = average[50](close)
    average4 = average[100](close)
    
    // Define trend conditions
    bulltrend1 = average1 - average1[2] > gradient and average1 < close
    bulltrend2 = average1 - average2[2] > gradient and average2 < close
    bulltrend3 = average3 - average3[2] > gradient and average3 < close
    bulltrend4 = average4 - average4[2] > gradient and average4 < close
    bulltrend = bulltrend1 and bulltrend2 and bulltrend3 and bulltrend4
    
    beartrend1 = average1 - average1[2] < -gradient and close < average1
    beartrend2 = average1 - average2[2] < -gradient and close < average2
    beartrend3 = average3 - average3[2] < -gradient and close < average3
    beartrend4 = average4 - average4[2] < -gradient and close < average4
    beartrend = beartrend1 and beartrend2 and beartrend3 and beartrend4
    
    // Plot candles based on trend
    if bulltrend then
    drawcandle(open, high, low, close)COLOURED("green")
    elsif beartrend then
    drawcandle(open, high, low, close)COLOURED("red")
    ENDIF
    // Plot hammer candles
    hammerup = abs(open - close) < (high - low) / 2 and close > high - (high - low) / c and open > high - (high - low) / c
    hammerdown = abs(open - close) < (high - low) / 2 and close < low + (high - low) / c and open < low + (high - low) / c
    
    if hammerup then
    DRAWARROWUP(barindex, low)
    endif
    if hammerdown then
    DRAWARROWdown(barindex, high)
    endif
    
    return
    //plotshape(series=hammerup, title="Hammer Up", color=color.green, style=shape.triangleup, location=location.belowbar)
    //plotshape(series=hammerdown, title="Hammer Down", color=color.red, style=shape.triangledown, location=location.abovebar)
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Rob hoffman method indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
flipcash @flipcash Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by prorpror
2 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/12/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...