
이것은 암호화폐 시장에 대한 설계된 일반적인 거래 전략이며, 그 목적은 암호화폐 시장의 큰 환경을 보고, 더 나은 진입 시기를 찾고, 중장 긴 줄을 보유하는 것이다. 전략은 MFI 지표, STOCH 지표, VWMA 지표와 같은 여러 가지 기술 지표를 통합하여 숨겨진 반향을 판단하여 잠재적인 트렌드 역전 기회를 포착한다.
이 전략은 두 가지 입시 논리를 포함하고 있습니다.
MFI 숨겨진 이탈 + STOCH 필터: MFI가 숨겨진 이탈을 형성할 때, 즉 가격이 혁신이 높지만 MFI가 혁신이 높지 않을 때, 우리는 이것이 잠재적인 트렌드 반전 신호라고 생각합니다. 그러나 가짜 신호를 피하기 위해 우리는 필터 조건으로 추가적으로 STOCH> 50%를 추가합니다.
STOCH/MFI 트렌드 시스템: STOCH>50%이고 MFI가 50선을 아래에서 위로 넘어서면, 시장 추세가 형성되고 있음을 나타냅니다. 이 시점에 입장은 더 나은 위험 수익을 얻을 수 있습니다.
트렌드 판단의 정확성을 보장하기 위해, 우리는 또한 VWMA와 SMA를 기반으로 한 트렌드 시스템을 구축했습니다. 상위 두 시스템은 트렌드 신호를 발산합니다.
ATR 지표는 시장이 흔들리는 상태인지 판단하는 데 사용됩니다. 우리는 흔들리는 시장에서 MFI 숨겨진 이탈을 찾아 개입하는 것을 우선으로합니다.
이 전략은 시장 구조를 판단하는 여러 지표를 통합하여 대부분의 잡음을 피할 수 있습니다. 숨겨진 뒤떨어진 시스템은 흔들림과 조정 단계에서 높은 확률과 위험 제어 가능한 진입 기회를 제공합니다. 반면 STOCH/MFI 트렌드 시스템은 명확한 추세에서 추가 수익을 얻을 수 있습니다.
이 전략의 가장 큰 위험은 판단에서 벗어나는 것을 숨기는 것이 항상 신뢰할 수 없다는 것입니다. 그것은 단지 시장의 감정이 변하는 것을 반영하고 가격의 즉각적인 반전을 보장하지 않습니다. 또한, STOCH 및 기타 지표의 설정이 부적절하면 흐름을 놓치거나 거짓 신호를 생성 할 수 있습니다. 마지막으로, 중지 중지 손실의 설정이 너무 급진적이면, 소규모는 너무 자주 중단되고 재개점이 발생하여 수익률에 영향을 줄 수 있습니다.
우리는 추세와 시장 상태를 추가로 판단하여 신호를 필터링하고, 상술한 위험을 줄이기 위해 약간의 스톱 스톱 손실 수준을 허용합니다.
이 전략은 더 발전할 수 있는 여지가 있으며, 다음과 같은 부분들에 집중되어 있습니다.
MFI와 STOCH의 파라미터 설정을 최적화하여 숨겨진 판단의 정확도를 향상시킵니다.
시장 상황을 판단하는 기계 학습 모델을 추가하고, 최적의 변수를 결정하는 재검토
동적 스톱 손실을 시도하여 수익을 보장하면서 위험을 더욱 제어합니다.
다양한 암호화폐 품종의 차이를 테스트하고 개인화 매개 변수를 설정합니다.
주식 선택 모듈을 추가하여 기술적으로 우수한 주식들에 대한 전략의 집중을 강화합니다.
위와 같은 몇 가지 최적화를 통해 전략의 안정성과 수익률을 더욱 높일 수 있을 것으로 기대할 수 있습니다.
이것은 매우 실용적인 암호화폐 거래 전략이다. 그것은 여러 가지 기술 지표를 올바르게 사용하여 시장 구조를 판단하고 위험을 통제 할 수 있다는 전제 하에서 더 나은 수익을 얻는다. 주요 문제는 숨겨진 이탈 판단이 항상 정확하지 않다는 것입니다. 우리는 일련의 필터를 통해이 문제를 완화했습니다.
/*backtest
start: 2023-11-18 00:00:00
end: 2023-12-18 00:00:00
period: 1h
basePeriod: 15m
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/
// © kifier
//@version=4
strategy("Kifier's MFI/STOCH Hidden Divergence/Trend Beater", shorttitle = "Kifier's MFI/STOCH", overlay=false, margin_long=100, margin_short=100, default_qty_type = strategy.percent_of_equity, default_qty_value = 95, max_boxes_count = 500)
//Values
enb_date = input(false ,"Enable Date Range?", type = input.bool, inline = "1")
enb_current = input(true ,"Today as End Date" , type = input.bool, inline = "1")
i_start_date = input(timestamp("01 Jan 2021 00:00 +0300") ,"Start Date" , type=input.time)
i_end_date = input(timestamp("16 July 2021 00:00 +0300") ,"End Date" , type=input.time)
time_check = true
i_vwma_length = input(50, "VWMA Length" ,type = input.integer, group = "Indicator Settings", inline = "2")
i_sma_length = input(50, "SMA Length" ,type = input.integer, group = "Indicator Settings", inline = "2")
i_stoch_length = input(28, "Stoch Length" ,type = input.integer, group = "Indicator Settings", inline = "3")
i_mfi_length = input(7 , "MFI Length" ,type = input.integer, group = "Indicator Settings", inline = "3")
i_obv_length = input(100, "OBV Length" ,type = input.integer, group = "Indicator Settings")
i_atr_len = input(100, "ATR Ranging-trend len" ,type = input.integer, group = "Indicator Settings", tooltip = "This is the length of the ATR Emas that check when the market in a general trend or is just ranging")
i_div_price = input(5 ,"Price Divergant Pivots" ,type = input.integer, group = "Divergance Settings")
i_inacc = input(0.05 ,"Price Inaccuracy" ,type = input.float , group = "Divergance Settings")
i_div_length = input(3 ,"Divergance Valid Period" ,type = input.integer, group = "Divergance Settings")
i_mfi_left = input(5 ,"MFI Left/Right Pivots" ,type = input.integer, group = "Divergance Settings", inline = "4")
i_mfi_right = input(2 ,"" ,type = input.integer, group = "Divergance Settings", inline = "4")
tp_percentage = input(10 , "TP Percentage" ,type = input.float , group = "Exit Settings")/100
_inacc = input(0.03, "Support Inaccuracy" ,type = input.float, step = 0.01, group = "Exit Settings")
enb_stoch_mfi = input(true, "Use Stoch/MFI Trend" , type = input.bool, group = "Individual Entries")
enb_stoch_mfi_div = input(true, "Use Stoch/MFI Divergance ", type = input.bool, group = "Individual Entries")
c_mfi = input(color.yellow ,"MFI/STOCH Colour " , type = input.color, group = "Indicator Colours", inline = "os")
c_stoch = input(color.silver ,"" , type = input.color, group = "Indicator Colours", inline = "os")
c_buy = input(color.green ,"Buy/Sell Colour " , type = input.color, group = "Indicator Colours", inline = "pos")
c_sell = input(color.red ,"" , type = input.color, group = "Indicator Colours", inline = "pos")
c_flat = input(color.blue ,"Flat/Trending Colours" , type = input.color, group = "Indicator Colours", inline = "trend")
c_longtrend = input(color.green ,"" , type = input.color, group = "Indicator Colours", inline = "trend")
//Global Variables
var float tpprice = na
f_c_gradientAdvDec(_source, _center, _c_bear, _c_bull) =>
var float _maxAdvDec = 0.
var float _qtyAdvDec = 0.
bool _xUp = crossover(_source, _center)
bool _xDn = crossunder(_source, _center)
float _chg = change(_source)
bool _up = _chg > 0
bool _dn = _chg < 0
bool _srcBull = _source > _center
bool _srcBear = _source < _center
_qtyAdvDec :=
_srcBull ? _xUp ? 1 : _up ? _qtyAdvDec + 1 : _dn ? max(1, _qtyAdvDec - 1) : _qtyAdvDec :
_srcBear ? _xDn ? 1 : _dn ? _qtyAdvDec + 1 : _up ? max(1, _qtyAdvDec - 1) : _qtyAdvDec : _qtyAdvDec
_maxAdvDec := max(_maxAdvDec, _qtyAdvDec)
float _transp = 100 - (_qtyAdvDec * 100 / _maxAdvDec)
var color _return = na
_return := _srcBull ? color.new(_c_bull, _transp) : _srcBear ? color.new(_c_bear, _transp) : _return
//Simple Sup/Res
var float _pH = na
var float _pL = na
_ph = pivothigh(high,20,20)
_pl = pivotlow(low,20,20)
_high_inacc = _inacc * high
_low_inacc = _inacc * low
if _ph
_pH := high
if (high-_high_inacc) > _pH and _ph
_pH := high
_pH := nz(_pH)
if _pl
_pL := low
if (low+_low_inacc) < _pL[1]
_pL := low
_pL := nz(_pL)
broke_res = iff(crossover(close, _pH), true, false)
//Indicator Initialisation
s_stoch = stoch(close, high, low, i_stoch_length)
s_vwma = vwma(close,i_vwma_length)
s_sma = sma(close,i_sma_length)
//MONEY FLOW + BBW
atr1 =ema((atr(14)/close),i_atr_len/2)
atr2 =ema((atr(14)/close), i_atr_len)
is_ranging = iff(atr1 < atr2, true, false)
s_mfi = mfi(close,i_mfi_length)
overTop = iff(s_mfi >= 90, true, false)
underBot = iff(s_mfi <= 10, true, false)
//Price Divergance
ph = pivothigh(high, i_div_price,i_div_price)
pl = pivotlow(low,i_div_price,i_div_price)
var float pH = 0.0
var float pL = 0.0
high_acc = high * (i_inacc)
low_acc = low * i_inacc
if (high-high_acc) > pH or (high+high_acc < pH) and ph
pH := high
pH := nz(pH)
if (low+low_acc) < pL or (low-low_acc > pL) and pl
pL := low
pL := nz(pL)
higher_low = false
lower_low = false
//Filter out innacurate
if ph or pl
if pL < pL[1]
lower_low := true
if pL > pL[1]
higher_low := true
//MFI Divergance
mh = pivothigh(s_mfi, i_mfi_left,i_mfi_right)
ml = pivotlow(s_mfi, i_mfi_left,i_mfi_right)
bl = bar_index
var float mH = 0.0
var float mL = 0.0
var int bL = 0
if mh
mH := highest(nz(mh),i_mfi_left)
mH := nz(mH)
if ml
bL := bar_index
mL := ml
mL := nz(mL)
higher_low_m = false
lower_low_m = false
if ml
if mL < mL[1]
lower_low_m := true
if mL > mL[1]
higher_low_m := true
//Combintion
var int price_range = na
var int rsi_range = na
var int mfi_range = na
//Higher low on price, lower low on rsi, then check with stoch
mfi_div_bullish = iff(higher_low and higher_low_m, true, false)
if mfi_div_bullish
price_range := 0
rsi_range := 0
//VWMA/SMA/OBV
_src = s_vwma-s_sma
sd_src = stdev(_src,14)
pooled_src = (_src/sd_src)*2
sd_s_vwma = stdev(s_vwma,14)
sd_s_sma = stdev(s_sma,14)
longTrend = obv > ema(obv,100) and is_ranging == false
crossOver = crossover(s_vwma , s_sma)
crossingOver = (s_vwma > s_sma) and (close >= s_vwma)
crossUnder = crossunder(s_vwma, s_sma)
crossingUnder = (s_vwma < s_sma) and (close <= s_vwma)
hist_color = f_c_gradientAdvDec(s_vwma-s_sma, (s_vwma-s_sma)/2, color.new(c_sell,90), color.new(c_buy,80))
//Strategy Entries
mfi_stoch_trend = iff(enb_stoch_mfi, iff(s_stoch >= 50 and crossover(s_mfi, 50) and crossingOver and longTrend and is_ranging == false, true, false), false)
var buy_counter_rsi = 0
var buy_counter_mfi = 0
mfi_div = iff(enb_stoch_mfi_div, iff(mfi_div_bullish and crossingOver and s_stoch >= 50 and is_ranging, true, false), false)
if mfi_div
buy_counter_mfi := bar_index + 5
mfi_divergent_buy = iff(bar_index <= buy_counter_mfi and strategy.position_size == 0, true, false)
//Strategy Entries
order_fired = false
var float previousRes = 0.0
tpprice := strategy.position_avg_price * (1+tp_percentage)
if time_check
if mfi_stoch_trend
strategy.entry("Buy", true, comment = "[B] STOCH/MFI")
order_fired := true
if mfi_divergent_buy
strategy.entry("Buy", true, comment = "[B] MFI Hidden Divergance")
order_fired := true
if order_fired
previousRes := _pL
if strategy.position_size > 0
strategy.exit("Buy", limit = tpprice, comment = "TP")
if close <= previousRes
strategy.exit("Buy", stop = previousRes, comment = "SL")
//Drawings
hline(0, "Base", color.white)
hline(100, "Max", color.white)
p_stoch = plot(s_stoch, color = c_stoch)
p_mfi = plot(s_mfi, color = c_mfi)
hline(70, "Top Line")
p_mid = plot(50, "Mid Line", color.new(color.white,100))
hline(50, "Mid Line")
hline(30, "Bot Line")
fill(p_stoch, p_mid, color.new(c_stoch, 60))
plotshape(crossOver ? 5 : crossUnder ? -5 : na, style = shape.square, color = crossOver ? c_buy : crossUnder ? c_sell : na, size = size.tiny, location = location.absolute)
plot((_src/sd_src)*2, color = hist_color, style = plot.style_histogram)
//Boxes
// var string same = ""
// var box _box = na
// if longTrend and is_ranging == false and same != "longtrend"
// same := "longtrend"
// _box := box.new(bar_index, 105, bar_index, 100, bgcolor = c_longtrend,border_color = color.new(color.white, 100))
// else if is_ranging and same != "isranging"
// same := "isranging"
// _box := box.new(bar_index, 105, bar_index, 100, bgcolor = c_flat,border_color = color.new(color.white, 100))
// if not na(_box)
// box.set_right(_box,bar_index)
// //Div Lines
// var line _line = na
// if mfi_divergent_buy
// _line = line.new(bL[1] -6, s_mfi[bar_index-bL[1]], bar_index + 6, s_mfi, color = color.green, width = 3)