Rudy's BB with MartingaleMy first strategy script that uses Bollinger Bands and Martingale to increase contract size after negative profit.
Martingale
Loft Strategy V4This strategy is an advanced version of the Loft Strategy V1, I shared earlier. (Loft Strategy V1 consists of a kalman filter (by alexgrover ) and a "stop and reverse" line which is following and the kalman filter. If the price goes in the same direction as the position side, the "stop and reverse" line approaches the kalman filter as set on the "Approach Decrease Step" parameter.)
In addition to the previous version, it includes a martingale like deviation and multiple take-profit.
Here it is some parameters definitions of the strategy:
Kalman Filter: The higher this parameter, the faster and more aggressive the filter. Otherwise the filter goes very smoothly
Beginning Approach: First approximation as a percentage of stop-n-reverse line
Final Approach: Minimum approximation of stop-n-reverse line
Approach Decrease Step: If the price moves in the same direction as the strategy, the approach percentage is reduced by this parameter. Otherwise nothing do
Base Order Quantity: Initial capital of position
Max Safe Order Attempt: This parameter determines the maximum number of times the strategy will raise the bet after losing in a row.
Safe Order Deviation: if the last trade is loss, multiply the bet by this parameter (aka. martingale factor)
Profit Deviation: if last trade in loss, multiply the take-profit points
Max Order Quantity: Maximum capital allowed for a position
TP1, TP2, TP3 : Take profit spots in percentage
QT1, QT2, QT3: Amount of take-profit spots
Stop Loss: Maximum stop loss allowed for a trade
Long Entry, Short Entry: Only long side, only short side or both side
Safe Stop After TP2: If the price reaches the TP2 point, move the stop-loss point to the entry price.
Safe Stop After TP1: If the price reaches TP1, move the stop-loss point to the stop-n-reverse line.
Grid System With Fake MartingaleThe proposed strategy is based on a grid system with a money management that tries to replicate the effect of a martingale without having to double your position size after each loss, hence the name "fake martingale". Note that a balance using this strategy is still subject to exponential decay, the risk is not minimized, as such, it would be dangerous to use this strategy.
For more information on the martingale and grid systems see:
Strategy Settings
Point determines the "grid" size and should be adjusted accordingly to the scale of the security you are applying the strategy to. Higher value would require larger price movements in order to trigger a trade, generating fewer trades as a result.
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 each win.
How It Works
Let's illustrate how we replicate a martingale without doubling our exposure with a simple casino example. Imagine you are playing roulette, and that you are betting on colors (black/red), your payout is 1 to 1, in the case you win, you will have your initial stake back plus a profit equal to your initial stake.
If your strategy is to recover any previous losses, you can double your stake each time you lose, once you win you will get back the previous losses plus a profit equal to your original stake, this is the martingale system. So how can we win back previous losses without having to double our stake? We could do that by doubling the payout ratio after a loss, so after a loss, we must use a payout ratio of 2:1, if we lose once again we must use a payout of 4:1...etc, our payout ratio would be subject to exponential growth instead of our stake.
Of course, the payout ratio is fixed with casino games, but in trading, we can manipulate the position of our take profit in order to replicate such effect, this is what this strategy is doing. So after a loss, we place our take profit such that a win recover our losses back plus generate a profit.
Advantages
The advantage of this approach is that unlike the martingale we don't double our position size, which instead can remain constant, this is a huge advantage as a martingale will require a significant capital in order to tank a series of losses.
Disadvantages
The main disadvantage of this method is that the price might never reach our take profit after a long losing streak, our balance would remain in the red and we couldn't do anything about it except reset the strategy.
Frictional costs are still a disadvantage, as such, we would need to place our take profits in order to account for them, while this is still better than purchasing additional shares, it minimizes the chances of the price reaching the take profit.
Conclusions
An alternative money management system replicating the effect of a martingale as been presented, we can see that such a system is far from being perfect, and it would be foolish to use it, however, it stills offer a convenient alternative to less aggressive progressive position sizing systems.
I have been receiving some messages from users criticizing me for exposing the martingale money management system, and I understand why but I can't agree, talking about it allow me to warn users against it, the grid-martingale methodology is will create more harm than anything else, the reward is only one side of the story and should always be compared against the risk, so always take a look at all the statics in a backtest.
Thanks for reading!
Shout-Out
This post was made possible thanks to my patrons:
@Happymono, @AmariMars, @kkhaial, @Nugehe, @LucF, @Nosmok, @iflostio, @DankBeans, @ecletv, @Neverstorm, @alex.crown.jr, @uk503, @xkingshotss, @vsov, @jbelka, @yatrader2, @hughza, @ganh
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
inwCoin Martingale Strategy ( for Bitcoin )** Same as my previous martingale script but this version = opensource **
inwCoin Martingale Strategy is the proof of concept strategy that in the end, anyone who using martingale strategy will kaboom their portfolio.
For those who don't know what is "martingale".. it's a simple double down strategy in the hope to cover the loss in previous entry.
Example
In the game that if you win, you'll get 100% of your bet money back.
1st loss = 1$
2nd loss = bet 2$ : if win, get 2$ / real profit = 1$ ( 2-1 )
3rd loss = bet 4$ : if win, get 4$ / real profit = 1$ ( 4 - ( 2+1) )
4th loss = bet 8$ : if win, get 8$ / real profit = 1$ ( 8 - ( 4+2+1 ) )
...
...
10th loss = bet 512$ : if win, get 512$ / real profit = 1$ ( 512 - ( 256+128+64+32+16+8+4+2+1) )
as you can see, the next bet will be first bet x 2^(n-1)
and the profit will equal to your first bet.
==================
In trading and forex EA ( Expert Advisor or bot ) people use this strategy to fool newbies that their martingale system will generate steady income for eternity.
But in reality, this strategy will destroy your whole portfolio eventually some time in the future. Because there will be some "Blackswan event" in market at some point in time. And one who ignore this fact, will lose everything.
But, if you using low risk strategy and generate some profit from your low-risk portfolio. You can take small chunk of that profit and put it in riskier strategy like this martingale, to accerelate your profit snowball.
===================
Parameter Explaination
====================
Price = datasource for indicator calculation
Fixed position size option = if uncheck, the "Start position size" parameter will be % of your initial capital. If checked, it will fixed position size ( like 1 BTC )
Start Position Logic = condition to enter first trade
- MACD singal > 0 : Self explanatory, default macd value
- Stochastic RSI cross up : enter when sto line cross up from bottom ( 20 )
- ATR channel : enter trade if price cross above 2.3 ATR
Take Profit Percent = take profit target % from average entry
Start martingale ..= if price compare to average position entry less than this %, it will start to double down ( martingale )
Martingale Multiplier = you can specific how big you'll double down, default is 2
Trade Direction = long only for now
Use date rang = self explanatory
** make sure to setup your initial capital in properties tab **
On chart
=======
White Line = Average position price
Orange Line = your current equity
If equity less than 0, it will close any remaining positions ( It's mean your position got liquidated )
If price > equity line for "take profit percent" it will close any remaining positions.
=======
As you can see, this strategy survive 2018 drop and pump profit to 1000+% ( Check in the strategy tester tab > list of trades )
But in May 2020 -50% drop in just 3 days, your whole portfolio got liquidated.
Actually, after some digging in profit and backtest result.
This strategy, when it can survive a shape drop, can generate a lot of profit.
So, if you want to use martingale. Make sure to use only small chunk of your profit from "low-risk" strategy to accelerate your profit generation ( aka degen port )
DO NOT greedy and use all of your initial capital or borrowed money to use with this strategy!
Bilateral Stochastic Oscillator StrategyIntroduction
Strategy based on the bilateral stochastic oscillator, this oscillator aim to detect trends and possible reversal points of the current trend. The oscillator is composed of 1 bull line in blue and 1 bear line in red as well as a signal line in orange, the strategy have many options such as two different strategy framework and a martingale mode. If you require more information about the indicator go check it into my uploaded indicators.
Strategy Frameworks
There are two frameworks available that can be selected from the strategy settings window. Both have the same closing conditions, the "Bull/Bear Cross" entry conditions are :
Buy : when the bull line cross over the bear line
Sell : when the bear line cross over the bull line
The "Signal Cross" entry conditions are :
Buy : when the bull line cross over the signal line
Sell : when the bear line cross over the signal line
Both have the same close conditions that is : close when bull/bear cross under the signal line.
Introduction To Martingale
The martingale money management system consist to double the order size after a loosing trade and can be described as a 2^x where x is the current number of loosing trades since the last win trade, when we win a trade the order size return to the default order size. Therefore our order size function is based on exponential growth.
This system enable the trader to win back his previous losses plus a potential profit, martingales must always be used with stops and sometimes take profits in order to get control in a strategy.
It must always be taken into account that in a series of losses the balance can exponentially decay thus ending to 0 in a matter of trades, this is why it is not recommended to use such system. The strategy allow you to select a martingale multiplier that can be inferior to 2 thus limiting risks, a multiplied of 1 disable the martingale.
Results
Those are the some statistics of the strategy applied to some forex majors by using the default settings in a time frames of 15 minutes.
//-------------------------------------------------------
EURUSD - Order Size 1000 - Spread 0.0002
Profit : $ 21.08
Trades : 19
PP : 57.89 %
Profit Factor : 3.228
Max Drawdown : -$ 3.81
Average Trade : $ 1.11
//-------------------------------------------------------
GBPUSD - Order Size 1000 - Spread 0.0002
Profit : $ 2.31
Trades : 20
PP : 55 %
Profit Factor : 0.938
Max Drawdown : -$ 20.29
Average Trade : $ 0.12
//-------------------------------------------------------
EURAUD - Order Size 1000 - Spread 0.0002
Profit : -$ 9.22
Trades : 20
PP : 40 %
Profit Factor : 0.698
Max Drawdown : -$ 23.44
Average Trade : $ 0.46
//-------------------------------------------------------
EURCHF - Order Size 1000 - Spread 0.0002
Profit : $ 1.58
Trades : 24
PP : 54.17 %
Profit Factor : 1.103
Max Drawdown : -$ 7.23
Average Trade : $ 0.07
//-------------------------------------------------------
Conclusions
Based on the results the strategy does not posses the sufficient performance in order to apply a martingale or any other growth systems as order size. Parameters might be subject to drastic changes depending on the market/time-frame in order to return long-term positive results. I let you draw your conclusions.
Decent Martingale Strategy [Pinescript v3]In my experimentation to add some sort of hedging to trades, I stumbled on the Martingale roulette betting strategy.
If it works in the casino, why not here?
The principle is simple:
If you lose a trade, immediately go the opposite direction and double your bet.
In this case, we're just applying a multiplier.
The strategy is a simple EMA crossover - defaulted to my favorite periods 8 and 62.
Enjoy :) I'll make a new one that's contained in a function, so you can simply implement it in your own strategy and have it monitor winning/losing trades automatically.
Cheers,
DasanC
[RS]Function Martingale Multiplier - MA Crossover Bias V1EXPERIMENTAL:
WARNING: Martingale is subject to HUGE drawdown spikes, use at your own risk!
updated function to also double(aply multiplier) on even trades, example with a MA's crossover.
[RS]Function Martingale Multiplier V0EXPERIMENTAL:
WARNING:Martingale is susceptible to huge drawdown spikes, use at your own risk.
simple functions for martingale wins and losses, multiplier can be adjusted manually to increase/decrease performance/drawdown.
[STRATEGY][RS]Roulette Martingale V0a solid strategy all across the majors.
double the profits :p
WARNING: use at your own discretion.