Grid Like StrategyIt is possible to use progressive position sizing in order to recover from past losses, a well-known position sizing system being the "martingale", which consists of doubling your position size after a loss, this allows you to recover any previous losses in a losing streak + winning an extra. This system has seen a lot of attention from the trading community (mostly from beginners), and many strategies have been designed around the martingale, one of them being "grid trading strategies".
While such strategies often shows promising results on paper, they are often subjects to many frictions during live trading that makes them totally unusable and dangerous to the trader. The motivations behind posting such a strategy isn't to glorify such systems, but rather to present the problems behind them, many users come to me with their ideas and glorious ways to make money, sometimes they present strategies using the martingale, and it is important to present the flaws of this methodology rather than blindly saying "you shouldn't use it".
Strategy Settings
Point determines the "grid" size and should be adjusted accordingly to the scale of the symbol you are applying the strategy to. Higher value would require larger price movements in order to trigger a trade, as such higher values will generate fewer trades.
The order size determines the number of contracts/shares to purchase.
The martingale multiplier determines the factor by which the position size is multiplied after a loss, using values higher to 2 will "squarify" your balance, while a value of 1 would use a constant position sizing.
Finally, the anti-martingale parameter determines whether the strategy uses a reverse martingale or not, if set to true then the position size is multiplied after any wins.
The Grid
Grid strategies are commons and do not present huge problems until we use certain position sizing methods such as the martingale. A martingale is extremely sensitive to any kind of friction (frictional costs, slippage...etc), the grid strategy aims to provide a stable and simple environment where a martingale might possibly behave well.
The goal of a simple grid strategy is to go long once the price crossover a certain level, a take profit is set at the level above the current one and stop loss is placed at the level below the current one, in a winning scenario the price reach the take profit, the position is closed and a new one is opened with the same setup. In a losing scenario, the price reaches the stop loss level, the position is closed and a short one is opened, the take profit is set at the level below the current one, and a stop loss is set at the level above the current one. Note that all levels are equally spaced.
It follows from this strategy that wins and losses should be constant over time, as such our balance would evolve in a linear fashion. This is a great setup for a martingale, as we are theoretically assured to recover all the looses in a losing streak.
Martingale - Exponential Decays - Risk/Reward
By using a martingale we double our position size (exposure) each time we lose a trade, if we look at our balance when using a martingale we see significant drawdowns, with our balance peaking down significantly. The martingale sequence is subject to exponential growth, as such using a martingale makes our balance exposed to exponential decays, that's really bad, we could basically lose all the initially invested capital in a short amount of time, it follows from this that the theoretical success of a martingale is determined by what is the maximum losing streak you can endure
Now consider how a martingale affects our risk-reward ratio, assuming unity position sizing our martingale sequence can be described by 2^(x-1) , using this formula we would get the amount of shares/contracts we need to purchase at the x trade of a losing streak, we would need to purchase 256 contracts in order to recover from a losing streak of size 9, this is enormous when you take into account that your wins are way smaller, the risk-reward ratio is totally unfair.
Of course, some users might think that a losing streak of size 9 is pretty unlikely, if the probability of winning and losing are both equal to 0.5, then the probability of 9 consecutive losses is equal to 0.5^9 , there are approximately 0.2% of chance of having such large losing streak, note however that under a ranging market such case scenario could happen, but we will see later that the length of a losing streak is not the only problem.
Other Problems
Having a capital large enough to tank 9any number of consecutive losses is not the only thing one should focus on, as we have to take into account market prices and trading dynamics, that's where the ugly part start.
Our first problem is frictional costs, one example being the spread, but this is a common problem for any strategy, however here a martingale is extra sensitive to it, if the strategy does not account for it then we will still double our positions costs but we might not recover all the losses of a losing streak, instead we would be recovering only a proportion of it, under such scenario you would be certain to lose over time.
Another problem are gaps, market price might open under a stop-loss without triggering it, and this is a big no-no.
Equity of the strategy on AMD, in a desired scenario the equity at the second arrow should have been at a higher position than the equity at the first arrow.
In order for the strategy to be more effective, we would need to trade a market that does not close, such as the cryptocurrency market. Finally, we might be affected by slippage, altho only extreme values might drastically affect our balance.
The Anti Martingale
The strategy lets you use an anti-martingale, which double the position size after a win instead of a loss, the goal here is not to recover from a losing strike but instead to profit from a potential winning streak.
Here we are exposing your balance to exponential gross but you might also lose a trade at the end a winning streak, you will generally want to reinitialize your position size after a few wins instead of waiting for the end of a streak.
Alternative
You can use other-kind of progressions for position sizing, such as a linear one, increasing your position size by a constant number each time you lose. More gentle progressions will recover a proportion of your losses in a losing streak.
You can also simulate the effect of a martingale without doubling your position size by doubling your target profit, if for example you have a 10$ profit-target/stop-loss and lose a trade, you can use a 20$ profit target to recover from the lost trade + gain a profit of 10$. While this approach does not introduce exponential decay in your balance, you are betting on the market reaching your take profits, considering the fact that you are doubling their size you are expecting market volatility to increase drastically over time, as such this approach would not be extremely effective for high losing streak.
Conclusion
You will see a lot of auto-trading strategies that are based on a grid approach, they might even use a martingale. While the backtests will look appealing, you should think twice before using such kind of strategy, remember that frictional costs will be a huge challenge for the strategy, and that it assumes that the trader has an important initial capital. We have also seen that the risk/reward ratio is theoretically the worst you can have on a strategy, having a low reward and a high risk. This does not mean that progressive position sizing is bad, but it should not be pushed to the extreme.
It is nice to note that the martingale is originally a betting system designed for casino games, which unlike trading are not subject to frictional costs, but even casino players don't use it, so why would you?
Thx for reading
Analisis Trend
Combo Backtest 123 Reversal & Ergodic CSI This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This is one of the techniques described by William Blau in his book
"Momentum, Direction and Divergence" (1995). If you like to learn more,
we advise you to read this book. His book focuses on three key aspects
of trading: momentum, direction and divergence. Blau, who was an electrical
engineer before becoming a trader, thoroughly examines the relationship between
price and momentum in step-by-step examples. From this grounding, he then looks
at the deficiencies in other oscillators and introduces some innovative techniques,
including a fresh twist on Stochastics. On directional issues, he analyzes the
intricacies of ADX and offers a unique approach to help define trending and
non-trending periods.
This indicator plots Ergotic CSI and smoothed Ergotic CSI to filter out noise.
WARNING:
- For purpose educate only
- This script to change bars colors.
CCI-RSI MR Indicators:
Bollinger Bands (20 period, 2σ)
RSI (14 period) and Simple moving average of RSI (5 period)
CCI (20 period)
SMA (5 period)
Entry Conditions:
Buy when:
Swing low (5) should be lower than the highest of lower BB (3 periods)
Both RSI crossover RSI_5 and CCI crossover -100 should have happened within last 3 candles (including the current candle)
Once all the above conditions are met, the close should be higher than SMA (5) within the next 3 candles
After condition 3 is satisfied, we enter the trade at next candle’s open
Stop loss will be at 1 tick lower than previous swing low
Sell when:
Swing high (5) should be higher than the lowest of upper BB (3 periods)
Both RSI crossunder RSI_5 and CCI crossunder 100 should have happened within last 3 candles (including the current candle)
Once all the above conditions are met, the close should be lower than SMA (5) within the next 3 candles
After condition 3 is satisfied, we enter the trade at next candle’s open
Stop loss will be at 1 tick higher than previous swing high
Exit Conditions:
Since it’s mean reversion strategy we’ll be having only 2 target exits with a trailing stop loss after target price 1 is achieved.
Target exit price 1 & 2 are decided based on the risk ‘R’ for each trade
Depending on the instrument and time frame a trailing stop loss of 0.5R or 1R has opted.
A stop limit is placed @Entry_price +- 2*ATR(20) to offset the risk of losing significantly more than 1xR in a trade
Double Exponential Moving Average 8-20-63 StrategyHello, this script was made upon the request of aliergin63, one of my followers.
I do not know exactly from whom it is quoted. (It may be author HighProfit.)
Long position when 8 dema is over 20 dema and 63 dema,
it opens a short position for the vice versa.
Alarms have been added.
%0.1 comission added.
Regards.
Note : DEMA = Double Exponential Moving Average
Etlers Instantenous TrendlineThis script uses @cheatcountry script to calculate Ehlers Instantenous Trendline .
Backtest offers 3 capital management tools. One that will always calculate order size as initial capital/close, one that uses the same calculation but adds or substracts profit. The last one allows you to enter manually the size you want to trade.
Green and red horizontal lines are profit/stop values.
Optimized Trend Tracker - Strategy VersionA brand new indicator from the developer of MOST (Moving Stop Loss) indicator Anıl Özekşi.
Optimized Trend Tracker OTT is an indicator that provides traders to find an existing trend or in another words to ser which side of the current trend we are on.
The original indicator was coded and published by Kıvanç Özbilgiç. You can access it from this link:
I transformed the indicator into a strategy and made some changes:
- You can run two different strategies. In the Settings section, you can test two different strategies, "Support Line Crossing Signals" and "Price / OTT Crossing Signals".
- Fixed the issue where BUY/SELL labels from the indicator script would hang in the air.
- I added a setting where you can hide BUY/SELL labels if you want.
- I painted the bars for BUY/SELL states, you can open and close in the settings section.
- As I do with every strategy script, I added a start and end date for the strategy test. You can specify the range you want to see working in the Settings section.
In addition, there were cases when the OTT line was reduced to zero in non-voluminous symbols; I changed this situation by making a small change in the code. I asked Kıvanç about the subject, I can update according to his answer.
Note : Strategy BUY / SELL tags and indicator BUY / SELL tags do not operate in the same bar because indicator tags are added when the next bar occurs. If you replay bars, you can observe label formations.
TÜRKÇE AÇIKLAMA
Orjinal indikatör Kıvanç Özbilgiç tarafından kodlanmış ve yayımlanmıştır. Bu linkten erişebilirsiniz:
İndikatörü strateji dönüştürdüm ve bazı değişiklikler yaptım:
- İki farklı strateji çalıştırabilirsiniz. Ayarlar kısmında Condition bölümünde "Support Line Crossing Signals" ve "Price/OTT Crossing Signals" olarak iki farklı stratejiyi test edebilirsiniz.
- İndikatör scriptinden gelen BUY/SELL etiketlerinin havada durması sorununu düzelttim.
- İsterseniz BUY/SELL etiketleri gizleyebileceğiniz bir ayar ekledim.
- BUY/SELL durumları için barları boyadım, ayarlar bölümünden açıp kapatabilirsiniz.
- Her strateji scriptinde yaptığım gibi, strateji testi için başlangıç ve bitiş tarihi ekledim. Ayarlar bölümünden çalışmasını görmek istediğiniz aralığı belirleyebilirsiniz.
- Ek olarak hacimsiz sembollerde OTT çizgisinin sıfıra indiği durumlar mevcuttu; kodda ufak bir değişiklik yaparak bu durumu değiştirdim. Kıvanç Bey'e konu ile ilgili soru sordum, cevabına göre güncelleme yapabilirim.
Not : Strateji BUY/SELL etiketleri ile indikatör BUY/SELL etiketleri aynı barda işlem yapmamaktadır çünkü indikatör etiketleri kendisinden sonraki bar oluşunca eklenmektedir. Barları replay yaptırırsanız oluşumlarını gözlemleyebilirsiniz.
Close Trade at end of day script serves as an example how we can close trades at end of day.
can be session controlled or the time controlled.
the session should be adjusted to be earlier than the candle time.
Noro's RiskChannel StrategyIndicator
The Donchian price channel is used. There are 2 methods available to close the position. The user can choose a method.
Wikipedia: en.wikipedia.org
Strategy #1 (stop-loss type = channel)
Old classic trading strategy, using breakouts of the Donchan price channel.
If the price is above the price channel top line, open the long position (and close the short position)
If the price is below the lower line of the price channel, open the short position (and close the long position)
It is recommended that you all use market stop orders.
Strategy #2 (stop-loss type = center)
This metod is better. This method is recommended.
The central line (red) is the middle of the Donchian price channel. Used to close any positions.
If the price is higher than the price channel top line, open the long position.
If the price is lower than the lower line of the price channel, open the short position.
If the price has crossed the central line of the channel, close any position.
It is recommended that you all use market stop orders.
Risk
There are 2 options. Risk for long positions and risk for short positions. This is the size of the possible loss. Order size depends on the possible loss and is calculated for each position.
For
BTC/USD, BTC/USDT, XBT/USD, ETH/USD, ETH/USD (need USD!)
Timeframes: 1h and length of price channel = 50 bars or 4h and length of price channel = 12
Noro's RiskDonchian StrategyThe strategy uses Donchian price channel . The channel is shown in blue lines. All other lines use Donchian channel too. The red line is the center line between the channel lines. The lime line is a few percent further away. The percentage is set by the user in the strategy settings.
Lines
Blue line - to open position using market stop order
Lime line - take-profit (limit order)
Red line - stop-loss (market stop order, trailing-stop)
For
- BTC /USD, XBT/USD, ETH/USD (need USD)
- timeframe: 1h or 4h
Simple SMA Strategy Backtest Part 4Added Take Profit and Stop Loss logic.
Part 4 :
www.tradingview.com
Part 3:
www.tradingview.com
Combo Backtest 123 Reversal & Empirical Mode Decomposition This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The related article is copyrighted material from Stocks & Commodities Mar 2010
WARNING:
- For purpose educate only
- This script to change bars colors.
Noro's RiskTurtle StrategyThe idea of this strategy script was taken here:
(PDF-Book, English) bigpicture.typepad.com
Strategy
2 Donchian price channels are being created. Fast and slow. The number of candles for the channels is selected by the user. By default, 20 bars for fast and 50 bars for slow. Blue lines show a slow price channel . And used to enter positions. Using market stop orders. A fast price channel is needed to find out the price for stop-loss. This is the center line of the fast channel. Shown by a red line. The background shows when the positions were opened. Lime background for long positions, and red background for short positions. There is no background if there are no positions.
Risk size
Stop Placement
The Turtles placed their stops based on position risk. No trade could incur more than 2% risk.
Since 1N of price movement represented 1% of Account Equity, the maximum stop
that would allow 2% risk would be 2N of price movement. Turtle stops were set at 2N
below the entry for long positions, and 2N above the entry for short positions.
For
- XBT/USD, BTC /USD, BTC /USDT, ETH/USD, ETH/USDT, etc - need ***/(T)USD(T)
- Timeframes 1h, 2h, 3h, 4h
Noro's SimpleTurtle StrategyThis is a highly simplified version of the Turtle strategy. It is very different from the original Turtle strategy.
Lines
2 Donchian price channels are being created. Fast and slow. The number of candles for the channels is selected by the user. By default, 20 bars for fast and 50 bars for slow. Blue lines show a slow price channel. And used to enter positions. Using market stop orders. A fast price channel is needed to find out the price for stop-loss. This is the center line of the fast channel. Shown by a red line. The background shows when the positions were opened. Lime background for long positions, and red background for short positions. There is no background if there are no positions.
For
- XBT/USD, BTC/USD, BTC/USDT, ETH/USD, ETH/USDT, etc - need ***/(T)USD(T)
- Timeframes 1h, 2h, 3h, 4h
Simple SMA Strategy BacktestAdded strategy logic.
Part 3:
www.tradingview.com
Part 2:
www.tradingview.com
Part 1:
Simple SMA Indicator
www.tradingview.com
WARNING:
- For purpose educate only
sa-strategy with HTF-TSLEntry- based on HA close above HMA confirmation done with ST and HTF ATR
Exit- based on close below ATR which works as trailing SL
Noro's Turtles StrategyOriginal idea from book «Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders» (2007, CURTIS FAITH, ISBN: 9780071486644)
Strategy
2 positions types are used. Fast and slow. The period for fast and slow user specifies separately. For example for quick: if the price is higher than the highest price in the last 10 candles, then open a long position using a stop order. If the price is below the lowest price in the last 20 candles, then close the long position. In the same way for a short position and also for slow positions.
Combo Backtest 123 Reversal & EMA & MA Crossover This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The Moving Average Crossover trading strategy is possibly the most popular
trading strategy in the world of trading. First of them were written in the
middle of XX century, when commodities trading strategies became popular.
This strategy is a good example of so-called traditional strategies.
Traditional strategies are always long or short. That means they are never
out of the market. The concept of having a strategy that is always long or
short may be scary, particularly in today’s market where you don’t know what
is going to happen as far as risk on any one market. But a lot of traders
believe that the concept is still valid, especially for those of traders who
do their own research or their own discretionary trading.
This version uses crossover of moving average and its exponential moving average.
WARNING:
- For purpose educate only
- This script to change bars colors.
[LunaOwl] Support Resistance Strategy V4作品: 支撐壓力策略
A simple Support Resistance Breakthrough Strategy, the only difference is that it is PineScript @version=4. interested parties can use it as a reference.
Its logic is simple, wish your all the best.
一個簡單的支撐阻力突破策略,唯一的差異,在於它是PineScript第四版。有興趣的可以拿來當作參考,簡易的指標。祝你們順心。
Support level refers to the support price that the exchange rate may encounter when it falls, so as to stop falling and stabilize the price.
The corresponding concept is the resistance level, that is, the pressure that the exchange rate may encounter when it rises, thus reversing to a falling price.
支撐位是指匯價在下跌時可能遇到的支撐價格,從而止跌回穩的價格,對應的概念是阻力位,也即匯價上漲時可能遇到的壓力,從而反轉為下跌的價格。
Ichimoku Kinko Hyo StrategyStrategy based on the Ishimoku Kinko Hyo system, using the different indicators it provides to build signals.
This strategy could be better as it should ideally use the position of the price line compared to Chikou to determine if signals should be looked for, but I've been unable to fully implement this so far (an imperfect implementation is provided, but disable by default). I'll update the script once I figure it out, but it still gives good results without this.
EMA Slope Cross Trend Follower StrategyThis strategy uses the cross of the slopes of two EMAs having different lengths to generate trend follower signals. By default, I use 130 and 400, which behave very well.
The conditions which make the strat enter the market are:
- Fast Slope > Slow Slope and price > EMA 200 : go Long
- Fast Slope < Slow Slope and price < EMA200 : go Short
The simple slopes cross in the opposite direction, closes the position.
The strategy performs best on Bitcoin and the most liquid and capitalized Altcoins, but works greatly on volatile assets as well, in particular if they often go trending.
Works best on 4h time frame.
There's also an optional Volatility filter, which opens the position only if the difference between the two slopes is more than a specific value, which can be set in the strategy inputs. The purpose is not opening positions if price is going sideways and the noise is way > than the signal.
Enjoy it!
Combo Backtest 123 Reversal & Elder Ray (Bull Power) This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Developed by Dr Alexander Elder, the Elder-ray indicator measures buying
and selling pressure in the market. The Elder-ray is often used as part
of the Triple Screen trading system but may also be used on its own.
Dr Elder uses a 13-day exponential moving average (EMA) to indicate the
market consensus of value. Bull Power measures the ability of buyers to
drive prices above the consensus of value. Bear Power reflects the ability
of sellers to drive prices below the average consensus of value.
Bull Power is calculated by subtracting the 13-day EMA from the day's High.
Bear power subtracts the 13-day EMA from the day's Low.
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
- This script to change bars colors.
Tan_Aug09Crypto pairs: ETH/USDT
Time-frame: D1
Based on Heikin Ashi Candle and Exponential Moving Average Indicators
Crypto pick: 5D
Stock pick: 8D
Best work in strong trend.
Recommend using with trend line .
Pivot Point V2 Backtest Pivot points simply took the high, low, and closing price from the previous period and
divided by 3 to find the pivot. From this pivot, traders would then base their
calculations for three support, and three resistance levels. The calculation for the most
basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and
resistance levels.
WARNING:
- For purpose educate only
- This script to change bars colors.