AI BTCUSDT SPOTBYBIT:BTCUSDTCaptAviator//@version=5 indicator("Professional Trade Advisor - Daily TF", shorttitle="Pro Trade Advisor", overlay=true, timeframe="D") // Input parameters fast_length = input.int(9, "Fast EMA", group="Moving Averages") slow_length = input.int(21, "Slow EMA", group="Moving Averages") signal_length = input.int(14, "Signal Length", group="RSI Settings") rsi_overbought = input.int(70, "RSI Overbought", group="RSI Settings") rsi_oversold = input.int(30, "RSI Oversold", group="RSI Settings") atr_period = input.int(14, "ATR Period", group="Risk Management") risk_reward = input.float(2.0, "Risk/Reward Ratio", group="Risk Management") show_signals = input.bool(true, "Show Buy/Sell Signals", group="Display") show_levels = input.bool(true, "Show TP/SL Levels", group="Display") // Calculate indicators ema_fast = ta.ema(close, fast_length) ema_slow = ta.ema(close, slow_length) rsi = ta.rsi(close, signal_length) atr = ta.atr(atr_period) // Volume analysis volume_sma = ta.sma(volume, 20) high_volume = volume > volume_sma * 1.5 // MACD for confirmation = ta.macd(close, 12, 26, 9) macd_histogram = macd_line - signal_line // Support and Resistance levels pivot_high = ta.pivothigh(high, 5, 5) pivot_low = ta.pivotlow(low, 5, 5) // Trend identification trend_up = ema_fast > ema_slow and close > ema_fast trend_down = ema_fast < ema_slow and close < ema_fast // Buy conditions buy_condition1 = ta.crossover(ema_fast, ema_slow) and rsi < 50 buy_condition2 = rsi < rsi_oversold and ta.crossunder(rsi, rsi_oversold) and trend_up buy_condition3 = macd_histogram > 0 and ta.cross(macd_line, signal_line) and close > ema_slow buy_signal = (buy_condition1 or buy_condition2 or buy_condition3) and high_volume // Sell conditions sell_condition1 = ta.crossunder(ema_fast, ema_slow) and rsi > 50 sell_condition2 = rsi > rsi_overbought and ta.cross(rsi, rsi_overbought) and trend_down sell_condition3 = macd_histogram < 0 and ta.crossunder(macd_line, signal_line) and close < ema_slow sell_signal = (sell_condition1 or sell_condition2 or sell_condition3) and high_volume // Calculate TP and SL levels long_sl = close - (atr * 1.5) long_tp = close + (atr * 1.5 * risk_reward) short_sl = close + (atr * 1.5) short_tp = close - (atr * 1.5 * risk_reward) // Plot EMAs plot(ema_fast, color=color.blue, linewidth=2, title="Fast EMA") plot(ema_slow, color=color.red, linewidth=2, title="Slow EMA") // Plot buy/sell signals if show_signals and buy_signal label.new(bar_index, low, "BUY\nTP: " + str.tostring(math.round_to_mintick(long_tp)) + "\nSL: " + str.tostring(math.round_to_mintick(long_sl)), color=color.green, textcolor=color.white, style=label.style_label_up, size=size.small) // Plot TP/SL levels if show_levels line.new(bar_index, long_tp, bar_index+5, long_tp, color=color.green, width=1, style=line.style_dashed) line.new(bar_index, long_sl, bar_index+5, long_sl, color=color.red, width=1, style=line.style_dashed) if show_signals and sell_signal label.new(bar_index, high, "SELL\nTP: " + str.tostring(math.round_to_mintick(short_tp)) + "\nSL: " + str.tostring(math.round_to_mintick(short_sl)), color=color.red, textcolor=color.white, style=label.style_label_down, size=size.small) // Plot TP/SL levels if show_levels line.new(bar_index, short_tp, bar_index+5, short_tp, color=color.green, width=1, style=line.style_dashed) line.new(bar_index, short_sl, bar_index+5, short_sl, color=color.red, width=1, style=line.style_dashed) // Plot pivot points plotshape(pivot_high, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny) plotshape(pivot_low, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny) // Background color for trend bgcolor(trend_up ? color.new(color.green, 95) : trend_down ? color.new(color.red, 95) : na) // Alert conditions alertcondition(buy_signal, title="Buy Signal", message="Buy signal generated with TP {{close}}") alertcondition(sell_signal, title="Sell Signal", message="Sell signal generated with TP {{close}}") // Table for current signal info if barstate.islast var table info_table = table.new(position.top_right, 2, 4, bgcolor=color.white, border_width=1) signal_text = buy_signal ? "BUY" : sell_signal ? "SELL" : "WAIT" signal_color = buy_signal ? color.green : sell_signal ? color.red : color.gray table.cell(info_table, 0, 0, "Signal", text_color=color.black) table.cell(info_table, 1, 0, signal_text, text_color=signal_color) table.cell(info_table, 0, 1, "RSI", text_color=color.black) table.cell(info_table, 1, 1, str.tostring(math.round(rsi, 2)), text_color=color.black) table.cell(info_table, 0, 2, "Trend", text_color=color.black) table.cell(info_table, 1, 2, trend_up ? "UP" : trend_down ? "DOWN" : "NEUTRAL", text_color=trend_up ? color.green : trend_down ? color.red : color.gray) table.cell(info_table, 0, 3, "ATR", text_color=color.black) table.cell(info_table, 1, 3, str.tostring(math.round(atr, 2)), text_color=color.black)