
指数平滑ランダム指数異動戦略は,従来のランダム指数の基礎に,指数重量参数を加え,ランダム指数の感性を調整して取引信号を生成する.指数が超買区から反転したときには多し,超売区から反転したときには空になる.この戦略を最適化すると,非常に安定したトレンド追跡戦略になることができる.
指数平滑ランダム指数異動策の核心は,指数重量参数exである.従来のランダム指数の計算式は:
s=100 * (close - 最低价) / (最高价 - 最低价)
指数関数を追加すると,計算式は次のようになります.
exp= ex<10? (ex)/(10-ex) : 99
s=100 * (close - 最低价) / (最高价 - 最低价)
ks=s>50? math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50
:-math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50
expの値を調整すると,sksに対する影響力が変化し,expの値を大きくすると指標がより無感になり,expの値を小さくすると指標がより敏感になります.
ksが超買区から反転したときには買入シグナルが生じる. ksが超売区から反転したときには売出シグナルが生じる.
指数平滑ランダム指数異動戦略は,従来のランダム戦略と比較して,以下の利点がある.
指数平滑ランダム指数異動戦略には以下のリスクもあります.
指数平滑ランダム指数異動戦略は,以下のいくつかの点で最適化することができる.
指数平滑ランダム指標異動戦略は,ランダム指標の感性を調整することで,より信頼性の高い取引信号を生成する.この戦略は,中長線トレンドを効果的に追跡することができ,また,短線戦略として最適化することもできる.複合化とパラメータ最適化により,よりよい安定した利益が得られることが期待される.
/*backtest
start: 2023-01-11 00:00:00
end: 2024-01-17 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © faytterro
//@version=5
strategy("Exponential Stochastic Strategy", overlay=false, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
len=input.int(14, "length")
ex=input.int(2, title="exp", minval=1, maxval=10)
exp= ex<10? (ex)/(10-ex) : 99
s=100 * (close - ta.lowest(low, len)) / (ta.highest(high, len) - ta.lowest(low, len))
ks=s>50? math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50 :
-math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50
plot(ks, color= color.white)
bot=input.int(20)
top=input.int(80)
longCondition = ta.crossover(ks, bot) and bar_index>0
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = ta.crossunder(ks, top) and bar_index>0
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)
// strategy.close("My Long Entry Id")
alertcondition(longCondition, title = "buy")
alertcondition(shortCondition, title = "sell")
h1=hline(top)
h2=hline(bot)
h3=hline(100)
h4=hline(0)
fill(h1,h3, color= color.rgb(255,0,0,200-top*2))
fill(h2,h4, color= color.rgb(0,255,0,bot*2))