I started this script as a joke for someone... finally appears it could be used for educational content
Let's talk about leverage and margin call
A margin call is the broker's demand that an investor deposit additional money or securities so that the account is brought up to the minimum value, known as the maintenance margin.
A margin call usually means that one or more of the securities held in the margin account has decreased in value below a certain point.
A leverage is a system which allows the trader to open positions much larger than his own capital. ... “Leverage” usually refers to the ratio between the position value and the investment needed,
The strategy simulates long/short positions on a 4h high/low breakout based on the chart candle close.
The panel below shows the strategy equity curve. Activating the margin call option will show when the account would be margin called giving the settings
I'm not doing any financial recommendation here.
I made this strategy so that people include more risk management metrics into their strategy.
From the code, we see it's fairly easy to calculate a leveraged position size and a margin call flag - when that flag is hit, the system stops trading.
I simplified things to the extreme here but my point is that the leverage is a double-edge sword gift.
Assuming we always take the same position sizing, increasing the leverage speed up how fast a margin could be ..... called. (bad joke? feel free to tell me). Not saying it will, saying it introduces more risk by design.
Then one could say "I'll just turn off that stupid margin call option". And that's when someone starts backtesting with unrealistic market conditions.
When I backtest I always assume the worst in every scenario possible (because I'm French), I always try to minimize the risk first (also because I'm French), keeping as close from 0 as possible (French again)
Then I add the "opportunity" component, looking to catch the maximum of opportunity while keeping the risk low.
It's like a Rubix cube puzzle - decreasing the risk is one side of the equation but whenever I try to catch more opportunity... my risks increases.
Then I update my risk... and now the opportunity decreases... (#wut #wen #simple)
Completely removing the risk from a trading strategy isn't something I wouldn't dare doing.
Trading involves risk. Being obsessed by decreasing the risk is what I do BEST :)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.