My deepseek created idea

My deepseek created idea

//@version=5
strategy("High Leverage Futures Scalper", overlay=true, margin_long=100, margin_short=100, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=1)

// 1. Inputs
emaLength = input.int(6, "EMA Length")
rsiLength = input.int(4, "RSI Length")
atrLength = input.int(14, "ATR Length")
riskPercent = input.float(0.25, "Risk %", step=0.1)
useHeikinAshi = input.bool(true, "Use Heikin-Ashi Candles")

// 2. Heikin-Ashi Conversion
ha_close = (open + high + low + close)/4
ha_open = ta.ha_open(open , close )
ha_high = math.max(high, math.max(ha_open, ha_close))
ha_low = math.min(low, math.min(ha_open, ha_close))

// 3. Indicators
price = useHeikinAshi ? ha_close : close
ema = ta.ema(price, emaLength)
vwma = ta.vwma(close, 20)
atr = ta.atr(atrLength)
rsi = ta.rsi(close, rsiLength)
= ta.stoch(close, high, low, 8)
macdLine = ta.ema(close, 12) - ta.ema(close, 26)
macdSignal = ta.ema(macdLine, 9)
macdHist = macdLine - macdSignal

// 4. Support/Resistance (Simplified)
swingLow = ta.lowest(low, 5)
swingHigh = ta.highest(high, 5)

// 5. Entry Conditions
longCondition =
price > ema and
price > vwma and
rsi > 60 and
stochK > 20 and stochK > stochD and
macdHist > 0 and
low = swingHigh and
ta.crossunder(price, swingHigh - 0.5 * atr)

// 6. Risk Calculation
stopDistance = 0.5 * atr
qty = strategy.equity * riskPercent / 100 / (stopDistance * syminfo.mintick)

// 7. Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long, qty=qty)
strategy.exit("Exit Long", "Long", stop=close - stopDistance,
limit=close + 2 * stopDistance,
trail_points=3 * stopDistance,
trail_offset=1 * stopDistance)

if (shortCondition)
strategy.entry("Short", strategy.short, qty=qty)
strategy.exit("Exit Short", "Short", stop=close + stopDistance,
limit=close - 2 * stopDistance,
trail_points=3 * stopDistance,
trail_offset=1 * stopDistance)

// 8. Visuals
plot(ema, "EMA", color=color.blue)
plot(vwma, "VWMA", color=color.purple)
bgcolor(longCondition ? color.new(color.green, 90) : shortCondition ? color.new(color.red, 90) : na)

Read More

Share:

Latest News