Pine script conversion using ChatGPT 4

Viewing 12 posts - 31 through 42 (of 42 total)
  • Author
    Posts
  • #221384 quote
    GraHal
    Participant
    Master

    I am also in favour of conversion of Banker Fund Swing … may even be easier than the 2  Support and Resistance indicators mentioned above?

    LucasBest you are doing a fantastic job sharing your hard work with us … Big Thank You from Us All!

    #221414 quote
    LucasBest
    Participant
    Average

    I am also in favour of conversion of Banker Fund Swing … may even be easier than the 2 Support and Resistance indicators mentioned above?

    LucasBest you are doing a fantastic job sharing your hard work with us … Big Thank You from Us All!

    It is for sure easier and shorter than the 2 others… But it is also less accurate for trading 🙁

    Whatever, i translated it :

    // © blackcat1402
    //@version=4
    
    ma5 = average[5](close)
    ma10 = average[10](close)
    ma30 = average[30](close)
    ma40 = average[40](close)
    ma60 = average[60](close)
    ma120 = average[120](close)
    angel = exponentialaverage[2](close)
    
    len = 21
    lrc = LinearRegression[len](close)
    lrprev = LinearRegression[len](close[1])
    xslValue = (lrc - lrprev)
    devil = exponentialaverage[42]((xslValue * 20) + close)
    
    long = angel CROSSES OVER devil
    short = angel CROSSES UNDER devil
    
    IF short THEN
    DRAWTEXT("SELL", barindex, high + 10, SansSerif, Bold, 12) COLOURED(255, 0, 0) // Using red color for "SELL"
    ENDIF
    
    IF long THEN
    DRAWTEXT("BUY", barindex, low - 10, SansSerif, Bold, 12) COLOURED(0, 255, 0) // Using green color for "BUY"
    ENDIF
    
    IF angel >= devil THEN
    DRAWCANDLE(open, high, low, close) COLOURED(0,255,0) BORDERCOLOR(0,255,0) // Green candle
    ELSE
    DRAWCANDLE(open, high, low, close) COLOURED(255,0,0) BORDERCOLOR(255,0,0) // Red candle
    ENDIF
    
    IF long THEN
    DRAWCANDLE(open, high, low, close) COLOURED(255,255,0) BORDERCOLOR(255,255,0) // Yellow candle when 'long' condition (crossover) is true
    ENDIF
    
    rma10 = average[10](close)
    rma20 = average[20](close)
    rma40 = average[40](close)
    rma60 = average[60](close)
    rma120 = average[120](close)
    rangel = exponentialaverage[2](close)
    
    len = 21
    lrc = LinearRegression[len](close)
    lrprev = LinearRegression[len](close[1])
    xslValue = (lrc - lrprev)
    rdevil = exponentialaverage[42]((xslValue * 20) + close)
    
    n = 7 // short term period
    m = 5 // middle term period
    
    lbuy = angel CROSSES OVER devil
    
    var1 = (close - lowest[60](low)) / (highest[60](high) - lowest[60](low)) * 100
    
    //b = xsa(var1,n,1)
    once ma = undefined
    once b = undefined
    
    sum = sum[1] - var1[n] + var1
    
    IF var1[n] > 0 THEN
    ma = sum / n
    ENDIF
    
    If b[1] = undefined then
    b = ma
    else
    b = (var1 + b[1] * (n - 1)) / n
    Endif
    
    //var2 = xsa(b,m,1)
    once ma2 = undefined
    once var2 = undefined
    
    sum2 = sum2[1] - b[m] + b
    
    IF b[m] > 0 THEN
    ma2 = sum2 / m
    ENDIF
    
    IF var2[1] = undefined THEN
    var2 = ma2
    ELSE
    var2 = (b + var2[1] * (m - 1)) / m
    ENDIF
    
    mar1 = (2*close + high + low + open) / 5
    mar2 = LOWEST[34](low)
    mar3 = HIGHEST[34](high)
    
    sk = EXPONENTIALAVERAGE[13]((mar1 - mar2) / (mar3 - mar2) * 100)
    
    IF b[1] <> 0 THEN
    prevB = b[1]
    ELSE
    prevB = b
    ENDIF
    
    IF sk[1] <> 0 THEN
    prevSk = sk[1]
    ELSE
    prevSk = sk
    ENDIF
    
    ldb = (b <= 10) AND (sk <= 10) AND (b > prevB) AND (sk > prevSk)
    
    swingBuy = lbuy AND ldb
    
    IF lbuy THEN
    DRAWCANDLE(open, high, low, close) COLOURED(255, 255, 0) BORDERCOLOR(255, 255, 0) // 255, 255, 0 is the RGB code for yellow
    ENDIF
    
    RETURN ma5 STYLE(LINE, 2) COLOURED(255, 255, 0) AS "MA5", ma10 STYLE(LINE, 2)COLOURED(255, 0, 255) AS "MA10", ma30 STYLE(LINE, 2) COLOURED(0, 255, 255) AS "MA30"
    

    I hope it will be usefull for your trading…

    GraHal thanked this post
    Capture-decran-2023-09-21-225534.png Capture-decran-2023-09-21-225534.png
    #221416 quote
    LucasBest
    Participant
    Average

    For me these kind of indicators are far more usefull… but just my opinion

    Capture-decran-2023-09-21-230702.png Capture-decran-2023-09-21-230702.png Capture-decran-2023-09-21-230431.png Capture-decran-2023-09-21-230431.png
    #221423 quote
    Nicolas
    Keymaster
    Master

    Don't be sectarian, some will see an interest in it! Everyone is different 🙂

    #221425 quote
    LucasBest
    Participant
    Average

    Don’t be sectarian, some will see an interest in it! Everyone is different 🙂

    Certainly. i just gave my opinion… Late signal with no range filter might kill thee capital slowly but surely, in my point of view.
    I try not to be sectarian though, that is why i translated it even if i will never use it myself. 😉

    pror and GraHal thanked this post
    #221450 quote
    supertiti
    Participant
    Master

    ¡ Thank you so much Lucas, you are … the best !

    Here is the ALD stock

    L3-Banker-Swing.jpg L3-Banker-Swing.jpg
    #221456 quote
    LaMaille
    Participant
    Junior

    An other oscillator converted from Pine Script to Probuilder with Chat GPT v4 which does not improve from the begining….

    https://www.tradingview.com/script/Ap9HknuH-Bulls-v-Bears/

    // Bulls v Bears
    
    // Input settings
    len = 14 // BvB Period: 1-200
    barsBack = 120 // Normalized bars back: 1-200
    tline = 80 // Line Height: 1-200
    tlineinv = -tline
    
    // Calculation
    ma = Average[len](close)
    bulls = high - ma
    bears = ma - low
    
    // Normalize the values between -100 and 100
    minBulls = Lowest[barsBack](bulls)
    maxBulls = Highest[barsBack](bulls)
    normBulls = ((bulls - minBulls) / (maxBulls - minBulls) - 0.5) * 200
    
    minBears = Lowest[barsBack](bears)
    maxBears = Highest[barsBack](bears)
    normBears = ((bears - minBears) / (maxBears - minBears) - 0.5) * 200
    
    // Calculate the total and add signals
    total = normBulls - normBears
    bullishO = total > tline
    bearishO = total < tlineinv
    
    IF total >= 0 THEN
    r = 0
    g = 255
    b = 0 // Green
    ELSE
    r = 255
    g = 0
    b = 0 // Red
    ENDIF
    
    
    
    // Bullish Crossover circle
    IF bullishO THEN
    Drawpoint(barindex,tline,3) coloured(255,0,212,255)
    ENDIF
    
    // Bearish Crossover circle
    IF bearishO THEN
    Drawpoint(barindex,tlineinv,3) coloured(238,255,0,255)
    ENDIF
    
    RETURN total STYLE(HISTOGRAM) COLOURED(r,g,b), tline style(dottedline2,2) coloured("grey",200), tlineinv style(dottedline2,2) coloured("grey",200)
    
    #221457 quote
    supertiti
    Participant
    Master

    // BANKER SWING YELLOW SCREENER 22.09.2023

     

    // L3 BANKER FUND SWING by Lucasbest 22.09.2023

    // © blackcat1402 //@version=4

     

     

    angel = exponentialaverage[2](close)

     

    len = 21

    lrc = LinearRegression[len](close)

    lrprev = LinearRegression[len](close[1])

    xslValue = (lrc – lrprev)

    devil = exponentialaverage[42]((xslValue * 20) + close)

     

    long = angel CROSSES OVER devil

    //short = angel CROSSES UNDER devil

     

    len = 21

    lrc = LinearRegression[len](close)

    lrprev = LinearRegression[len](close[1])

    xslValue = (lrc – lrprev)

     

    n = 7 // short term period

    m = 5 // middle term period

     

    //lbuy = angel CROSSES OVER devil

     

    var1 = (close – lowest[60](low)) / (highest[60](high) – lowest[60](low)) * 100

     

    once ma = undefined

    once b = undefined

     

    sum = sum[1] – var1[n] + var1

     

    IF var1[n] > 0 THEN

    ma = sum / n

    ENDIF

     

    If b[1] = undefined then

    b = ma

    else

    b = (var1 + b[1] * (n – 1)) / n

    Endif

     

    //var2 = xsa(b,m,1)

    once ma2 = undefined

    once var2 = undefined

     

    sum2 = sum2[1] – b[m] + b

     

    IF b[m] > 0 THEN

    ma2 = sum2 / m

    ENDIF

     

    IF var2[1] = undefined THEN

    var2 = ma2

    ELSE

    var2 = (b + var2[1] * (m – 1)) / m

    ENDIF

     

    mar1 = (2*close + high + low + open) / 5

    mar2 = LOWEST[34](low)

    mar3 = HIGHEST[34](high)

     

    sk = EXPONENTIALAVERAGE[13]((mar1 – mar2) / (mar3 – mar2) * 100)

     

    IF b[1] <> 0 THEN

    //prevB = b[1]

    ELSE

    //prevB = b

    ENDIF

     

    IF sk[1] <> 0 THEN

    //prevSk = sk[1]

    ELSE

    //prevSk = sk

    ENDIF

     

    c1 = long

     

    SCREENER [c1]

    Yellow.jpg Yellow.jpg
    #221459 quote
    supertiti
    Participant
    Master

    / BANKER SWING YELLOW ONLY  22.09.2023

    // L3 BANKER FUND SWING bu Lucasbest 22.09.2023

    // © blackcat1402 //@version=4

    angel = exponentialaverage[2](close)

    len = 21

    lrc = LinearRegression[len](close)

    lrprev = LinearRegression[len](close[1])

    xslValue = (lrc – lrprev)

    devil = exponentialaverage[42]((xslValue * 20) + close)

    long = angel CROSSES OVER devil

    short = angel CROSSES UNDER devil

    IF long THEN

    DRAWTEXT(“B”, barindex, low – 5, SansSerif, Bold, 25) COLOURED(255, 255, 0) // Using yellow color for “BUY”

    ENDIF

    IF long THEN

    DRAWCANDLE(open, high, low, close) COLOURED(255,255,0) BORDERCOLOR(255,255,0) // Yellow candle when ‘long’ condition (crossover) is true

    ENDIF

    len = 21

    lrc = LinearRegression[len](close)

    lrprev = LinearRegression[len](close[1])

    xslValue = (lrc – lrprev)

    rdevil = exponentialaverage[42]((xslValue * 20) + close)

    n = 7 // short term period

    m = 5 // middle term period

    lbuy = angel CROSSES OVER devil

    var1 = (close – lowest[60](low)) / (highest[60](high) – lowest[60](low)) * 100

    once ma = undefined

    once b = undefined

    sum = sum[1] – var1[n] + var1

    IF var1[n] > 0 THEN

    ma = sum / n

    ENDIF

    If b[1] = undefined then

    b = ma

    else

    b = (var1 + b[1] * (n – 1)) / n

    Endif

    //var2 = xsa(b,m,1)

    once ma2 = undefined

    once var2 = undefined

    sum2 = sum2[1] – b[m] + b

    IF b[m] > 0 THEN

    ma2 = sum2 / m

    ENDIF

    IF var2[1] = undefined THEN

    var2 = ma2

    ELSE

    var2 = (b + var2[1] * (m – 1)) / m

    ENDIF

    mar1 = (2*close + high + low + open) / 5

    mar2 = LOWEST[34](low)

    mar3 = HIGHEST[34](high)

    sk = EXPONENTIALAVERAGE[13]((mar1 – mar2) / (mar3 – mar2) * 100)

    IF b[1] <> 0 THEN

    prevB = b[1]

    ELSE

    prevB = b

    ENDIF

    IF sk[1] <> 0 THEN

    prevSk = sk[1]

    ELSE

    prevSk = sk

    ENDIF

    ldb = (b <= 10) AND (sk <= 10) AND (b > prevB) AND (sk > prevSk)

    swingBuy = lbuy AND ldb

    IF lbuy THEN

    DRAWCANDLE(open, high, low, close) COLOURED(255, 255, 0) BORDERCOLOR(255, 255, 0) // 255, 255, 0 is the RGB code for yellow

    ENDIF

     

    RETURN

     

    ESSO stock

    ESSO-YELLOW.jpg ESSO-YELLOW.jpg
    #221461 quote
    Meta Signals Pro
    Participant
    Veteran

    For me these kind of indicators are far more usefull… but just my opinion

    nice can you give us the links if they are on PRC?

    #221462 quote
    LucasBest
    Participant
    Average

    For me these kind of indicators are far more usefull… but just my opinion

    nice can you give us the links if they are on PRC?

    They are not in PRC. Maybe i’ll put them in the Marketplace, when they will be finish (still have lot of work on them)

    #222678 quote
    LucasBest
    Participant
    Average

    This is the conversion of this indicator : Bull Bear Power Trend by Dreadblitz
    https://in.tradingview.com/script/wjlDy5tV-Bull-Bear-Power-Trend/

    // by Dreadblitz
    
    once niv2 = 2
    once niv0 = 0
    once niv22 = -2
    
    // Computations
    BullTrend = (close - lowest[50](low)) / AverageTrueRange[5](close)
    BearTrend = (highest[50](high) - close) / AverageTrueRange[5](close)
    BearTrend2 = -1 * BearTrend
    
    BearTrendHist = (BullTrend<2)*(bulltrend-2)
    BullTrendHist = (Beartrend2>-2)*(Beartrend2+2)
    
    Trend = BullTrend - Beartrend
    
    if bulltrend>2 then
    bullR = 0
    BullG = 128
    BullB = 0
    else
    bullR = 128
    BullG = 128
    BullB = 128
    endif
    colorbetween(BullTrend,niv2,BullR,BullG,BullB,50)
    
    if beartrend2<-2 then
    bearR = 255
    bearG = 0
    bearB = 0
    else
    bearR = 128
    bearG = 128
    bearB = 128
    endif
    colorbetween(beartrend2,niv22,bearR,bearG,bearB,50)
    
    If regTrendOn = 0 then
    drawsegment(barindex-1,Trend[1],barindex,Trend) style(line,2) coloured("black",255)
    else
    //alexgrover-Regression Line Formula
    x = barindex
    y = Trend
    xx = Average[length](x)
    yy = Average[length](y)
    mx = std[length](x)
    my = std[length](y)
     
    lenMinusOne = length - 1
    meanx = 0.0
    meany = 0.0
    for i=0 to lenMinusOne
    meanx = meanx + (x[i])
    meany = meany + (y[i])
    next
    meanx = meanx / length
    meany = meany / length
    sumxy=0.0
    sumx=0.0
    sumy=0.0
    for i=0  to lenMinusOne
    sumxy = sumxy +    ((x[i]) - meanx) * ((y[i]) - meany)
    sumx  = sumx  + pow((x[i]) - meanx, 2)
    sumy  = sumy  + pow((y[i]) - meany, 2)
    next
    c = sumxy / sqrt(sumy * sumx)
    
    slope = c * (my / mx)
    inter = yy - slope * xx
    regtrend = x * slope + inter
    
    drawsegment(barindex-1,regtrend[1],barindex,regtrend) style(line,2) coloured("black",255)
    Endif
    
    Return niv0 style(line,1) coloured("black",255), niv2 style(line,1) coloured("green",255), niv22 style(line,1) coloured("red",255), BullTrend style(line,1) coloured("green",255), BearTrend2 style(line,1) coloured("red",255), BullTrendHist style(histogram) coloured("green",255), BearTrendHist style(histogram) coloured("red",255)
    GraHal, Meta Signals Pro, pror and 4 others thanked this post
    Capture-decran-2023-10-20-085608.jpg Capture-decran-2023-10-20-085608.jpg Bull-Bear-Power-Trend.itf
Viewing 12 posts - 31 through 42 (of 42 total)
  • You must be logged in to reply to this topic.

Pine script conversion using ChatGPT 4


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
LucasBest @lucasbest Participant
Summary

This topic contains 41 replies,
has 7 voices, and was last updated by LucasBest
2 years, 3 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 09/11/2023
Status: Active
Attachments: 11 files
Logo Logo
Loading...