
Chiến lược này được gọi là OBV kim tự tháp , dựa trên chỉ số OBV thiết kế chiến lược mở vị trí, và sử dụng phương pháp tăng vị trí kim tự tháp, sau khi xu hướng xuất hiện, tăng vị trí nhiều lần và theo dõi xu hướng để kiếm lợi nhuận.
Chiến lược này sử dụng chỉ số OBV để xác định hướng xu hướng. Chỉ số OBV dựa trên sự thay đổi khối lượng giao dịch để xác định xu hướng giá, sự thay đổi khối lượng giao dịch phản ánh thái độ của người tham gia thị trường. Khi đường 0 trên OBV biểu thị tăng cường lực lượng mua, xu hướng đa đầu được hình thành; Khi đường 0 dưới OBV biểu thị tăng cường lực lượng bán, xu hướng không đầu được hình thành.
Chiến lược này xác nhận sự hình thành của xu hướng đa đầu bằng cách đánh giá liệu OBV có vượt qua 0 hay không. Khi xu hướng đa đầu được hình thành, hãy thiết lập quy tắc gia tăng hình kim tự tháp, có thể gia tăng tối đa 7 lần.
Ưu điểm lớn nhất của chiến lược này là có thể bắt được xu hướng, theo dõi xu hướng hoạt động thông qua cách đặt cược bằng kim tự tháp, có tiềm năng lợi nhuận lớn. Ngoài ra, chiến lược rủi ro được kiểm soát và có thiết lập dừng lỗ.
Trong khi đó, những lợi thế chính là:
Chiến lược này có hai rủi ro chính:
Giải pháp tương ứng:
Chiến lược này có thể được tối ưu hóa theo các hướng sau:
Sau khi tối ưu hóa các nội dung này, các chiến lược có thể trở nên ổn định hơn, có thể kiểm soát được và có thể mở rộng hơn.
Chiến lược này rất thực tế. Nó sử dụng các chỉ số OBV để xác định xu hướng và sau đó theo dõi xu hướng thông qua kim tự tháp tăng giá.
/*backtest
start: 2023-11-07 00:00:00
end: 2023-12-07 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/
// © RafaelZioni
//@version=4
strategy(title = " OBV Pyr", overlay = true, pyramiding=5,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 20, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.075)
strat_dir_input = input(title="Strategy Direction", defval="long", options=["long", "short", "all"])
strat_dir_value = strat_dir_input == "long" ? strategy.direction.long : strat_dir_input == "short" ? strategy.direction.short : strategy.direction.all
strategy.risk.allow_entry_in(strat_dir_value)
//
fastLength = input(250, title="Fast filter length ", minval=1)
slowLength = input(500,title="Slow filter length", minval=1)
source=close
v1=ema(source,fastLength)
v2=ema(source,slowLength)
//
filter=true
src = close
LengthOBV = input(20)
nv = change(src) > 0 ? volume : change(src) < 0 ? -volume : 0*volume
c = cum(nv)
c_tb = c - sma(c,LengthOBV)
// Conditions
longCond = crossover(c_tb,0)
//shortCond =crossunder(cnv_tb,0)
//
longsignal = (v1 > v2 or filter == false ) and longCond
//shortsignal = (v1 < v2 or filter == false ) and shortCond
//set take profit
ProfitTarget_Percent = input(3)
Profit_Ticks = close * (ProfitTarget_Percent / 100) / syminfo.mintick
//set take profit
LossTarget_Percent = input(10)
Loss_Ticks = close * (LossTarget_Percent / 100) / syminfo.mintick
////Order Placing
//
strategy.entry("Entry 1", strategy.long, when=strategy.opentrades == 0 and longsignal)
//
strategy.entry("Entry 2", strategy.long, when=strategy.opentrades == 1 and longsignal)
//
strategy.entry("Entry 3", strategy.long, when=strategy.opentrades == 2 and longsignal)
//
strategy.entry("Entry 4", strategy.long, when=strategy.opentrades == 3 and longsignal)
//
strategy.entry("Entry 5", strategy.long, when=strategy.opentrades == 4 and longsignal)
//
strategy.entry("Entry 6", strategy.long, when=strategy.opentrades == 5 and longsignal)
//
strategy.entry("Entry 7", strategy.long, when=strategy.opentrades == 6 and longsignal)
//
//
//
if strategy.position_size > 0
strategy.exit(id="Exit 1", from_entry="Entry 1", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 2", from_entry="Entry 2", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 3", from_entry="Entry 3", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 4", from_entry="Entry 4", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 5", from_entry="Entry 5", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 6", from_entry="Entry 6", profit=Profit_Ticks, loss=Loss_Ticks)
strategy.exit(id="Exit 7", from_entry="Entry 7", profit=Profit_Ticks, loss=Loss_Ticks)