ValerioTomaselli

Contrarian DC Strategy - w Entry SL Pause and TrailingStop

ValerioTomaselli 업데이트됨   
Donchian Channel Setup:

The strategy uses a tool called the Donchian Channel. Imagine this as two lines (bands) on a chart that show the highest and lowest prices over a certain number of past trading days (default is 20 days).
There's also a centerline, which is the average of these two bands.
Entry Conditions for Trades:

Buying (Going Long): The strategy considers buying when the price touches or falls below the lower band of the Donchian Channel. However, this only happens if there has been a pause after a previous losing trade. This pause is a number of candles where no new trades are taken.
Selling (Going Short): Similarly, the strategy considers selling when price reaches or exceeds the upper band of the Donchian Channel. Again, this is subject to a pause after a losing trade.

Stop Loss and Take Profit:

Each trade has a "Stop Loss" and "Take Profit" set. The Stop Loss is a preset price level where the trade will close to prevent further losses if the market moves against your position. The Take Profit does the same but locks in profit if the market moves in your favor.
The Stop Loss is set based on a percentage of the price at which you entered the trade.
The Take Profit is determined by the Risk/Reward Ratio. This ratio helps balance how much you're willing to risk versus the potential reward.
Trailing Stop Loss:

When a trade is profitable, the strategy should involve a "Trailing Stop Loss." This means the Stop Loss level moves (or trails) the price movement to lock in profits as the market moves in your favor.
For a buy trade, if the price moves above the centerline of the Donchian Channel, the Trailing Stop Loss should be adjusted in the middle between the entry price and the centerline. Viceversa for a sell trade, it should be adjusted in the same way if the price goes below the centerline.

IMPORTANT: There's no allert for the trailing stop at the moment.

Post-Stop Loss Pause:

If a trade hits the Stop Loss (i.e., it's a losing trade), the strategy takes a break before opening another trade in the same direction. This pause helps to avoid entering another trade immediately in a potentially unfavorable market.
In summary, this strategy is designed to make trades based on the Donchian Channel, with specific rules for when to enter and exit trades, and mechanisms to manage risk and protect profits. It's contrarian because it tends to buy when the price is low and sell when the price is high, which is opposite to what many traders might do.
릴리즈 노트:
I've changed the way we are positioning stop losses and take profits in both cases, in both cases we will close our position in profit when the price is equal to the centerline and we'll then calculate the stop loss accordingly in order to open a position that have a risk/reward rate of 2.2
릴리즈 노트:
This updated script includes new conditions for taking profit: closing a long position when the price hits the upper band and closing a short position when the price hits the lower band. These additional conditions aim to capture profits by anticipating a potential reversal or slowdown in price movement after reaching the extremes of the Donchian Channel.

Also i fixed a logic error in my previous code when setting stoploss. This revised code adjusts the stop loss placement for long and short positions correctly. For long positions, the stop loss is set below the average entry price, while for short positions, it's set above. Additionally, the trailing stop loss logic is updated to adjust the stop loss based on the position type and the current price in relation to the middle Donchian Channel.

오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?