OPEN-SOURCE SCRIPT

Breakout Trend Trading Strategy - V1

Aktualisiert
Strategy in nutshell:

This strategy is made to be used in daily time-frames. Works better on trending instruments where volume is available. Hence, this is more suitable for trending shares rather than currencies, commodities and indexes where volume 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 volume 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 :)
Versionshinweise
Minor corrections
Versionshinweise
Slight change in trailing stop loss. Trail once in 3 days.
Versionshinweise
  • 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
Versionshinweise
  • 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
breakouttradingTrend AnalysistrendtradingVolatilityVolume

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss