//@version=6 strategy( "LabotKripto Trend Helper Strategy", shorttitle = "LK Trend Strategy", overlay = true, initial_capital = 10000, pyramiding = 0, commission_type = strategy.commission.percent, commission_value = 0.10, slippage = 1, process_orders_on_close = true ) emaFastLength = input.int(21, "Gyors EMA", minval = 1) emaSlowLength = input.int(50, "Lassú EMA", minval = 1) emaTrendLength = input.int(200, "Trend EMA", minval = 1) rsiLength = input.int(14, "RSI periódus", minval = 1) rsiEntryLevel = input.float(50.0, "RSI reclaim szint", minval = 0, maxval = 100, step = 0.5) atrLength = input.int(14, "ATR periódus", minval = 1) atrStopMultiplier = input.float(2.0, "ATR stop szorzó", minval = 0.1, step = 0.1) useTakeProfit = input.bool(true, "Take profit használata") rewardRisk = input.float(2.0, "Célár R-szorzó", minval = 0.1, step = 0.1) startDate = input.time(timestamp("2024-01-01T00:00:00"), "Backtest kezdete") endDate = input.time(timestamp("2030-12-31T23:59:59"), "Backtest vége") emaFast = ta.ema(close, emaFastLength) emaSlow = ta.ema(close, emaSlowLength) emaTrend = ta.ema(close, emaTrendLength) rsiValue = ta.rsi(close, rsiLength) atrValue = ta.atr(atrLength) inDateRange = time >= startDate and time <= endDate trendFilter = close > emaFast and emaFast > emaSlow and emaSlow > emaTrend rsiReclaim = ta.crossover(rsiValue, rsiEntryLevel) longCondition = inDateRange and trendFilter and rsiReclaim and strategy.position_size == 0 var float stopPrice = na var float takePrice = na if longCondition stopPrice := close - atrValue * atrStopMultiplier tradeRisk = close - stopPrice takePrice := close + tradeRisk * rewardRisk strategy.entry("Long", strategy.long) if strategy.position_size > 0 and not na(stopPrice) strategy.exit( "Long exit", from_entry = "Long", stop = stopPrice, limit = useTakeProfit ? takePrice : na ) if strategy.position_size == 0 and strategy.position_size[1] > 0 stopPrice := na takePrice := na plot(emaFast, "EMA 21", color = color.new(color.green, 0), linewidth = 2) plot(emaSlow, "EMA 50", color = color.new(color.orange, 0), linewidth = 2) plot(emaTrend, "EMA 200", color = color.new(color.blue, 0), linewidth = 2) plot( strategy.position_size > 0 ? stopPrice : na, "Stop", color = color.new(color.red, 0), style = plot.style_linebr, linewidth = 2 ) plot( strategy.position_size > 0 and useTakeProfit ? takePrice : na, "Take profit", color = color.new(color.green, 0), style = plot.style_linebr, linewidth = 2 ) plotshape( longCondition, title = "Long belépő", style = shape.labelup, location = location.belowbar, color = color.new(color.green, 0), text = "LONG", textcolor = color.white, size = size.tiny ) alertcondition( longCondition, title = "LabotKripto Strategy Long", message = '{"source":"labotkripto","script":"trend_helper_strategy","symbol":"{{ticker}}","timeframe":"{{interval}}","side":"long","close":"{{close}}"}' )