
Chiến lược này là một chiến lược đa yếu tố tự điều chỉnh kết hợp với trung bình di chuyển của Hull, chỉ số chuyển hướng của ngư dân và chỉ số kênh hàng hóa. Nó có thể nhận ra xu hướng một cách thông minh, tự động điều chỉnh các tham số để phù hợp với các giống và chu kỳ khác nhau.
Lý luận cốt lõi của chiến lược này dựa trên sự chuyển đổi của ngư dân sang các chỉ số của ngư dân để đánh giá vào và ra khỏi. Chỉ số chuyển đổi của ngư dân kết hợp các lợi thế của các chỉ số di chuyển trung bình và dao động, có thể đánh giá chính xác hơn các điểm chuyển hướng.
Chiến lược này được tính toán đầu tiên bằng phương tiện di chuyển của Hull và chỉ số chuyển hướng của ngư dân. Sau đó, kết hợp với sự phán đoán hỗ trợ của chỉ số đường hàng hóa, tạo ra các điều kiện tham gia.
Điều kiện xuất phát ngược lại, giao dịch nhị phân bằng giao dịch nhị phân bằng giao dịch nhị phân; giao dịch nhị phân bằng giao dịch nhị phân bằng giao dịch nhị phân bằng giao dịch nhị phân. Như vậy, sử dụng giao dịch giữa các chỉ số để nắm bắt điểm biến xu hướng.
Ưu điểm lớn nhất của chiến lược này là khả năng tự điều chỉnh nhiều yếu tố. Nó sử dụng lợi thế của các chỉ số di chuyển, động và xu hướng đồng thời để có thể hoạt động tốt trong thị trường giảm giá. Các thiết lập tham số có thể được điều chỉnh tùy theo giống và chu kỳ để thực hiện tự điều chỉnh.
Ngoài ra, các chiến lược đã thêm một cơ chế dừng lỗ tự động. Khi giá quay trở lại Hull Moving Average, sẽ tự động dừng lỗ. Điều này làm giảm đáng kể rủi ro mất mát của chiến lược.
Rủi ro lớn nhất của chiến lược này là tạo ra các tín hiệu sai lệch giữa các chỉ số. Khi giá xuất hiện trong một vùng biến động, các chỉ số có thể tạo ra một số chéo không cần thiết. Điều này có thể dẫn đến các bước nhập và dừng không cần thiết.
Cách giải quyết là điều chỉnh các tham số chỉ số một cách thích hợp, lọc một số tín hiệu nhỏ. Hoặc kết hợp nhiều chỉ số phụ trợ để xác nhận. Ví dụ: tăng chỉ số giao dịch để xác định tín hiệu thực.
Chiến lược này có thể được tối ưu hóa theo các hướng sau:
Thêm thuật toán học máy để tối ưu hóa các tham số tự động. Các tham số chỉ số có thể được điều chỉnh theo thời gian thực dựa trên đào tạo dữ liệu lịch sử.
Thêm nhiều bộ chỉ số để xếp hạng, sử dụng nhiều chiến lược ra quyết định và tăng độ chính xác của quyết định.
Tăng cơ chế xác nhận đột phá, sử dụng các mức giá quan trọng và các kênh để xác nhận lại, tránh sai lệch.
Thêm mô-đun đánh giá rủi ro, có thể tự động điều chỉnh kích thước vị trí và mức dừng lỗ theo môi trường thị trường.
Toàn bộ chiến lược này là một khung tự điều chỉnh đa yếu tố rất tốt. Nó kết hợp với phán đoán xu hướng của đường trung bình di chuyển, phán đoán mua bán quá mức của chỉ số chấn động và ứng dụng chéo của chỉ số xu hướng, tạo thành một cơ chế nhập cảnh và xuất cảnh hoàn chỉnh. Nếu có thể tối ưu hóa hơn nữa, thêm các thành phần tự điều chỉnh và thông minh, nó sẽ trở thành một sản phẩm chiến lược có giá trị thương mại cao.
/*backtest
start: 2023-01-09 00:00:00
end: 2024-01-15 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is free to copy/paste/use. no permission required. just do it!
// © @SeaSide420
//@version=4
strategy(title="Hull Fisher",currency="USD",default_qty_type=strategy.percent_of_equity,default_qty_value=100,commission_type=strategy.commission.percent,commission_value=0.25)
//=================================== Inputs =========================================================
period =input(title="HullMA Length", type=input.integer, defval=14, minval=2)
length =input(9, minval=1, title="Signal Length")
line1 = input(5, minval=2, title="Top Line")
line5 = input(-5, maxval=-2, title="Bottom Line")
price = input(open, type=input.source, title="Price data")
entry1 =input(true,type=input.bool, title="Open when HullFisher crossover outside Lines")
entry2 =input(true,type=input.bool, title="Open when HullFisher past zero")
useHMA =input(true,type=input.bool, title="Include Hull_moving_average")
useCCI =input(true,type=input.bool, title="Include Commodity_channel_index")
fishclose=input(true,type=input.bool, title="Close order when Fisher crossover")
HMAclose=input(true,type=input.bool, title="Close order when Hull crossover")
//================================ Calculations ======================================================
HMA = hma(price,period)
HMA2 = HMA[1]
high_ = highest(HMA, length)
low_ = lowest(HMA, length)
round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val
value = 0.0
value := round_(.66 * ((HMA - low_) / max(high_ - low_, .001) - .5) + .67 * nz(value[1]))
value1 = 0.0
value1 := .5 * log((1 + value) / max(1 - value, .001)) + .5 * nz(value1[1])
value2 = value1[1]
CCI1 = cci(price,period)
CCI2 = CCI1[1]
line2 = line1/2
line4 = line5/2
//================================ Draw Plots =======================================================
colorchange1 =CCI1>CCI2?color.lime:color.red
colorchange2 =value1>value2?color.lime:color.red
a =plot(line1,style=plot.style_line,color=color.red,transp=50,linewidth=2,title="Top Line")
b =plot(line2,style=plot.style_line,color=color.red,transp=50,linewidth=2,title="Upper Line")
c =plot(0,style=plot.style_line,color=color.black,transp=50,linewidth=2,title="Middle Line")
d =plot(line4,style=plot.style_line,color=color.lime,transp=50,linewidth=2,title="Lower Line")
e =plot(line5,style=plot.style_line,color=color.lime,transp=50,linewidth=2,title="Bottom Line")
f =plot(value1, color=color.black,transp=50,linewidth=2, title="Value 1")
g =plot(value2, color=color.black,transp=50,linewidth=2, title="Value 2")
h =plot(CCI1/50,style=plot.style_area, color=colorchange1,transp=50,linewidth=2, title="CCI")
fill(f,g,color=colorchange2,transp=20,title="Color fill")
plot(cross(value1, value2) ? value1 : na, style=plot.style_circles, color=color.black, linewidth=10)
plot(cross(value1, value2) ? value1 : na, style=plot.style_circles, color=color.white, linewidth=8)
plot(cross(value1, value2) ? value1 : na, style=plot.style_circles, color=colorchange2, linewidth=5)
//============================= Entry conditions ====================================================
// Outside Lines crossover or zero lines crossover
LongCondition1 = value1>value2 and value1<line5 and entry1 and not useCCI and not useHMA
ShortCondition1 = value1<value2 and value1>line1 and entry1 and not useCCI and not useHMA
LongCondition2 = value1>value2 and value1>0 and entry2 and not useCCI and not useHMA
ShortCondition2 = value1<value2 and value1<0 and entry2 and not useCCI and not useHMA
// Use CCI
LongCondition3 = value1>value2 and value1<line5 and CCI1>CCI2 and entry1 and useCCI and not useHMA
ShortCondition3 = value1<value2 and value1>line1 and CCI1<CCI2 and entry1 and useCCI and not useHMA
LongCondition4 = value1>value2 and value1>0 and CCI1>CCI2 and entry2 and useCCI and not useHMA
ShortCondition4 = value1<value2 and value1<0 and CCI1<CCI2 and entry2 and useCCI and not useHMA
// Use HMA
LongCondition5 = value1>value2 and value1<line5 and CCI1>CCI2 and HMA>HMA2 and entry1 and not useCCI and useHMA
ShortCondition5 = value1<value2 and value1>line1 and CCI1<CCI2 and HMA<HMA2 and entry1 and not useCCI and useHMA
LongCondition6 = value1>value2 and value1>0 and CCI1>CCI2 and HMA>HMA2 and entry2 and not useCCI and useHMA
ShortCondition6 = value1<value2 and value1<0 and CCI1<CCI2 and HMA<HMA2 and entry2 and not useCCI and useHMA
//Use CCI & HMA
LongCondition7 = value1>value2 and value1<line5 and CCI1>CCI2 and HMA>HMA2 and entry1 and useCCI and useHMA
ShortCondition7 = value1<value2 and value1>line1 and CCI1<CCI2 and HMA<HMA2 and entry1 and useCCI and useHMA
LongCondition8 = value1>value2 and value1>0 and CCI1>CCI2 and HMA>HMA2 and entry2 and useCCI and useHMA
ShortCondition8 = value1<value2 and value1<0 and CCI1<CCI2 and HMA<HMA2 and entry2 and useCCI and useHMA
//========================= Exit & Entry excecution =================================================
if HMAclose and fishclose and value1<value2 and HMA<HMA2
strategy.close("BUY")
if HMAclose and fishclose and value1>value2 and HMA>HMA2
strategy.close("SELL")
if HMAclose and HMA<HMA2
strategy.close("BUY")
if HMAclose and HMA>HMA2
strategy.close("SELL")
if fishclose and value1<value2
strategy.close("BUY")
if fishclose and value1>value2
strategy.close("SELL")
if LongCondition1 or LongCondition2 or LongCondition3 or LongCondition4 or LongCondition5 or LongCondition6 or LongCondition7 or LongCondition8
strategy.entry("BUY", strategy.long)
if ShortCondition1 or ShortCondition2 or ShortCondition3 or ShortCondition4 or ShortCondition5 or ShortCondition6 or ShortCondition7 or ShortCondition8
strategy.entry("SELL", strategy.short)