월요일 구매 수요일 판매 거래 전략

저자:차오장, 날짜: 2023-09-12 16:44:53
태그:

이 전략은 월요일에 긴 문을 닫고 수요일 열기 전에 이익을 취함으로써 주간 순환 패턴을 거래합니다. 이 기간 동안 가격 변동을 포착하기 위해. 이것은 전형적인 기계 시스템입니다.

전략 논리:

  1. 매주 월요일은 긴 엔트리를 실행합니다.

  2. 매주 수요일 개장 직전부터 수익을 얻습니다.

  3. 손해를 막는 비율을 제한 손실로 설정합니다.

  4. 이윤을 확보하기 위해 이윤 목표 비율을 설정합니다.

  5. 시각적 P&L를 위한 플롯 정지 및 수익 라인

장점:

  1. 순환상거래는 소액의 유출과 좋은 역사적인 수익을 가지고 있습니다.

  2. 고정된 규칙은 자동화되고 실행하기 쉽습니다.

  3. 간단한 스톱 로스 및 노프트 구성을 합니다.

위험성:

  1. 순환을 방해하는 사건에 적응할 수 없습니다.

  2. 한 거래에서 손실을 제한 할 수 없습니다.

  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")

더 많은