
이 전략은 OBV 피라미드 이라고 불리며, OBV 지표를 기반으로 포지션 개설 전략을 설계하고, 피라미드 포지션 방식을 채택하여, 트렌드가 나타나면 여러 차례 포지션을 추가하여 트렌드를 추적하여 수익을 얻습니다.
이 전략은 OBV 지표를 사용하여 트렌드 방향을 판단한다. OBV 지표는 거래량 변화를 기반으로 가격 트렌드를 판단하며, 거래량 변화는 시장 참가자의 태도를 반영한다. OBV 상의 0 축을 통과하면 구매 동력이 강화되는 것을 나타낼 때, 다중 동향이 형성된다.
이 전략은 OBV가 0축을 통과하는지 여부를 판단하여 다면 트렌드가 형성되는 것을 확인합니다. 다면 트렌드가 형성될 때, 피라미드형의 상장 규칙을 설정하여 최대 7 번 상장 할 수 있습니다. 트렌드를 추적하여 수익을 창출하고, 스톱 손실 퇴출 장치를 설정합니다.
이 전략의 가장 큰 장점은 트렌드를 포착할 수 있다는 점, 피라미드 포지션 방식으로 트렌드 운행을 추적할 수 있다는 점, 수익 잠재력이 높다는 점이다. 또한, 전략의 위험은 통제되고, 스톱 손실 설정이 있다.
특히, 장점은 다음과 같습니다:
이 전략의 주요 위험은 두 가지로 나다.
대응방법:
이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.
이러한 내용을 최적화하면, 전략이 더 안정적이고, 더 통제 가능하며, 더 확장될 수 있습니다.
이 전략은 전체적으로 매우 실용적입니다. OBV 지표를 사용하여 트렌드 방향을 판단한 다음 피라미드 가설을 통해 트렌드를 추적합니다. 전략 논리는 간결하고 명확하며 이해하기 쉽고 재측정됩니다. 실제 실전에서의 사용 가치가 있습니다.
/*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)