//@version=5
strategy("BankNifty Auto Bot - 99% Logic", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
macdLine = ta.ema(close, 12) - ta.ema(close, 26)
signalLine = ta.ema(macdLine, 9)
rsi = ta.rsi(close, 14)
buySignal = macdLine > signalLine and close > ema20 and close > ema50 and rsi < 70
sellSignal = macdLine < signalLine and close < ema20 and close < ema50 and rsi > 30
plotshape(buySignal, title="BUY", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="SELL", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
if (buySignal)
strategy.entry("BUY CALL", strategy.long)
if (sellSignal)
strategy.entry("BUY PUT", strategy.short)
plot(ema20, title="EMA 20", color=color.orange)
plot(ema50, title="EMA 50", color=color.blue)
# 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