This strategy is made to be used in daily time-frames. Works better on trending instruments where is available. Hence, this is more suitable for trending shares rather than currencies, and indexes where data is either not present or not reliable.
Breakout signifies the continuation of trend. Hence, trade in the direction of breakouts. Breakouts are calculated based on high and price movement in a day. This will be combined with few other conditions to generate buy and sell signals along with stop and compound targets. Supertrend is used for trend bias. Our buy and sell targets do not directly depend on the bias. But, entry criteria in opposite trend is made much difficult than that of trend direction. Further explanation of method and input parameters are explained below.
Backtesting parameters :
Capital and position sizing : Capital and position sizing parameters are set to test investing 2000 wholly on certain stock without compounding.
Initial Capital : 2000
Order Size : 100% of equity
Pyramiding : 1
ExitOnSignal : If unchecked exit is triggered solely on trailing stop
Trade Direction : Long, Short or All. Short condition is riskier than long conditions and often results in losses as per my observation. On most of the stocks trending up, strategy will not generate any short signals. This is achieved by comparing yearly high lows to previous two years to decide whether to allow short or long entries.
allowImmediateCompound : Applicable only if compounding/pyramiding is enabled in trade. If checked allows to place compounding orders immediately. If unchecked, it waits for stopline to cross order price before placing next compound.
Display Mode :
Targets: Whenever breakout happens, show marker for upTarget and downTarget
TargetChannel: Show up target and downtarget as a channel
Target With Stop: Along with targets, show also stop levels for breakouts
Up Channel : Channel created from UpTarget and respective stops
Down Channel : Channel created from DownTarget and respective stops
ShowTrailingStop : Shows trailing stop and compound lines when there is a trading position.
ShowTargetLevels : Shows Buy Sell target levels along with stop and compound lines. Trades are done as market orders. Hence, target levels are displayed after strategy makes the trade. Since only one order allowed per side without compounding, target, stop and compound levels are shown sometimes even without trade being made. These can be considered as entry levels if there is no existing position.
ShowPreviousLevels : Shows previous buy/sell target levels. When enabled, layout can look messy.
StopMultiplyer: To Set trailing stop loss.
BacktestYears: Number of years to include in backtest
So far my test cases are:
Positive : AAPL , AMZN , TSLA , RUN, VRT , ASX:APT
Negative Test Cases: WPL , WHC , NHC , WOW, COL, NAB (All ASX stocks)
Special test case: WDI
Negative test cases still show losses in backtesting. I have attempted including many conditions to eliminate or reduce the loss. But, further efforts has resulted in reduction in profits in positive cases as well. Still experimenting. Will update whenever I find improvements. Comments and suggestions welcome :)
- Added more conditions for entry if instrument trade history is loss. Entries are made lenient for profitable instruments.
- Update logic for trailing stop not to trail immediately. Stops are now trailed only after reaching compound period
- Added compound multiplier to enable separate calculation of compound line
- Changed logic for crossed compound for pyramiding orders. It now waits for price to cross compound level before looking for compound opportunity.
- Changed display layout for target signals. Stop, compound is always shown if there is a position
Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.
Join tradingview: https://www.tradingview.com/gopro/?share_your_love=sudh