CASHISKING CMF, EMA, SMA
This strategy generates trading signals based on the Chaikin Money Flow (CMF) indicator and Exponential Moving Averages (EMA). It first calculates the CMF values for a specified period, then uses two EMAs with different periods to smooth the CMF data. A buy signal is generated when the fast EMA crosses above the slow EMA, while a sell signal is generated when the fast EMA crosses below the slow EMA. The strategy also sets stop-loss and take-profit conditions to manage risk and lock in profits.
This strategy utilizes the Chaikin Money Flow indicator and Exponential Moving Averages, combining price and volume data with a primary focus on trend tracking. It also sets stop-loss and take-profit conditions to manage risk. The strategy’s advantages lie in its ability to comprehensively consider multiple factors and capture trends on different time scales. However, there is still room for optimization in parameter settings and trend recognition. In the future, the strategy’s stability and profitability can be further improved through dynamic parameter adjustment, incorporation of other indicators, optimization of stop-loss and take-profit, and implementation of position sizing.
/*backtest start: 2023-06-01 00:00:00 end: 2024-06-06 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("CASHISKING", overlay=false) // Kullanıcı girişleri ile parametreler cmfPeriod = input.int(200, "CMF Periyodu", minval=1) emaFastPeriod = input.int(80, "Hızlı EMA Periyodu", minval=1) emaSlowPeriod = input.int(160, "Yavaş EMA Periyodu", minval=1) stopLossPercent = input.float(3, "Stop Loss Yüzdesi", minval=0.1) / 100 stopGainPercent = input.float(5, "Stop Gain Yüzdesi", minval=0.1) / 100 // CMF hesaplama fonksiyonu cmfFunc(close, high, low, volume, length) => clv = ((close - low) - (high - close)) / (high - low) valid = not na(clv) and not na(volume) and (high != low) clv_volume = valid ? clv * volume : na sum_clv_volume = ta.sma(clv_volume, length) sum_volume = ta.sma(volume, length) cmf = sum_volume != 0 ? sum_clv_volume / sum_volume : na cmf // CMF değerlerini hesaplama cmf = cmfFunc(close, high, low, volume, cmfPeriod) // EMA hesaplamaları emaFast = ta.ema(cmf, emaFastPeriod) emaSlow = ta.ema(cmf, emaSlowPeriod) // Göstergeleri çiz plot(emaFast, color=color.blue, title="EMA 23") plot(emaSlow, color=color.orange, title="EMA 50") // Alım ve Satım Sinyalleri crossOverHappened = ta.crossover(emaFast, emaSlow) crossUnderHappened = ta.crossunder(emaFast, emaSlow) // Kesişme sonrası bekleme sayacı var int crossOverCount = na var int crossUnderCount = na if (crossOverHappened) crossOverCount := 0 if (crossUnderHappened) crossUnderCount := 0 if (not na(crossOverCount)) crossOverCount += 1 if (not na(crossUnderCount)) crossUnderCount += 1 // Alım ve Satım işlemleri if (crossOverCount == 2) strategy.entry("Buy", strategy.long) crossOverCount := na // Sayaç sıfırlanır if (crossUnderCount == 2) strategy.entry("Sell", strategy.short) crossUnderCount := na // Sayaç sıfırlanır // Stop Loss ve Stop Gain hesaplama longStopPrice = strategy.position_avg_price * (1 - stopLossPercent) shortStopPrice = strategy.position_avg_price * (1 + stopLossPercent) longTakeProfitPrice = strategy.position_avg_price * (1 + stopGainPercent) shortTakeProfitPrice = strategy.position_avg_price * (1 - stopGainPercent) // Stop Loss ve Stop Gain'i uygula if (strategy.position_size > 0 and strategy.position_avg_price > 0) strategy.exit("Stop", "Buy", stop=longStopPrice, limit=longTakeProfitPrice) else if (strategy.position_size < 0 and strategy.position_avg_price > 0) strategy.exit("Stop", "Sell", stop=shortStopPrice, limit=shortTakeProfitPrice)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6