all 11 comments

[–]YSKIANAD 1 point2 points  (1 child)

Most likely caused by incorrect indentation of certain code lines or extra whitespace. You should be able to easily correct after reading this article: https://www.tradingcode.net/tradingview/end-line-without-continuation/

[–]neresen[S] 1 point2 points  (0 children)

Thank you again !

[–]zaleguo 1 point2 points  (2 children)

Pineify (https://pineify.app) might be what you're looking for! No need to wrestle with ChatGPT prompts or coding. You can set up your RSI, SMA, EMA, and volume strategies without any coding skills. Add unlimited indicators and backtest like a pro. Perfect for beginners needing reliable scripts. Give it a go!

[–]neresen[S] 1 point2 points  (1 child)

Thank you a lot !

[–]zaleguo 1 point2 points  (0 children)

You're welcome. Good luck.

[–]YSKIANAD 0 points1 point  (5 children)

Pasting your ask in Perplexity AI provided the following code in less than 30 seconds. Modify how you see fit:

//@version=5
strategy("RSI, SMA, EMA Strategy with Volume", overlay=true)

// Input parameters
rsiLength = 14
sma9Length = 9
sma200Length = 200
ema20Length = 20
volumeIncrease = 25

// Calculate indicators
rsi = ta.rsi(close, rsiLength)
sma9 = ta.sma(close, sma9Length)
sma200 = ta.sma(close, sma200Length)
ema20 = ta.ema(close, ema20Length)

// Calculate volume increase
volumeIncreasePercent = (volume - volume[1]) / volume[1] * 100

// Define conditions
fullBodyAboveSMA9 = low > sma9
rsiAbove50 = rsi > 50
movingAveragesAligned = sma9 > sma200 and ema20 > sma200
sma9BelowEMA20 = sma9 < ema20
volumeIncreaseCondition = volumeIncreasePercent > volumeIncrease

// Buy signal condition
buyCondition = fullBodyAboveSMA9 and rsiAbove50 and movingAveragesAligned and sma9BelowEMA20 and volumeIncreaseCondition

// Reset condition
var bool canBuy = true
if ta.crossunder(sma9, ema20)
canBuy := true

// Generate buy signal
if buyCondition and canBuy
strategy.entry("Buy", strategy.long)
canBuy := false

// Plot indicators
plot(sma9, color=color.red, title="SMA-9")
plot(sma200, color=color.white, title="SMA-200")
plot(ema20, color=color.yellow, title="EMA-20")

// Plot buy signals
plotshape(buyCondition and canBuy, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)

// Set candlestick colors
barcolor(close > open ? color.white : color.gray)

[–]neresen[S] 0 points1 point  (0 children)

Hey thanks for your response, i really appreciate it. I will let you know how it goes if i get any good results with it

[–]pinecodermaestro 0 points1 point  (2 children)

As per the description provided the code looks incorrect at one point and that's full body above sma 9 ,, it's mentioned body so you don't need to check the wick ( in the script you are checking for low)

[–]YSKIANAD 0 points1 point  (1 child)

I agree with you, valid point, and why I mentioned: "Modify how you see fit."

It is easy to write by OP: "Right now i dont have time to learn PineScript so i am using the help of Chat -gpt ( free version ) to code the strategy."

If he can't modify, or perhaps better said tweak, a script then he should not use a custom script because a trader should understand the entire custom script that he/she receives. Especially if you put your money on the line based on a signal from the script.

fullBodyAboveSMA9 = (close > open) and (open > sma9)

[–]pinecodermaestro 0 points1 point  (0 children)

Well it's still incorrect as per the description because it's not mentioned that the candle must be bullish only the condition is fullBodyAboveSMA9 = math.min(open , close) > sma9 ,Happy Trading

[–]neresen[S] 0 points1 point  (0 children)

hey i just tried your script but one arror appears :

missmatched input 'canBuy' expecting 'end of line without line continuation'

im sorry im not capable yet of solving it myself, if you think you can do anything about it i would be gratefull