Chiến lược SMA đảo ngược V

Tác giả:ChaoZhang, Ngày: 2024-02-18 15:04:34
Tags:

img

Tổng quan

Chiến lược V-Reversal SMA tính toán sự khác biệt tuyệt đối 14 ngày giữa giá cao nhất và giá thấp nhất của ngày trước, và sự khác biệt tuyệt đối 14 ngày giữa giá thấp nhất và giá cao nhất của ngày trước. Sau đó, nó tính toán trung bình di chuyển đơn giản 14 ngày của họ để tạo ra đường cong VI + và VI-. Một tín hiệu mua được tạo ra khi VI + vượt qua VI-. Một tín hiệu bán được tạo ra khi VI- vượt dưới VI +.

Nguyên tắc

Các chỉ số cốt lõi của chiến lược này là VI + và VI-. VI + phản ánh động lực tăng trong khi VI- phản ánh động lực giảm. Các công thức tính toán cụ thể như sau:

VMP = SUM(ABS(HIGH - LOW[1]),14)  
VMM = SUM(ABS(LOW - HIGH[1]),14)
STR = SUM(ATR(1),14)
VI+ = VMP/STR
VI- = VMM/STR

Để loại bỏ dao động trong đường cong, các đường trung bình di chuyển đơn giản 14 ngày được tính trên VI + và VI- để có được SMA ((VI +) và SMA ((VI-). Một tín hiệu tăng được tạo ra khi SMA ((VI +) vượt qua SMA ((VI-). Một tín hiệu giảm được tạo ra khi SMA ((VI-) vượt qua dưới SMA ((VI+).

Ngoài ra, chiến lược cũng kết hợp tình trạng tăng và giảm của VI + và VI- để đánh giá xu hướng và lọc các tín hiệu, chỉ đi dài khi xu hướng giảm và chỉ đi ngắn khi xu hướng tăng.

Phân tích lợi thế

Bằng cách kết hợp trạng thái xu hướng và đường chéo vàng / chết của chỉ số VI, chiến lược này có thể lọc hiệu quả các tín hiệu sai và cải thiện lợi nhuận.

Phân tích rủi ro

Những rủi ro chính của chiến lược này là:

  1. Chỉ số VI có thể tạo ra các tín hiệu gây hiểu lầm trong một số giai đoạn nhất định.

  2. Các thị trường có chi phí giao dịch và trượt cao không phù hợp với chiến lược này vì nó sẽ làm giảm đáng kể lợi nhuận.

Hướng dẫn tối ưu hóa

Chiến lược có thể được tối ưu hóa trong các khía cạnh sau:

  1. Tối ưu hóa các thông số của chỉ số VI để tìm ra sự kết hợp thông số tốt nhất.

  2. Sử dụng các phương pháp học máy để tự động xác định các tín hiệu gây hiểu lầm và cải thiện chất lượng tín hiệu.

  3. Tối ưu hóa các cơ chế thoát với dừng lỗ và quản lý tiền để kiểm soát lỗ giao dịch duy nhất.

  4. Tối ưu hóa lựa chọn sản phẩm giao dịch tập trung vào các thị trường có chi phí giao dịch thấp hơn.

Kết luận

Chiến lược V-Reversal SMA xác định tín hiệu giao dịch bằng cách tính toán các chỉ số VI + và VI- và kết hợp trạng thái xu hướng. Đây là một chiến lược theo xu hướng tương đối đáng tin cậy. Sức mạnh của nó nằm ở chất lượng tín hiệu cao và khả năng lọc tiếng ồn.


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
//@author=SIDD
//Sidd-Vortex strategy is using Vortex formula  to generate 4 signals Bullish1 Bullish2 and Bearish1 Bearish2.

//Bullish1 signal is getting generated when smooth ma of VIP is crossing over smooth ma of VIM and smooth VIM is falling from previous bar smooth VIM

//Bullish2 signal is getting generated when smooth ma of VIP is crossing over smooth ma of VIM and smooth VIP is rising from previous bar smooth VIP

//Bearish1 signal is getting generated when smooth ma of VIM is crossing over smooth ma of VIP and smooth VIP is falling from previous bar smooth VIP

//Bearish2 signal is getting generated when smooth ma of VIM is crossing over smooth ma of VIP and smooth VIM is rising from previous bar smooth VIM

//This strategy can be converted into study un-commenting the plotshape and 15th line strategy replace with study and overlay=false

strategy(title = "SIDD-Vortex", shorttitle="SIDD-VORTEX", format=format.price, precision=4,overlay=true)
period_ = input(14, title="Period", minval=2)
len = input(14, minval=1, title="WMA Length")

VMP = sum( abs( high - low[1]), period_ ) // sum of absolute current high and previous low with 14 period default
VMM = sum( abs( low - high[1]), period_ ) // sum of absolute current low and previous high with 14 period default
STR = sum( atr(1), period_ )  //sum of daily atr for 14 days
VIP = VMP / STR
VIM = VMM / STR

simpleMAVIP=wma(VIP, len) 
smmaVIP = 0.0
smmaVIP := na(smmaVIP[1]) ? simpleMAVIP : (smmaVIP[1] * (len - 1) + VIP) / len // finding the Smoothing average 

simpleMAVIM=wma(VIM, len) 
smmaVIM = 0.0
smmaVIM := na(smmaVIM[1]) ? simpleMAVIM : (smmaVIM[1] * (len - 1) + VIM) / len // finding the Smoothing average 


risingVIP = rising(smmaVIP, 1)
fallingVIP = falling(smmaVIP, 1)

lineColorVIP = smmaVIP > 0.95 and risingVIP  ? color.lime : smmaVIP > 0.95 ? #d65240 : smmaVIP < 0.95 and fallingVIP ? color.red : color.olive

risingVIM = rising(VIM, 1)
fallingVIM = falling(VIM, 1)

lineColorVIM = smmaVIM > 0.95 and risingVIM  ? color.red : smmaVIM > 0.95 ? color.olive : smmaVIM < 0.95 and fallingVIM ? color.lime : #d65240

plot(VIP, title="VI +", color=lineColorVIP)
plot(VIM, title="VI -", color=lineColorVIM) 

longCondition = crossover(smmaVIP,smmaVIM)
shortCondition = crossover(smmaVIM,smmaVIP)


if (longCondition and fallingVIM)
    strategy.entry("Bullish1", strategy.long)
if (shortCondition and fallingVIP)
    strategy.entry("Bearish1", strategy.short)

if (longCondition and risingVIP)
    strategy.entry("Bullish2", strategy.long)
if (shortCondition and risingVIM)
    strategy.entry("Bearish2", strategy.short)
    
//plotshape(longCondition and fallingVIM, color=color.lime, location=location.belowbar, style=shape.triangleup,size= size.large,text="Bullish",offset=0,textcolor=color.white)
//plotshape(longCondition and risingVIP, color=color.lime, location=location.belowbar, style=shape.labelup,size= size.large,text="Bullish",offset=0,textcolor=color.white)
//plotshape(Diff > 0 and direction>0, color=color.lime, location=location.belowbar, style=shape.arrowup,size= size.normal,offset=0)
    
//plotshape(shortCondition and fallingVIP  , color=color.red, location=location.abovebar, style=shape.triangledown, size= size.large,text="Bearish",offset=0,textcolor=color.white)
//plotshape( shortCondition and risingVIM  , color=color.red, location=location.abovebar, style=shape.labeldown, size= size.large,text="Bearish",offset=0,textcolor=color.white)



//band1 = hline(1.0  , title="Upper Line", linestyle=hline.style_dashed, linewidth=3, color=color.red)
//band0 = hline(0.5, title="Lower Line", linestyle=hline.style_dashed, linewidth=3, color=color.lime)
//fill(band1, band0, color=color.purple, transp=70)




Thêm nữa