
Esta estratégia é chamada de estratégia de negociação de opções periódicas baseada em indicadores estocásticos. Ela usa indicadores de choque estocásticos para identificar os pontos de entrada e saída potenciais de negociações de opções.
A estratégia usa a linha Stochastic %K de 14 períodos e a média móvel simples de 3 períodos para traçar a linha Stochastic %D. Quando a linha%K quebra a linha%D a partir de um nível baixo, é considerada um sinal de otimismo; Quando a linha%K quebra a linha%D a partir de um nível alto, é considerada um sinal de otimismo.
Entradas múltiplas: faça mais quando a linha %K atravessa a linha %D a partir de um nível abaixo de 20 Exit Multicapital: quando a linha %K quebra a linha %D a partir de um nível acima de 80 Entrada em branco: faça vazio quando a linha% K quebrar a linha% D a partir de um nível acima de 80 Saída em branco: quando a linha% K quebra a linha% D a partir de um nível abaixo de 20
Esta estratégia usa o princípio de super-compra e super-venda do indicador estocástico para identificar o momento de entrada em potencial. Em comparação com a estratégia tradicional de rastreamento de tendências, ela pode capturar um mercado maior em pontos de mudança de mercado.
/*backtest
start: 2024-01-04 00:00:00
end: 2024-02-03 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Stochastic Weekly Options Strategy", overlay=true, shorttitle="WOS")
// Stochastic settings
K = ta.stoch(close, high, low, 14)
D = ta.sma(K, 3)
// Entry and exit conditions
longEntry = ta.crossover(K, 20)
longExit = ta.crossunder(K, 80)
shortEntry = ta.crossunder(K, 80)
shortExit = ta.crossover(K, 20)
// Strategy execution
strategy.entry("Long", strategy.long, when=longEntry)
strategy.close("Long", when=longExit)
strategy.entry("Short", strategy.short, when=shortEntry)
strategy.close("Short", when=shortExit)
// Alert conditions
alertcondition(longEntry, title="Long Entry Alert", message="Stochastic bullish crossover! Consider buying a call option.")
alertcondition(longExit, title="Long Exit Alert", message="Stochastic bearish crossover! Consider selling the call option.")
alertcondition(shortEntry, title="Short Entry Alert", message="Stochastic bearish crossover! Consider buying a put option.")
alertcondition(shortExit, title="Short Exit Alert", message="Stochastic bullish crossover! Consider selling the put option.")
// Plotting shapes for buy and sell signals
plotshape(longEntry, title="Calls Entry Label", color=color.new(color.green, 25),
textcolor=color.white, style=shape.triangleup, text="Calls", location=location.belowbar, size=size.small)
plotshape(longExit, title="Calls Exit Label", color=color.new(color.green, 25),
textcolor=color.white, style=shape.circle, text="Exit", location=location.belowbar, size=size.small)
plotshape(shortEntry, title="Puts Entry Label", color=color.new(color.red, 25),
textcolor=color.white, style=shape.triangledown, text="Puts", location=location.abovebar, size=size.small)
plotshape(shortExit, title="Puts Exit Label", color=color.new(color.red, 25),
textcolor=color.white, style=shape.circle, text="Exit", location=location.abovebar, size=size.small)
// Plotting
plot(K, color=color.blue, title="Stochastic %K")
plot(D, color=color.red, title="Stochastic %D")
hline(80, "Overbought", color=color.red)
hline(20, "Oversold", color=color.green)