Pine script conversion using ChatGPT 4
Forums › ProRealTime English forum › General trading discussions › Pine script conversion using ChatGPT 4
- This topic has 41 replies, 7 voices, and was last updated 1 year ago by LucasBest.
-
-
09/21/2023 at 12:22 PM #221384
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!
09/21/2023 at 10:01 PM #221414I 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 :
L3 Banker Fund Swing123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117// © blackcat1402//@version=4ma5 = 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 = 21lrc = LinearRegression[len](close)lrprev = LinearRegression[len](close[1])xslValue = (lrc - lrprev)devil = exponentialaverage[42]((xslValue * 20) + close)long = angel CROSSES OVER devilshort = angel CROSSES UNDER devilIF short THENDRAWTEXT("SELL", barindex, high + 10, SansSerif, Bold, 12) COLOURED(255, 0, 0) // Using red color for "SELL"ENDIFIF long THENDRAWTEXT("BUY", barindex, low - 10, SansSerif, Bold, 12) COLOURED(0, 255, 0) // Using green color for "BUY"ENDIFIF angel >= devil THENDRAWCANDLE(open, high, low, close) COLOURED(0,255,0) BORDERCOLOR(0,255,0) // Green candleELSEDRAWCANDLE(open, high, low, close) COLOURED(255,0,0) BORDERCOLOR(255,0,0) // Red candleENDIFIF long THENDRAWCANDLE(open, high, low, close) COLOURED(255,255,0) BORDERCOLOR(255,255,0) // Yellow candle when 'long' condition (crossover) is trueENDIFrma10 = average[10](close)rma20 = average[20](close)rma40 = average[40](close)rma60 = average[60](close)rma120 = average[120](close)rangel = exponentialaverage[2](close)len = 21lrc = LinearRegression[len](close)lrprev = LinearRegression[len](close[1])xslValue = (lrc - lrprev)rdevil = exponentialaverage[42]((xslValue * 20) + close)n = 7 // short term periodm = 5 // middle term periodlbuy = angel CROSSES OVER devilvar1 = (close - lowest[60](low)) / (highest[60](high) - lowest[60](low)) * 100//b = xsa(var1,n,1)once ma = undefinedonce b = undefinedsum = sum[1] - var1[n] + var1IF var1[n] > 0 THENma = sum / nENDIFIf b[1] = undefined thenb = maelseb = (var1 + b[1] * (n - 1)) / nEndif//var2 = xsa(b,m,1)once ma2 = undefinedonce var2 = undefinedsum2 = sum2[1] - b[m] + bIF b[m] > 0 THENma2 = sum2 / mENDIFIF var2[1] = undefined THENvar2 = ma2ELSEvar2 = (b + var2[1] * (m - 1)) / mENDIFmar1 = (2*close + high + low + open) / 5mar2 = LOWEST[34](low)mar3 = HIGHEST[34](high)sk = EXPONENTIALAVERAGE[13]((mar1 - mar2) / (mar3 - mar2) * 100)IF b[1] <> 0 THENprevB = b[1]ELSEprevB = bENDIFIF sk[1] <> 0 THENprevSk = sk[1]ELSEprevSk = skENDIFldb = (b <= 10) AND (sk <= 10) AND (b > prevB) AND (sk > prevSk)swingBuy = lbuy AND ldbIF lbuy THENDRAWCANDLE(open, high, low, close) COLOURED(255, 255, 0) BORDERCOLOR(255, 255, 0) // 255, 255, 0 is the RGB code for yellowENDIFRETURN 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…
1 user thanked author for this post.
09/21/2023 at 10:08 PM #22141609/22/2023 at 8:14 AM #22142309/22/2023 at 8:19 AM #221425Don’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. 😉09/22/2023 at 2:06 PM #22145009/22/2023 at 5:37 PM #221456An 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 Bears1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950// Bulls v Bears// Input settingslen = 14 // BvB Period: 1-200barsBack = 120 // Normalized bars back: 1-200tline = 80 // Line Height: 1-200tlineinv = -tline// Calculationma = Average[len](close)bulls = high - mabears = ma - low// Normalize the values between -100 and 100minBulls = Lowest[barsBack](bulls)maxBulls = Highest[barsBack](bulls)normBulls = ((bulls - minBulls) / (maxBulls - minBulls) - 0.5) * 200minBears = Lowest[barsBack](bears)maxBears = Highest[barsBack](bears)normBears = ((bears - minBears) / (maxBears - minBears) - 0.5) * 200// Calculate the total and add signalstotal = normBulls - normBearsbullishO = total > tlinebearishO = total < tlineinvIF total >= 0 THENr = 0g = 255b = 0 // GreenELSEr = 255g = 0b = 0 // RedENDIF// Bullish Crossover circleIF bullishO THENDrawpoint(barindex,tline,3) coloured(255,0,212,255)ENDIF// Bearish Crossover circleIF bearishO THENDrawpoint(barindex,tlineinv,3) coloured(238,255,0,255)ENDIFRETURN total STYLE(HISTOGRAM) COLOURED(r,g,b), tline style(dottedline2,2) coloured("grey",200), tlineinv style(dottedline2,2) coloured("grey",200)09/22/2023 at 5:50 PM #221457// 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]
09/22/2023 at 6:28 PM #221459/ 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
09/22/2023 at 7:17 PM #221461For 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?
09/22/2023 at 7:55 PM #221462For 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)
10/20/2023 at 8:00 AM #222678This is the conversion of this indicator : Bull Bear Power Trend by Dreadblitz
https://in.tradingview.com/script/wjlDy5tV-Bull-Bear-Power-Trend/Bull Bear Power Trend12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576// by Dreadblitzonce niv2 = 2once niv0 = 0once niv22 = -2// ComputationsBullTrend = (close - lowest[50](low)) / AverageTrueRange[5](close)BearTrend = (highest[50](high) - close) / AverageTrueRange[5](close)BearTrend2 = -1 * BearTrendBearTrendHist = (BullTrend<2)*(bulltrend-2)BullTrendHist = (Beartrend2>-2)*(Beartrend2+2)Trend = BullTrend - Beartrendif bulltrend>2 thenbullR = 0BullG = 128BullB = 0elsebullR = 128BullG = 128BullB = 128endifcolorbetween(BullTrend,niv2,BullR,BullG,BullB,50)if beartrend2<-2 thenbearR = 255bearG = 0bearB = 0elsebearR = 128bearG = 128bearB = 128endifcolorbetween(beartrend2,niv22,bearR,bearG,bearB,50)If regTrendOn = 0 thendrawsegment(barindex-1,Trend[1],barindex,Trend) style(line,2) coloured("black",255)else//alexgrover-Regression Line Formulax = barindexy = Trendxx = Average[length](x)yy = Average[length](y)mx = std[length](x)my = std[length](y)lenMinusOne = length - 1meanx = 0.0meany = 0.0for i=0 to lenMinusOnemeanx = meanx + (x[i])meany = meany + (y[i])nextmeanx = meanx / lengthmeany = meany / lengthsumxy=0.0sumx=0.0sumy=0.0for i=0 to lenMinusOnesumxy = sumxy + ((x[i]) - meanx) * ((y[i]) - meany)sumx = sumx + pow((x[i]) - meanx, 2)sumy = sumy + pow((y[i]) - meany, 2)nextc = sumxy / sqrt(sumy * sumx)slope = c * (my / mx)inter = yy - slope * xxregtrend = x * slope + interdrawsegment(barindex-1,regtrend[1],barindex,regtrend) style(line,2) coloured("black",255)EndifReturn 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)7 users thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on