
この戦略は,123反転と正数振動指標の2つの要因を組み合わせて,二要素駆動の定量取引を実現します.この戦略は,短期的な反転の機会を捉えながら,より長期の傾向を識別し,低リスクの過剰リターンを実現します.
第”部は123反転戦略である。この戦略は2日間の閉盘価格反転の特性を利用して,買入点を判断する。閉盘価格が2日連続で上昇し,緩やかなK線が50を下回ると,過正を誤算し,買入点を発生させる;閉盘価格が2日連続で下落し,急速なK線が50以上になると,反転を過正し,売り点を発生させる。
第2部は質数振動指標策である.この指標は,指定された価格区間の内で最も現在の価格に近い質数を計算し,現在の価格との差値を出力する.正値は現在の価格が質数上限に近いことを示し,負値は現在の価格が質数下限に近いことを示している.差値判断の傾向に応じて,123の反転信号と結合し,最終的な取引信号を生成する.
2つの子戦略の取引信号結合の原則は,同向信号の場合,実際の取引信号を生成し,異向信号の場合,暫定的にポジションを開かないことである.
この戦略は,短期的な反転効果を考慮し,長期的なトレンド特性を兼ね備えて,市場を複数の角度から判断し,戦略のリスク抵抗性を高める二重要因を組み合わせている.
単一のモメンタム戦略とは対照的に,この戦略は,突然の出来事が価格を短期的に跳ね上がらせるとき,反転因子を利用して,タイムリーにストップダストまたは反転開口を出し,イントラデイリスクを効果的に制御する.
単一の反転戦略とは異なり,この戦略は正数の振動指標を導入してトレンドの方向を判断し,反転取引が頻繁に起こることを避けるため,オーバートレードを防ぐことができます.
この戦略の最大のリスクは,2つの要因の間のシグナル衝突がある状況にある. 123の反転が超買い超売りの兆候を示し,反転シグナルを生じ,プラチナの振動指標がまだ傾向にあることを示している場合,直接の反転取引は損失を引き起こす可能性があります.
このリスクを制御するために,戦略は追加の判断論理を加え,両因子シグナルが同調したときにのみ実際の取引シグナルを生成する.しかし,これは,一部の取引機会を逃す可能性もある.
ストキャスティック指標のパラメータを最適化して,特定の指標に適した反転パラメータの組み合わせを見つける
質量振動指標の容差パーセントパラメータを最適化して,ノイズ取引を減らす
単方向市場損失拡大を防ぐために,損失抑制策を強化する
ポジション管理モジュールを追加し,異なる市場環境でポジションを調整
機械学習モデルに2要素の信号信頼性を加え,信号衝突の確率を低減する.
この戦略は,短期逆転因子と長期トレンド因子を組み合わせて,低リスクの定量取引を実現する.二重因子フィルターノイズ取引を有効に活用し,追加の判断論理制御リスクを設定することは,平穏な収益の実戦戦略である.その後,パラメータの最適化と機能拡張が継続され,戦略が実際の市場の特徴により適合する.
/*backtest
start: 2023-11-29 00:00:00
end: 2023-12-06 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 28/04/2021
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// Determining market trends has become a science even though a high number or people
// still believe it’s a gambling game. Mathematicians, technicians, brokers and investors
// have worked together in developing quite several indicators to help them better understand
// and forecast market movements.
//
// Developed by Modulus Financial Engineering Inc., the prime number oscillator indicates the
// nearest prime number, be it at the top or the bottom of the series, and outlines the
// difference between that prime number and the respective series.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
PrimeNumberOscillator(price, percent) =>
res = 0.0
res1 = 0.0
res2 = 0.0
for j = price to price + (price * percent / 100)
res1 := j
for i = 2 to sqrt(price)
res1 := iff(j % i == 0 , 0, j)
if res1 == 0
break
if res1 > 0
break
for j = price to price - (price * percent / 100)
res2 := j
for i = 2 to sqrt(price)
res2 := iff(j % i == 0 , 0, j)
if res2 == 0
break
if res2 > 0
break
res := iff(res1 - price < price - res2, res1 - price, res2 - price)
res := iff(res == 0, res[1], res)
res
PNO(percent) =>
pos = 0.0
xPNO = PrimeNumberOscillator(close, percent)
pos:= iff(xPNO > 0, 1,
iff(xPNO < 0, -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & Prime Number Oscillator", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Prime Number Oscillator ----")
percent = input(5, minval=0.01, step = 0.01, title="Tolerance Percentage")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPNO = PNO(percent)
pos = iff(posReversal123 == 1 and posPNO == 1 , 1,
iff(posReversal123 == -1 and posPNO == -1, -1, 0))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1 , 1, pos))
if (possig == 1 )
strategy.entry("Long", strategy.long)
if (possig == -1 )
strategy.entry("Short", strategy.short)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )