TradingView
TradeAutomation
10 lis 2021 17:48

Low-High-Trend Strategy 

Amazon.com, Inc.NASDAQ

Opis

When asked what the key to successful investing was, Warren Buffet famously said “buy low, sell high.” Was he onto something? Today I am sharing with the community a simple “buy low, sell high” strategy with an optional trend filter and take-profit target. I’ve found that this strategy works well in a variety of markets but has a higher tendency to out-perform buy & hold in markets that are ranging sideways.

How it works:
The strategy tracks the highest and lowest price over the last X number of bars (you select the look-back period). The highest price line is plotted in green and the lowest price line is potted in red. If the price crosses over the lowest price in the last X number of bars, then a buy signal is generated. Exit options include a take-profit % or selling when the price crosses over the highest price in the last X amount of bars. I.e. “Buy low, sell high.” An EMA is also plotted as a blue trend line, and there is an option to only trade if the price is above the EMA trend line.

Disclaimer: Open source scripts I publish in the community are largely meant to spark ideas that can be used as building blocks for part of a more robust trade management strategy. Even though this example script beats buy and hold over the back-test time-frame, I wouldn't advise using it as a stand-alone strategy without significant additions/modifications to the strategy and risk management functions. In this example the script is being used as a medium-term strategy with just 10% leverage over account equity, a 25K start balance, and back-testing 10+ years. Modifiable slippage and commissions are included in the model.

Green line = Highest price in the look-back period
Red line = Lowest price in the look-back period
Blue line = EMA Trend

Informacje o Wersji

Update - Increased the model initial capital and the changed the default trade size to 100% of equity so that the script will run on more assets.
Komentarze
skijchenko
Can you add stop loss = 2 ATR?
TradeAutomation
@skijchenko, I released the code for a PineScript v5 ATR stop-loss in another publication here. You can combine and customize the code/strategy as you like. I also do custom coding as a service that you can book at TradeAutomation.net tradingview.com/script/77F1NKh1-ATR-Trailing-Stop-v5/
pakeha
Hi, is there a specific reason the uneven default look back is 20/10 versus say 10/10 or 20/20? Thanks
ZOoRoO81
Hello, such an amazing strategy from an even more amazing person!

i'd like to ask on how to get the buy and close orders. i've tried to use the 110% to 100%, but to no avail. Moreover, the chart im using is on default settings and shows buy/sell and close orders on other strats.
TradeAutomation
@ZOoRoO81, This is probably happening because the initial capital in the model isn't set high enough to trade your instruments. This is an adjustable setting. Just go to the strategy settings -> Properties and adjust initial capital up to an arbitrarily high number, like 100,000,000. Also make sure the % per trade is set to 100% or lower if your instrument can't be leveraged.
ZOoRoO81
@TradeAutomation, thank you for the fast reply! :)

I followed the instructions and sadly, the positions are still not showing.
TradeAutomation
@ZOoRoO81, I am unable to replicate your issue. Please message me with the chart/timeframe/ticker and I'll check it out
robbiesmith79
lol, this code will HODL until it sells at the target profit. Yes it appears 100% but that's only because it hit the default 8% profit but as you'll notice it jumps in a trade immediately after forever more.
ashok1961
@robbiesmith79, Does it mean that entry signals vanish later on after the Close? Does it re-paint?
TradeAutomation
@ashok1961, Good morning! This script doesn't repaint. It is set to only calculate on the close of a bar. Cheers
Więcej