Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Equity Drawdown and MaxDD – Tradingview Pinescript Code

56 sec read

Equity Drawdown is a measure from the peak-to-trough decline during a specific recorded period of a stock/index/commodity/currency. A drawdown is usually quoted as the percentage between the peak and the subsequent trough. Red Area Charts represents the Drawdown of that particular trading instrument/index. Recent value always informs how much the trading instrument is off from its recent peak value in percentage terms.

Max Drawdown is the Maximum incurred drawdown among the entire data series. Recent value which is plotted in blue lines reflect the maxmium drawdown in the entire data set.

In the above State Bank of India Daily Charts current drawdown shows the value of 23%(Red Area) from the most recent peak value and the Max Drawdown (MaxDD) is 61%(blue line) which occurred during the 2008-2009 economic crisis period.

Here is a simple Tradingview Pinescript code which plot both Equity Drawdown and MaxDD. If you are a regular tradingview used and find it useful do let know in the comment section. If you are very new to tradingview platform then follow this tradingview tutorial

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © marketcalls_in
// Coded By Rajandran R - Founder - Marketcalls / Co-Founder Algomojo

//@version=2

study(title="Equity Drawdown - Marketcalls")

Eq=close
MaxEQ = Eq > MaxEQ[1] ? Eq : nz(MaxEQ[1], Eq)
DD = 100 * ( Eq - MaxEQ ) / MaxEQ
MaxDD = DD < MaxDD[1] ? DD : nz(MaxDD[1], DD)

plot(DD, color=red, title="Drawdown", style=area, linewidth=2, transp=40)
plot(MaxDD, color=blue, title="Max Drawdown", style=line, linewidth=3, transp=40)
Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Introducing OpenAlgo V1.0: The Ultimate Open-Source Algorithmic Trading Framework…

OpenAlgo V1.0 is an open-source algorithmic trading platform to automate your trading strategies using Amibroker, Tradingview, Metatrader, Python etc. Designed with the modern trader...
Rajandran R
2 min read

Dive Into the TradingView Paper Trading Competition: A Chance…

Welcome to an exhilarating opportunity presented by TradingView – a paper trading competition that not only tests your trading acumen but also offers a...
Rajandran R
1 min read

Introducing PineGPT – To Build Better Tradingview Pinescript Codes

PineGPT is a customGPT for ChatGPT4 users designed to provide expert guidance on creating and understanding TradingView Pine Script indicators and trading strategies. PineGPT...
Rajandran R
1 min read

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More