该策略仅基于Stochastic指标给出entry和exit的信号,属于典型的只做多不做空的Stochastic指标策略。它在超卖区K线上穿D线且收盘价超过前一日最高价时做多入场,在止盈或止损条件触发时平仓,简单易行。
该策略的主要逻辑是:
Stochastic K值在超卖区突破D值代表价格可能反转上涨。结合收盘价突破前一日最高价,可以有效确认入场信号。
EMA追踪止损可以锁定利润。K线在超买区出现卖出信号时,也选择止盈前平仓。
该策略仅做多,适合股市等单边行情品种, operatio简单,易于实施。
应对措施:
该策略可以从以下几个方面进行扩展:
该策略是一个纯Stochastic多头策略,使用指标识别超卖区入场,止损止盈结合控制风险。该策略简单实用,适合股市等单边行情品种。通过扩展做空机会、参数优化等维度,可以将策略优化成一个更全面可靠的系统。
/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-12 14:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version= 4
// see for original idea: http://www.enricomalverti.com/2016/12/stocastico/
// https://sauciusfinance.altervista.org
strategy(title="Pure Stochastic long only", overlay = false, max_bars_back=500)
// INPUTS & calculations
length = input(10, minval=1)
OverBought = input(80, minval = 50, step = 10)
OverSold = input(20, minval = 10, step = 5)
smoothK = input(7, minval=1)
smoothD = input(4, minval=1)
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)
// We keep EMA 7 (n period of stochastic /2) as target price
emaperiodf = input(5, minval = 1)
emaf = ema(close,emaperiodf)
entryl = k > d and k <= OverSold and close >= high[1]
/// Entry
strategy.entry("Long", true, when = entryl)
middle = (OverBought+OverSold)/2
close1= crossunder(close,emaf)// **close under EMA fast**
close2= k < d and k > middle
close3 = (k >= OverBought)
// exits.
strategy.close("Long", when = close1, comment="stop Ema Fast")
strategy.close("Long", when = close2, comment ="cross k&d")
strategy.close("Long", when = close3, comment = "high value of K")
plot(k, color=#0000FF, linewidth= 2, title="k Stoch")
plot(d, color=#787B86, linewidth= 1, title="d stoch signal")
plot(OverBought)
plot(OverSold)