Help on converting : Pin Bar identify

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #149423 quote
    BITE1437
    Participant
    Average

    Below is a source code found from tradingview. May I seek your assisance on converting it to ProRealCode?

    Thanks indeed.

    //@version=4
    study(‘Pin Bar Indicator Alert’, overlay=true)
    
    bullishPinBar = 1
    bearishPinBar = -1
    
    xor (a, b) =>
    (a and not b) or (not a and b)
    
    isLongBar(bodyLength, tailLength) =>
    (tailLength > 3 * bodyLength)
    
    isBullishBar(oneThird) =>
    bullishBody = close > open
    
    float bodyLength = (open > close) ? high – close : high – open
    float tailLength = (open > close) ? close – low : open – low
    
    is_pin_bar = (open >= oneThird) and (close >= oneThird)
    
    longTail = isLongBar(bodyLength, tailLength) ? true : close < open
    
    is_pin_bar and (longTail or bullishBody)
    
    isBearishBar(oneThird) =>
    bearishBody = close < open
    
    float bodyLength = (open > close) ? high – close : high – open
    float tailLength = (open > close) ? close – low : open – low
    
    is_pin_bar = (open <= oneThird) and (close <= oneThird)
    
    longTail = isLongBar(bodyLength, tailLength) ? true : close < open
    
    is_pin_bar and (longTail or bearishBody)
    
    isPinBar() =>
    range = high – low
    oneThird = range / 3
    oneThirdBullish = high – oneThird
    oneThirdBearish = low + oneThird
    
    bullishPinBar = isBullishBar(oneThirdBullish)
    bearishPinBar = isBearishBar(oneThirdBearish)
    
    result = xor(bullishPinBar, bearishPinBar) ? 1 : 0
    
    (result and bearishPinBar) ? -1 : result
    
    isPinBarMade = isPinBar() == 1 or isPinBar() == -1 ? true : false
    
    alertcondition(isPinBarMade, title=’Pin Bar’, message=’Pin Bar has made!’)
    
    barcolor(isPinBar() == bullishPinBar ? color.green : na)
    barcolor(isPinBar() == bearishPinBar ? color.red : na)
    
    // When is bullish pin bar paint green
    plotshape(isPinBar() == bullishPinBar, style=shape.triangleup,
    location=location.abovebar, color=color.green)
    
    // When is bearish pin bar paint red
    plotshape(isPinBar() == bearishPinBar, style=shape.triangledown,
    location=location.belowbar, color=color.red)
    #149427 quote
    robertogozzi
    Moderator
    Master

    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    Thank you 🙂

    #149442 quote
    Nicolas
    Keymaster
    Master
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Help on converting : Pin Bar identify


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
BITE1437 @bite1437 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/04/2020
Status: Active
Attachments: No files
Logo Logo
Loading...