Pine script conversion using ChatGPT 4

Viewing 15 posts - 16 through 30 (of 42 total)
  • Author
    Posts
  • #221191 quote
    LucasBest
    Participant
    Average

    So the code you wrote above is correct or not ?
    ma = undefined
    if srcValue1[lenValue1] >0 then
    ma = sumf/len
    endif

    If UNDEFINED can only be assign once, can we write “ma = undefined” ?
    Or we should write “once ma = undefined” ?

    #221198 quote
    jacquesgermain
    Participant
    Senior

    Hello

    in

    //banker increase position with green candle
    IF fundtrend > bullbearline THEN
    DRAWCANDLE(fundtrend, bullbearline, fundtrend, bullbearline) COLOURED(0,255,0) // Green color
    ENDIF

    add

    IF fundtrend > bullbearline and not bankerentry THEN
    DRAWCANDLE(fundtrend, bullbearline, fundtrend, bullbearline) COLOURED(0,255,0) // Green color
    ENDIF

    then the yellow candle will appair …

    #221201 quote
    Meta Signals Pro
    Participant
    Veteran

    Hi @lucasbest

    « Whatever the prompt i use at the begining Chatgpt does a lot of errors, syntax errors and confusion between the different languages »

    If you believe in the power of a leveraging by working with others, can I propose you share the prompt you used?
    So that we can build a step by step translation process that could maybe have better final results?

    #221204 quote
    LucasBest
    Participant
    Average

    I used th prompt of Nicolas first times, and then i tried to feed chatgpt with list of all instructions of probuilder. Now i don”t use any long prompt but just say “can you translate this pine script code to probuilder language ?”.

    Sometimes chatgpt remember what i said and what it did before and do a good job with colors (splitting them in 3 variables) and with function…
    But what i don’t understand is that sometimes chatgpt go completly wrong, using new instructions, like “function(…)” or “x = IF… THEN… EDNDIF” or even “color = RGB(colorR,colorG,colorB)” in the same discussion like if it forget everything (CHATGPT have alzheimer?) we did or said before…

    It is like if probuilder language is not yet anchored in his DNA, it tries to learn but if a prompt makes it doubt about what it learned previously, then it delete all and become dumb! It is very frustrating… as i accept to loose more time helping him because i thought it will become more and more accurate in translating codes from pine script to probuilder, but i can tell after more than 15-20 indicators conversion that it isn’t the case.

    Maybe best way is to use it partilly for the things it does the best and convert the rest alone?

    Meta Signals Pro thanked this post
    #221251 quote
    LucasBest
    Participant
    Average

    An other Pine script indicator convrsion.
    Original script here below :
    https://www.tradingview.com/script/y80r44fM-Advanced-GET-Tom-Joseph-s-XTL-DMA-Cloud-Breakout-Signals/

    // Advanced GET XTL + DMA Cloud
    colR1 = 0
    colG1 = 135
    colB1 = 225
    
    colR2 = 255
    colG2 = 0
    colB2 = 0
    
    colR3 = 255
    colG3 = 255
    colB3 = 30
    
    colR4 = 50
    colG4 = 125
    colB4 = 255
    
    colR5 = 250
    colG5 = 0
    colB5 = 0
    
    colR6 = 255
    colG6 = 255
    colB6 = 255
    
    colREntryBull = 0
    colGEntryBull = 0
    colBEntryBull = 255
    
    colREntryBear = 255
    colGEntryBear = 0
    colBEntryBear = 0
    
    colRStopBull = 255
    colGStopBull = 0
    colBStopBull = 0
    
    colRStopBear = 0
    colGStopBear = 0
    colBStopBear = 255
    
    // Expert Trend Locator (XTL)
    len = 34 // XTL Period
    hLmt = 34 // Threshold Value
    
    xtlsrc = (high + low + close) / 3
    XTL = CCI[len](xtlsrc)
    
    bull = XTL > hLmt
    bear = XTL < -hLmt
    neutral = (XTL <= hLmt) AND (XTL >= -hLmt)
    
    // Colors for bars
    if bull THEN
    R = colR1
    G = colG1
    B = colB1
    ELSIF neutral THEN
    R = colR3
    G = colG3
    B = colB3
    ELSE
    R = colR2
    G = colG2
    B = colB2
    ENDIF
      
    DRAWCANDLE(open,high,low,close) COLOURED(R,G,B) BORDERCOLOR(R,G,B)
    
    //Displaced Moving Average (DMA)
    showdma = 1 // 1 for Yes, 0 for No: Show DMA?
    malength = 8 // DMA Length
    displacement = 5 // DMA Displacement
    
    DMA1 = Average[malength](low)
    DMA2 = Average[malength](high)
    
    // Colors for DMA
    if DMA1 > DMA1[1] THEN
    RR2 = colR4
    G2 = colG4
    B2 = colB4
    ELSIF DMA1 <= DMA1[1] THEN
    RR2 = colR5
    G2 = colG5
    B2 = colB5
    ELSE
    RR2 = colR6
    G2 = colG6
    B2 = colB6
    ENDIF
    
    IF showdma THEN
    Drawsegment(barindex-1,DMA1[1],barindex,DMA1) coloured(RR2,G2,B2,100)
    Drawsegment(barindex-1,DMA2[1],barindex,DMA2) coloured(RR2,G2,B2,100)
    Colorbetween(DMA1,DMA2,RR2,G2,B2,20)
    endif
    
    // Breakout Bar Entry & Stop
    showbbar = 1  // 1 for Yes, 0 for No: Show Breakout Bar Signals
    cont = 0  // 1 for Yes, 0 for No: Levels as Lines
    
    // State Determination
    IF bear THEN
    state = 0
    ELSIF bull THEN
    state = 1
    ELSE
    state = state[1]
    ENDIF
    prevstate = state[1]
    
    // Settings for Breakout Bar
    bbarstop = 0.5  // Stop Loss Ratio
    bbaentry = 1.5  // Entry Ratio
    
    // Target Settings
    tar1 = 1  // 1 for Yes, 0 for No: Show Target 1
    tar2 = 0  // 1 for Yes, 0 for No: Show Target 2
    bbartgt1 = 3  // Target Ratio 1
    bbartgt2 = 4  // Target Ratio 2
    
    myrange = high - low
    
    // Continuous stop, entry, and target levels
    IF state > prevstate THEN
    cstop = low - myrange * bbarstop
    ELSIF state < prevstate THEN
    cstop = high + myrange * bbarstop
    ELSE
    cstop = cstop[1]
    ENDIF
    
    IF state > prevstate THEN
    centry = low + myrange * bbaentry
    ELSIF state < prevstate THEN
    centry = high - myrange * bbaentry
    ELSE
    centry = centry[1]
    ENDIF
    
    IF state > prevstate THEN
    ctgt1 = low + myrange * bbartgt1
    ELSIF state < prevstate THEN
    ctgt1 = high - myrange * bbartgt1
    ELSE
    ctgt1 = ctgt1[1]
    ENDIF
    
    IF state > prevstate THEN
    ctgt2 = low + myrange * bbartgt2
    ELSIF state < prevstate THEN
    ctgt2 = high - myrange * bbartgt2
    ELSE
    ctgt2 = ctgt2[1]
    ENDIF
    
    // Non-continuous stop, entry, and target levels
    IF state > prevstate THEN
    ncstop = low - myrange * bbarstop
    ELSIF state < prevstate THEN
    ncstop = high + myrange * bbarstop
    ELSE
    ncstop = UNDEFINED
    ENDIF
    
    IF state > prevstate THEN
    ncentry = low + myrange * bbaentry
    ELSIF state < prevstate THEN
    ncentry = high - myrange * bbaentry
    ELSE
    ncentry = UNDEFINED
    ENDIF
    
    IF state > prevstate THEN
    nctgt1 = low + myrange * bbartgt1
    ELSIF state < prevstate THEN
    nctgt1 = high - myrange * bbartgt1
    ELSE
    nctgt1 = UNDEFINED
    ENDIF
    
    IF state > prevstate THEN
    nctgt2 = low + myrange * bbartgt2
    ELSIF state < prevstate THEN
    nctgt2 = high - myrange * bbartgt2
    ELSE
    nctgt2 = UNDEFINED
    ENDIF
    
    IF cont THEN
    pstop = cstop
    pentry = centry
    ptgt1 = ctgt1
    ptgt2 = ctgt2
    displ = -1
    ELSE
    pstop = ncstop
    pentry = ncentry
    ptgt1 = nctgt1
    ptgt2 = nctgt2
    displ = 0
    ENDIF
    
    // Define the colbar variable
    IF bull THEN
    colbar = 1
    ELSIF bear THEN
    colbar = 0
    ELSE
    colbar = colbar[1]
    ENDIF
    
    // Define colors for entry and stop
    IF colbar = 1 THEN
    REntry = colREntryBull
    GEntry = colGEntryBull
    BEntry = colBEntryBull
    RStop = colRStopBull
    GStop = colGStopBull
    BStop = colBStopBull
    ELSE
    REntry = colREntryBear
    GEntry = colGEntryBear
    BEntry = colBEntryBear
    RStop = colRStopBear
    GStop = colGStopBear
    BStop = colBStopBear
    ENDIF
    
    // Plot Stop
    IF showbbar then //AND pstop=pstop[1] THEN
    Drawsegment(barindex, pstop, barindex+5, pstop) style(dottedline,2) coloured(RStop, GStop, BStop,255)
    ENDIF
    
    // Plot Entry
    IF showbbar then //AND pentry=pentry[1] THEN
    Drawsegment(barindex, pentry, barindex+5, pentry) style(line,5) coloured(REntry, GEntry, BEntry, 255)
    ENDIF
    
    // Assuming you also want to plot Targets, here's an example for Target 1 (based on ptgt1 variable)
    Drawsegment(barindex, ptgt1, barindex+5, ptgt1) style(dottedline1,5) coloured("gold",255)
    Drawsegment(barindex, ptgt2, barindex+5, ptgt2) style(dottedline1,5) coloured("gold",255)
    
    Return
    Meta Signals Pro and GraHal thanked this post
    #221255 quote
    Nicolas
    Keymaster
    Master

    If UNDEFINED can only be assign once, can we write “ma = undefined” ? Or we should write “once ma = undefined” ?

    Whatever, it will have the same effect.

    LaMaille thanked this post
    #221257 quote
    Nicolas
    Keymaster
    Master

    What you need to understand with ChatGPT is that generative AI will do everything to satisfy you, even if it means inventing new instructions, as you’ve seen. Since it doesn’t have all the necessary notions to completely translate code from one language to another (here for ProBuilder), it will do its best to help you, even if it means generating code that isn’t compatible. That’s its purpose, that’s why it was created.
    When ChatGPT tells you that you should talk to someone more accustomed to doing translations, rather than him, it’s again not to disappoint you, it’s a bit like his “soul” talking to you. I also think he detects your insistence and annoyance in the prompt you used at the time 🙂

    *** Thanks again for sharing the indicators you’ve translated, it’s a lot of effort to help the community and I really appreciate it! ***

    #221258 quote
    Meta Signals Pro
    Participant
    Veteran

    Hi @LucasBest,

    you see this answer right?

    Create strategies codes with ChatGPT for ProRealTime

    Are you using GPT4?

    LaMaille thanked this post
    #221266 quote
    supertiti
    Participant
    Master

    a Lucasbest

    Would it be possible to create the “L3 Banker fund flow osci” indicator in the form of a curve (moving average type) that would be applied directly to the price graph.
    Thanks for sharing.

    #221275 quote
    LaMaille
    Participant
    Junior

    I also think he detects your insistence and annoyance in the prompt you used at the time 🙂

    *** Thanks again for sharing the indicators you’ve translated, it’s a lot of effort to help the community and I really appreciate it! ***

    It’s true, I admit I’ve been a little hard on him sometimes and even called him a dumb once or twice… 😳

    No problem for helping the community. I learned a lot here too, and still learning every day.

    #221276 quote
    LaMaille
    Participant
    Junior

    Hi @LucasBest,

    you see this answer right?

    https://www.prorealcode.com/topic/create-strategies-codes-with-chatgpt-for-prorealtime/page/4/#post-217866

    Are you using GPT4?

    Just saw it. I have same issue after few hours of using it…
    It is v4 yes.

    #221277 quote
    LaMaille
    Participant
    Junior

    a Lucasbest

    Would it be possible to create the “L3 Banker fund flow osci” indicator in the form of a curve (moving average type) that would be applied directly to the price graph.

    Thanks for sharing.

    From same author, there is this swing indicator on price :
    https://www.tradingview.com/script/ZkAray4F/

    Is that what you want ?

    #221278 quote
    supertiti
    Participant
    Master

    a La Maille

    This Banker swing code is interesting, showing the yellow candles.
    But a curve would be the best.
    thank for your post

    Can anyone translate the swing?

    #221361 quote
    LucasBest
    Participant
    Average

    For those who have tradingview and can try those 2 indicators below, which one is the best/more accurate ?
    https://fr.tradingview.com/script/CapG3ivf-Bjorgum-Key-Levels/
    https://fr.tradingview.com/script/iOrhpIqc-Support-and-Resistance-Signals-MTF-LuxAlgo/

    Both do almost the same work, both are long and hard to convert… Can you vote and tell me which one worth to be translated more than th other ?

    #221382 quote
    supertiti
    Participant
    Master

    to Lucas,

    I’m sorry, but the last two indicators you suggested don’t appeal to me.
    The one that catches my eye, on the other hand, is the Banker Fund Swing. Translated into a curve, it would be the best, and in colours identical to the candlesticks, it would be impossible.
    But the impossible is impossible.
    Nicolas might be able to help you with that.
    Thanks for your help.
    Have a nice day.

Viewing 15 posts - 16 through 30 (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...