Example output
# Input parameters
input fastLength = 20;
input slowLength = 50;
input rsiLength = 14;
input rsiOverbought = 70;
input rsiOversold = 30;
# Define moving averages
def fastMA = SimpleMovingAvg(close, fastLength);
def slowMA = SimpleMovingAvg(close, slowLength);
# Define RSI
def rsi = RSI(close, rsiLength);
# Determine Buy/Sell signals
def buySignal = fastMA crosses above slowMA and rsi > 50;
def sellSignal = fastMA crosses below slowMA and rsi < 50;
# Plot Buy/Sell signals on chart
plot buy = if buySignal then low - 2.0 else Double.NaN;
plot sell = if sellSignal then high + 2.0 else Double.NaN;
buy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
sell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
# Add Chart Label for Buy/Sell Signals
AddChartBubble(buySignal, low - 2, "Buy", Color.GREEN);
AddChartBubble(sellSignal, high + 2, "Sell", Color.RED);