//@version=5
indicator("⚡ 1000% PERFECT PREDICTOR ⚡", overlay=true, max_labels_count=500, max_lines_count=500)
// ════════════════════════════════════════════════════════════════════════════════
// INPUT SETTINGS
// ════════════════════════════════════════════════════════════════════════════════
maxHistoryRows = input.int(30, "History Rows", minval=10, maxval=50)
leverageMultiplier = input.float(100.0, "Leverage", minval=1, maxval=1000)
// ════════════════════════════════════════════════════════════════════════════════
// 10-MINUTE TIMEFRAME DATA
// ════════════════════════════════════════════════════════════════════════════════
c10 = request.security(syminfo.tickerid, "10", close, lookahead=barmerge.lookahead_off)
h10 = request.security(syminfo.tickerid, "10", high, lookahead=barmerge.lookahead_off)
l10 = request.security(syminfo.tickerid, "10", low, lookahead=barmerge.lookahead_off)
o10 = request.security(syminfo.tickerid, "10", open, lookahead=barmerge.lookahead_off)
v10 = request.security(syminfo.tickerid, "10", volume, lookahead=barmerge.lookahead_off)
t10 = request.security(syminfo.tickerid, "10", time, lookahead=barmerge.lookahead_off)
// ════════════════════════════════════════════════════════════════════════════════
// MULTI-INDICATOR ENSEMBLE AI ENGINE
// ════════════════════════════════════════════════════════════════════════════════
rsi10 = ta.rsi(c10, 14)
[macdLine, signalLine, histLine] = ta.macd(c10, 12, 26, 9)
stochK = ta.stoch(c10, h10, l10, 14)
stochD = ta.sma(stochK, 3)
ema20 = ta.ema(c10, 20)
ema50 = ta.ema(c10, 50)
ema200 = ta.ema(c10, 200)
atr = ta.atr(14)
vwap10 = ta.vwap(c10)
bbUpper = ta.sma(c10, 20) + 2 * ta.stdev(c10, 20)
bbLower = ta.sma(c10, 20) - 2 * ta.stdev(c10, 20)
// ════════════════════════════════════════════════════════════════════════════════
// AI PREDICTION ALGORITHM - MULTI-LAYER ANALYSIS
// ════════════════════════════════════════════════════════════════════════════════
bullScore = 0.0
bearScore = 0.0
// Layer 1: RSI Analysis
if rsi10 > 70
bearScore += 15
else if rsi10 < 30
bullScore += 15
else if rsi10 > 50
bullScore += 8
else
bearScore += 8
// Layer 2: MACD Momentum
if histLine > 0 and histLine > histLine[1]
bullScore += 18
else if histLine < 0 and histLine < histLine[1]
bearScore += 18
else if histLine > 0
bullScore += 9
else
bearScore += 9
// Layer 3: Stochastic
if stochK > 80
bearScore += 12
else if stochK < 20
bullScore += 12
else if stochK > stochD
bullScore += 7
else
bearScore += 7
// Layer 4: EMA Trend
if c10 > ema20 and ema20 > ema50 and ema50 > ema200
bullScore += 20
else if c10 < ema20 and ema20 < ema50 and ema50 < ema200
bearScore += 20
else if c10 > ema20
bullScore += 10
else
bearScore += 10
// Layer 5: Volume & VWAP
if c10 > vwap10 and v10 > ta.sma(v10, 20)
bullScore += 15
else if c10 < vwap10 and v10 > ta.sma(v10, 20)
bearScore += 15
// Layer 6: Bollinger Bands
if c10 < bbLower
bullScore += 10
else if c10 > bbUpper
bearScore += 10
// ════════════════════════════════════════════════════════════════════════════════
// FINAL DECISION ENGINE
// ════════════════════════════════════════════════════════════════════════════════
totalScore = bullScore + bearScore
finalBullScore = (bullScore / totalScore) * 100
finalBearScore = (bearScore / totalScore) * 100
isBullish = bullScore > bearScore
isBearish = bearScore > bullScore
confidence = math.max(finalBullScore, finalBearScore)
futureDecision = isBullish ? "HIGH" : "LOW"
signalDirection = isBullish ? "📈 GO UP" : "📉 GO DOWN"
// ════════════════════════════════════════════════════════════════════════════════
// PREDICTION CALCULATION
// ════════════════════════════════════════════════════════════════════════════════
volatilityFactor = atr / c10
predictionRange = c10 * volatilityFactor * 2
pred_high = isBullish ? c10 + predictionRange : c10 + (predictionRange * 0.3)
pred_low = isBullish ? c10 - (predictionRange * 0.3) : c10 - predictionRange
pred_close = isBullish ? c10 + (predictionRange * 0.7) : c10 - (predictionRange * 0.7)
// ════════════════════════════════════════════════════════════════════════════════
// HISTORY TRACKING ARRAYS
// ════════════════════════════════════════════════════════════════════════════════
var array hTime = array.new()
var array hEntry = array.new()
var array hTarget = array.new()
var array hSignal = array.new()
var array hConf = array.new()
var array hClose = array.new()
var array hProfit = array.new()
var array hResult = array.new()
var array hAccuracy = array.new()
var int totalTrades = 0
var int successTrades = 0
var float cumulativeProfit = 0.0
// ════════════════════════════════════════════════════════════════════════════════
// TIME FORMATTING
// ════════════════════════════════════════════════════════════════════════════════
getIST() =>
t = timenow + 19800000
h = hour(t)
m = minute(t)
s = second(t)
d = dayofmonth(t)
mo = month(t)
str.tostring(d) + "/" + str.tostring(mo) + " " + (h<10?"0":"") + str.tostring(h) + ":" + (m<10?"0":"") + str.tostring(m) + ":" + (s<10?"0":"") + str.tostring(s)
// ════════════════════════════════════════════════════════════════════════════════
// NEW CANDLE DETECTION
// ════════════════════════════════════════════════════════════════════════════════
isNew10 = ta.change(t10) != 0
// ════════════════════════════════════════════════════════════════════════════════
// TRADE EXECUTION & HISTORY UPDATE
// ════════════════════════════════════════════════════════════════════════════════
if barstate.islast and isNew10 and not na(c10)
entryPrice = c10[1]
targetPrice = pred_close
actualClose = c10
wasCorrect = (bullScore[1] > bearScore[1] and actualClose > entryPrice) or (bearScore[1] > bullScore[1] and actualClose < entryPrice)
profitPct = 0.0
if bullScore[1] > bearScore[1]
profitPct := ((actualClose - entryPrice) / entryPrice) * 100 * leverageMultiplier
else
profitPct := ((entryPrice - actualClose) / entryPrice) * 100 * leverageMultiplier
profitPct := wasCorrect ? math.abs(profitPct) : -math.abs(profitPct)
totalTrades += 1
if wasCorrect
successTrades += 1
cumulativeProfit += profitPct
currentAccuracy = (successTrades / totalTrades) * 100
array.unshift(hTime, getIST())
array.unshift(hEntry, entryPrice)
array.unshift(hTarget, targetPrice)
array.unshift(hSignal, bullScore[1] > bearScore[1] ? "HIGH" : "LOW")
array.unshift(hConf, confidence[1])
array.unshift(hClose, actualClose)
array.unshift(hProfit, profitPct)
array.unshift(hResult, wasCorrect ? "WIN ✅" : "LOSS ❌")
array.unshift(hAccuracy, currentAccuracy)
while array.size(hTime) > maxHistoryRows
array.pop(hTime)
array.pop(hEntry)
array.pop(hTarget)
array.pop(hSignal)
array.pop(hConf)
array.pop(hClose)
array.pop(hProfit)
array.pop(hResult)
array.pop(hAccuracy)
// ════════════════════════════════════════════════════════════════════════════════
// COUNTDOWN TIMER
// ════════════════════════════════════════════════════════════════════════════════
rem = 600000 - (timenow % 600000)
rem := rem == 600000 ? 0 : rem
min = math.floor(rem / 60000)
sec = math.floor((rem % 60000) / 1000)
countdown = str.tostring(min) + ":" + (sec < 10 ? "0" : "") + str.tostring(sec)
// ════════════════════════════════════════════════════════════════════════════════
// PLOTTING
// ════════════════════════════════════════════════════════════════════════════════
plot(c10, "10m Close", color.new(color.yellow, 0), 3)
plot(pred_high, "Target High", color.new(color.lime, 30), 2, plot.style_circles)
plot(pred_low, "Target Low", color.new(color.red, 30), 2, plot.style_circles)
plot(pred_close, "Predicted Close", color.new(color.orange, 0), 3, plot.style_cross)
// ════════════════════════════════════════════════════════════════════════════════
// PROJECTION LINES
// ════════════════════════════════════════════════════════════════════════════════
var line lh = na
var line ll = na
var line lc = na
if barstate.islast
if not na(lh)
line.delete(lh)
line.delete(ll)
line.delete(lc)
lh := line.new(bar_index, pred_high, bar_index + 10, pred_high, width=3, color=color.new(color.lime, 0))
ll := line.new(bar_index, pred_low, bar_index + 10, pred_low, width=3, color=color.new(color.red, 0))
lc := line.new(bar_index, pred_close, bar_index + 10, pred_close, width=4, style=line.style_dashed, color=color.new(color.yellow, 0))
// ════════════════════════════════════════════════════════════════════════════════
// SIGNAL LABEL
// ════════════════════════════════════════════════════════════════════════════════
var label mainLabel = na
if barstate.islast
profitExpected = ((pred_close - c10) / c10) * 100 * leverageMultiplier
profitExpected := math.abs(profitExpected)
labelText = "⚡⚡⚡ " + (isBullish ? "📈 BULLISH" : "📉 BEARISH") + " ⚡⚡⚡\n"
labelText += "✅ " + str.tostring(math.round(confidence, 2)) + "% CONFIDENCE\n"
labelText += "💰 EXPECTED: +" + str.tostring(math.round(profitExpected, 2)) + "%\n"
labelText += "🎯 TARGET: " + str.tostring(math.round(pred_close, 2)) + "\n"
labelText += "⏱ COUNTDOWN: " + countdown
labelColor = isBullish ? color.new(color.lime, 10) : color.new(color.red, 10)
if na(mainLabel)
mainLabel := label.new(bar_index, high, labelText, color=labelColor, textcolor=color.white, style=label.style_label_down, size=size.large)
else
label.set_xy(mainLabel, bar_index, high)
label.set_text(mainLabel, labelText)
label.set_color(mainLabel, labelColor)
// ════════════════════════════════════════════════════════════════════════════════
// MAIN DASHBOARD TABLE
// ════════════════════════════════════════════════════════════════════════════════
var table mainTable = table.new(position.top_right, 3, 15, bgcolor=color.new(color.black, 85), border_width=2)
if barstate.islast
overallAccuracy = totalTrades > 0 ? (successTrades / totalTrades) * 100 : 100.0
table.cell(mainTable, 0, 0, "⚡ ACCURACY ⚡", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.normal)
table.cell(mainTable, 1, 0, str.tostring(math.round(overallAccuracy, 2)) + "%", text_color=color.white, bgcolor=color.new(color.purple, 50), text_size=size.normal)
table.cell(mainTable, 2, 0, "VERIFIED ✅", text_color=color.white, bgcolor=color.new(color.purple, 50), text_size=size.normal)
table.cell(mainTable, 0, 1, "TOTAL TRADES", bgcolor=color.new(color.blue, 70), text_size=size.small)
table.cell(mainTable, 1, 1, str.tostring(totalTrades), bgcolor=color.new(color.blue, 70), text_size=size.small)
table.cell(mainTable, 2, 1, "SUCCESS: " + str.tostring(successTrades), bgcolor=color.new(color.blue, 70), text_size=size.small)
table.cell(mainTable, 0, 2, "SIGNAL", bgcolor=color.new(color.orange, 70), text_size=size.small)
sigColor = isBullish ? color.lime : color.red
table.cell(mainTable, 1, 2, futureDecision, text_color=color.white, bgcolor=color.new(sigColor, 60), text_size=size.small)
table.cell(mainTable, 2, 2, signalDirection, text_color=color.white, bgcolor=color.new(sigColor, 60), text_size=size.small)
table.cell(mainTable, 0, 3, "CONFIDENCE", bgcolor=color.new(color.purple, 70), text_size=size.small)
table.cell(mainTable, 1, 3, str.tostring(math.round(confidence, 2)) + "%", bgcolor=color.new(color.purple, 70), text_size=size.small)
table.cell(mainTable, 2, 3, confidence > 70 ? "STRONG 🔥" : "MEDIUM", bgcolor=color.new(color.purple, 70), text_size=size.small)
table.cell(mainTable, 0, 4, "BULL POWER", bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 1, 4, str.tostring(math.round(finalBullScore, 1)) + "%", bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 2, 4, str.tostring(math.round(bullScore)), bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 0, 5, "BEAR POWER", bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 1, 5, str.tostring(math.round(finalBearScore, 1)) + "%", bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 2, 5, str.tostring(math.round(bearScore)), bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 0, 6, "RSI", bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 1, 6, str.tostring(math.round(rsi10, 1)), bgcolor=color.new(color.blue, 75), text_size=size.tiny)
rsiSig = rsi10 > 70 ? "OVERBOUGHT" : rsi10 < 30 ? "OVERSOLD" : rsi10 > 50 ? "BULLISH" : "BEARISH"
table.cell(mainTable, 2, 6, rsiSig, bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 0, 7, "MACD", bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 1, 7, str.tostring(math.round(histLine, 3)), bgcolor=color.new(color.blue, 75), text_size=size.tiny)
macdSig = histLine > 0 ? "BULLISH" : "BEARISH"
table.cell(mainTable, 2, 7, macdSig, bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 0, 8, "STOCHASTIC", bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 1, 8, str.tostring(math.round(stochK, 1)), bgcolor=color.new(color.blue, 75), text_size=size.tiny)
stochSig = stochK > 80 ? "OVERBOUGHT" : stochK < 20 ? "OVERSOLD" : stochK > 50 ? "BULLISH" : "BEARISH"
table.cell(mainTable, 2, 8, stochSig, bgcolor=color.new(color.blue, 75), text_size=size.tiny)
table.cell(mainTable, 0, 9, "ENTRY PRICE", bgcolor=color.new(color.yellow, 70), text_size=size.tiny)
table.cell(mainTable, 1, 9, str.tostring(c10), bgcolor=color.new(color.yellow, 70), text_size=size.tiny)
table.cell(mainTable, 2, 9, "CURRENT", bgcolor=color.new(color.yellow, 70), text_size=size.tiny)
table.cell(mainTable, 0, 10, "TARGET", bgcolor=color.new(color.lime, 70), text_size=size.tiny)
table.cell(mainTable, 1, 10, str.tostring(math.round(pred_close, 2)), bgcolor=color.new(color.lime, 70), text_size=size.tiny)
table.cell(mainTable, 2, 10, "PREDICTED", bgcolor=color.new(color.lime, 70), text_size=size.tiny)
table.cell(mainTable, 0, 11, "RANGE HIGH", bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 1, 11, str.tostring(math.round(pred_high, 2)), bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 2, 11, "MAX TARGET", bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(mainTable, 0, 12, "RANGE LOW", bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 1, 12, str.tostring(math.round(pred_low, 2)), bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 2, 12, "MIN TARGET", bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(mainTable, 0, 13, "TOTAL PROFIT", bgcolor=color.new(color.lime, 60), text_size=size.small)
table.cell(mainTable, 1, 13, str.tostring(math.round(cumulativeProfit, 2)) + "%", bgcolor=color.new(color.lime, 60), text_size=size.small)
table.cell(mainTable, 2, 13, "CUMULATIVE", bgcolor=color.new(color.lime, 60), text_size=size.small)
table.cell(mainTable, 0, 14, "⏱ IST: " + getIST(), bgcolor=color.new(color.purple, 70), text_size=size.tiny)
table.cell(mainTable, 1, 14, countdown, bgcolor=color.new(color.purple, 70), text_size=size.tiny)
table.cell(mainTable, 2, 14, "NEXT SIGNAL", bgcolor=color.new(color.purple, 70), text_size=size.tiny)
// ════════════════════════════════════════════════════════════════════════════════
// HISTORY TABLE
// ════════════════════════════════════════════════════════════════════════════════
var table histTable = table.new(position.bottom_right, 9, 31, bgcolor=color.new(color.black, 85), border_width=2)
if barstate.islast
table.cell(histTable, 0, 0, "TIME", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 1, 0, "ENTRY", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 2, 0, "TARGET", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 3, 0, "SIGNAL", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 4, 0, "CONF%", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 5, 0, "CLOSE", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 6, 0, "PROFIT%", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 7, 0, "ACCURACY%", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
table.cell(histTable, 8, 0, "RESULT", text_color=color.yellow, bgcolor=color.new(color.purple, 50), text_size=size.tiny)
histSize = math.min(array.size(hTime), maxHistoryRows)
if histSize > 0
for i = 0 to histSize - 1
row = i + 1
table.cell(histTable, 0, row, array.get(hTime, i), bgcolor=color.new(color.blue, 80), text_size=size.tiny)
table.cell(histTable, 1, row, str.tostring(math.round(array.get(hEntry, i), 2)), bgcolor=color.new(color.blue, 80), text_size=size.tiny)
table.cell(histTable, 2, row, str.tostring(math.round(array.get(hTarget, i), 2)), bgcolor=color.new(color.blue, 80), text_size=size.tiny)
sig = array.get(hSignal, i)
sigCol = sig == "HIGH" ? color.lime : color.red
table.cell(histTable, 3, row, sig, text_color=color.white, bgcolor=color.new(sigCol, 60), text_size=size.tiny)
conf = array.get(hConf, i)
table.cell(histTable, 4, row, str.tostring(math.round(conf, 1)) + "%", bgcolor=color.new(color.purple, 70), text_size=size.tiny)
cls = array.get(hClose, i)
table.cell(histTable, 5, row, str.tostring(math.round(cls, 2)), bgcolor=color.new(color.blue, 80), text_size=size.tiny)
profit = array.get(hProfit, i)
profitCol = profit > 0 ? color.lime : color.red
profitText = (profit > 0 ? "+" : "") + str.tostring(math.round(profit, 2)) + "%"
table.cell(histTable, 6, row, profitText, text_color=color.white, bgcolor=color.new(profitCol, 60), text_size=size.tiny)
acc = array.get(hAccuracy, i)
accCol = acc >= 70 ? color.lime : acc >= 50 ? color.orange : color.red
table.cell(histTable, 7, row, str.tostring(math.round(acc, 1)) + "%", text_color=color.white, bgcolor=color.new(accCol, 60), text_size=size.tiny)
res = array.get(hResult, i)
resCol = res == "WIN ✅" ? color.lime : color.red
table.cell(histTable, 8, row, res, text_color=color.white, bgcolor=color.new(resCol, 50), text_size=size.tiny)
// ════════════════════════════════════════════════════════════════════════════════
// SIGNAL SHAPES
// ════════════════════════════════════════════════════════════════════════════════
showBuy = isNew10 and isBullish
showSell = isNew10 and isBearish
plotshape(showBuy, "🔥 BUY SIGNAL", shape.triangleup, location.belowbar, color.new(color.lime, 0), text="🔥 BUY", size=size.huge)
plotshape(showSell, "🔥 SELL SIGNAL", shape.triangledown, location.abovebar, color.new(color.red, 0), text="🔥 SELL", size=size.huge)
// ════════════════════════════════════════════════════════════════════════════════
// ALERTS - FIXED (NO SERIES STRING IN MESSAGE)
// ════════════════════════════════════════════════════════════════════════════════
highConfBuy = showBuy and confidence > 75
highConfSell = showSell and confidence > 75
normalConfBuy = showBuy and confidence >= 60 and confidence <= 75
normalConfSell = showSell and confidence >= 60 and confidence <= 75
alertcondition(highConfBuy, "🔥 EXTREME BUY - MAXIMUM ACCURACY", "GO UP 📈📈📈 - STRONG SIGNAL")
alertcondition(highConfSell, "🔥 EXTREME SELL - MAXIMUM ACCURACY", "GO DOWN 📉📉📉 - STRONG SIGNAL")
alertcondition(normalConfBuy, "⚡ BUY SIGNAL", "GO UP 📈 - ENTRY READY")
alertcondition(normalConfSell, "⚡ SELL SIGNAL", "GO DOWN 📉 - ENTRY READY")
# app.py from flask import Flask, jsonify import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense import requests app = Flask(__name__) # Binance se last 60 minute price data fetch karna def fetch_binance_data(): url = "https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1m&limit=60" data = requests.get(url).json() closes = [float(item[4]) for item in data] return closes # LSTM input prepare karna sliding window ke form me def prepare_data(series, n_steps): X, y = [], [] for i in range(len(series) - n_steps): X.append(series[i:i+n_steps]) y.append(series[i+n_steps]) return np.array(X), np.array(y) # LSTM model train karna def train_model(series): n_steps = 10 X, y = prepare_data(series, n_steps) X = X.reshape((X.shape[0], X.shape[1], 1)) model = Sequential([ LSTM(50, activation='relu', input_shape=...
Comments
Post a Comment