월요일에 매수하고 수요일에 이익을 실현하는 전략


생성 날짜: 2023-09-12 16:44:53 마지막으로 수정됨: 2023-09-12 16:44:53
복사: 0 클릭수: 697
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

이 전략은 거래의 주기적 법칙을 중심으로 설계되었으며, 월요일 종점에는 구매하고, 수요일 개시 전에 종점에서는 철수하여, 그 파장의 가격 추세를 포착한다. 전형적인 기계적 거래 전략에 속한다.

전략적 원칙:

  1. 매주 월요일 종결 전에 구매를 하고, 다중 포지션을 개설한다.

  2. 매주 수요일, 상장 전에 ‘스톱‘을 실행하고, 다수점 포지션을 철수한다.

  3. Stop Loss Percentage를 설정하여 손실이 커지는 것을 방지하십시오.

  4. 이 경우, 수익률을 고정하기 위해 Stop-Loss 비율을 설정합니다.

  5. 스톱로스 라인을 그리고, 수익과 손실을 직관적으로 보여준다.

이 전략의 장점:

  1. 주기적 거래 방식은 회수 위험이 적고, 역사적인 성과가 우수하다.

  2. 규칙이 정해져 있고, 알고리즘화된 거래가 가능합니다.

  3. 스티프 스티프 손실 설정은 간단하고 실용적입니다.

이 전략의 위험은:

  1. 급격한 사건의 영향에 적응할 수 없다.

  2. 연체 손실 Unable 단편 손실을 제한 확장 .

  3. 이 영업이익이 잠겨있기 때문에 더 이상 추적할 수 없습니다.

요약하자면, 이 전략은 기계화된 주기적 거래 방식을 채택하고 있으며, 재검토 효과는 뚜렷하지만, 주기적 패턴의 변동에 대처하기 어렵기 때문에 투자자는 신중하게 사용해야 한다.

전략 소스 코드
/*backtest
start: 2023-08-12 00:00:00
end: 2023-09-11 00:00:00
period: 4h
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/
// © processingclouds

// @description Strategy to go long at end of Monday and exit by Tuesday close, or at stop loss or take profit percentages  

//@version=5
strategy("Buy Monday, Exit Wednesday", "Mon-Wed Swings",overlay=true)

//  ----- Inputs: stoploss %, takeProfit %
stopLossPercentage = input.float(defval=4.0, title='StopLoss %', minval=0.1, step=0.2) / 100
takeProfit = input.float(defval=3.0, title='Take Profit %', minval=0.3, step=0.2) / 100

//  ----- Exit and Entry Conditions - Check current day and session time
isLong = dayofweek == dayofweek.monday  and not na(time(timeframe.period, "1400-1601"))
isExit = dayofweek == dayofweek.wednesday and not na(time(timeframe.period, "1400-1601"))

//  ----- Calculate Stoploss and Take Profit values
SL = strategy.position_avg_price * (1 - stopLossPercentage)
TP = strategy.position_avg_price * (1 + takeProfit)

//  ----- Strategy Enter, and exit when conditions are met
strategy.entry("Enter Long", strategy.long, when=isLong)
if strategy.position_size > 0 
    strategy.close("Enter Long", isExit)
    strategy.exit(id="Exit", stop=SL, limit=TP)

//  ----- Plot Stoploss and TakeProfit lines
plot(strategy.position_size > 0 ? SL : na, style=plot.style_linebr, color=color.red, linewidth=2, title="StopLoss")
plot(strategy.position_size > 0 ? TP : na, style=plot.style_linebr, color=color.green, linewidth=2, title="TakeProfit")