Hi, I'm trying to develop a bot based on some indicators.
So I have this bot based on ATR and SMA. I could figure how to make the bot buy and sell everytime it crosses the ATR.
But what I need to make now is make the bot only buy if the price is above the moving average and cross the ATR or only sell if the price is below the SMA and cross the atr.
strategy(title="UT Bot", overlay = true) //CREDITS to HPotter for the orginal code. The guy trying to sell this as his own is a scammer lol. src = close
// Get user input res = input(title="EMA Timeframe", type=input.resolution, defval="D") len = input(title="EMA Length", type=input.integer, defval=50) col = input(title="Color EMA", type=input.bool, defval=true) smooth = input(title="Smooth", type=input.bool, defval=false) // Calculate EMA ema = ema(close, len) emaSmooth = security(syminfo.tickerid, res, ema, barmerge.gaps_on, barmerge.lookahead_off) emaStep = security(syminfo.tickerid, res, ema, barmerge.gaps_off, barmerge.lookahead_off) // Draw EMA plot(smooth ? emaSmooth : emaStep, color=col ? close > emaStep ? color.green : color.red : color.black, style=plot.style_line, linewidth=2, title="EMA (HTF)")
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.