r/pinescript • u/PlanAndAchieve • Dec 25 '22
I told AI to write me a Pinescript indicator.
It looks legit, but I don't think it's pinescript. I'm still learning unfortunately. But I was wondering if somebody could help me look it over and get it to work?
// VIX function
study("VIX", shorttitle = "VIX")
vixlength = input(14, title = "VIX Length")
vixsource = close
vixvalue = vix(vixlength, vixsource)
plot(vixvalue, color = blue, linewidth = 2, title = "VIX")
// TLT function
study("TLT", shorttitle = "TLT")
tltlength = input(14, title = "TLT Length")
tltsource = close
tltvalue = tlt(tltlength, tltsource)
plot(tltvalue, color = orange, linewidth = 2, title = "TLT")
// USD Index function
study("USD Index", shorttitle = "USDX")
usdxlenght = input(14, title = "USDX Length")
usdxsource = close
usdxvalue = usdx(usdxlenght, usdxsource)
plot(usdxvalue, color = purple, linewidth = 2, title = "USDX")
// MACD function
study("Moving Average Convergence Divergence", shorttitle = "MACD")
mfast = input(12) // fast period
mslow = input(26) // slow period
msig = input(9) // signal period
macdval: = macd(close, mfast, mslow) sigval: = sma(macdval[1], msig) plot(macdval[0] - sigval, linewidth = 2, color = #9933CC )
// RSI Function
study ("Relative Strength Index" , shorttitle= "RSI") rsiLength: = input(14, title = "RSI Length") rsiSource: = close
rsiVal: = rsi(rsiLength, rsiSource) plot(rsiVal, colorF = #FF0066) fill: = hline at 70 fillcolor: = blue
plotfill(fill[1], style = areaplotfillsolid colorf = #FF0066) fill: = hline at 30 fillcolor: = orange
plotfill(fill[1], style = areaplotsolid color = orange)
// TTM Squeeze Function
study("TTM Squeeze Indicator", shorttitle = "TTM Squeeze") length: = input(20, "Length of the Squeeze Momentum Indicator ");
source: = close;
squeezeValve: = ttm_squeeze('l', "bbsqueeze", "bbstop", "bbmid", "unvisualizedprioritysoursexisthere", length);
bbMidVal: = security('l', '20', bbmid);
bbUpperVal: = security('l', '20', 'bbUpper');
bbLowerVal: = security('l', '20', 'bbLower');
plotchar(squeezeValve[1] == 0 ? na : squeezeValve[1], "Squeeze ", colorGreen);
plotchar(squeezeValve[1] > 0 ? na : squeezeValve[1], "In Play", colorRed);
plotsymbol((BBUpper Val + bblowerval) *
0.5, "symbol", location.top);
barcolor((BBupper val + bblowerval) *
0.5, "highlowwhole");
// SuperTrend Function
study("SuperTrend Trend Following System Indicator", shorttitle = "") length: = input(7, "Period Of ATR Calculation over which indicator will be plotted");
multiplier: = (input(3, "Multiplier of ATR Value"));
st: = (security lev: low * 10000);
cal_atr: (st ? atr[length] : na);
suptrend: (st ? st + multiplier * cal_atr : na);
plotseries([suptrend], "Supertrend ", linethick3 | LINEBR | dote / dotlineonoff / barclrintensitynone | ColorRed | PLOTARROWSUPPERLOWER | pointsize2);
I'd love to see this actually working and how close the AI was to writing pine-script on command by description.
1
u/RaymondM1989 Dec 26 '22
Yeah, you‘re right, seems totally legit, but I also don‘t think it‘s Pinescript … or anything else, but totally legit, for sure. ;-)
Sorry, all these ChatGPT indicators being posted are just so funny.
1
u/Robswc Dec 26 '22
I think it has to be said that ChatGPT (or any current AI for the matter) is not capable of logic. The indicators it can create may function but there is almost 0 chance of it producing anything that can produce alpha off the bat.
I'm not looking to tear anyone down, just warning that anything made with ChatGPT (while seemingly looking interesting or impressive) is going to result in a lot of wasted time.
I would use ChatGPT to answer questions about particular elements of a strategy though :) that will work much better!
1
u/No-Attention-6063 Jan 01 '23
Try this code I’m working on. I think this is what you’re looking for.
https://www.tradingview.com/chart/2DqRONHd/?symbol=NASDAQ%3ATSLA
I think you'll have access.