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

Plotting Day Wise Equity Curve using Amibroker

1 min read

We know that Amibroker provides an equity curve for the whole strategy. Is there a way where we can build a simple Day Wise PNL to get a better idea about which day’s strategy is performing better to fine-tune the trading system?

It helps traders to avoid non-performing days. For example, if Friday’s Signal performance is not good then one can eliminate trading the system on Fridays.

Here is the simple visualization of Day Wise PNL (Monday Equity Curve, Tuesday Equity Curve ….. Friday Equity Curve)

Sample Trading Amibroker AFL Template to build Day Wise Equity Curve

_SECTION_BEGIN("Simple Two EMA Crossover Trading System");

SetChartOptions(0,chartShowArrows|chartShowDates);
SetPositionSize(1*RoundLotSize,spsShares);

shortema = Optimize("Short EMA",3,1,50,1);
longema = Optimize("Long EMA",13,1,50,1);

ema1 = EMA(Close,shortema);
ema2 = EMA(Close,longema);



//Trading Strategy

Buy = Cross(ema1,ema2); //bullish ema crossover - short MA crossing up long MA
Sell = Cross(ema2,ema1); //bearish ema crossover - long MA crossing down short MA



SetTradeDelays(0,0,0,0);

BuyPrice = ValueWhen(Buy,Close);
SellPrice = ValueWhen(Sell,Close);


iBuy = Buy;
iSell = Sell;

Buy = iBuy AND DayOfWeek()==1;
Sell = iSell;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

e1 = Equity(1,0);

Buy = iBuy AND DayOfWeek()==2;
Sell = iSell;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

e2 = Equity(1,0);

Buy = iBuy AND DayOfWeek()==3;
Sell = iSell;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

e3 = Equity(1,0);

Buy = iBuy AND DayOfWeek()==4;
Sell = iSell;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
e4 = Equity(1,0);

Buy = iBuy AND DayOfWeek()==5;
Sell = iSell;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
e5 = Equity(1,0);

Plot(e1,"Eq-Monday",colorGreen,styleThick,styleOwnScale);
Plot(e2,"Eq-Tuesday",colorblue,styleThick,styleOwnScale);
Plot(e3,"Eq-Wednesday",colorRed,styleThick,styleOwnScale);
Plot(e4,"Eq-Thursday",colorYellow,styleThick,styleOwnScale);
Plot(e5,"Eq-Friday",colorPink,styleThick,styleOwnScale);


_SECTION_END();

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

Interactive Brokers – Smart Order Chart Trading Module using…

The IB Controller is an interface designed to facilitate automatic trading with AmiBroker and Interactive Brokers (IB) TWS (Trader Workstation). It serves as a...
Rajandran R
8 min read

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

[Live Coding Webinar] Build Your First Trading Bridge for…

In this course, you will be learning to build your own trading bridge using Python. This 60-minute session is perfect for traders, Python enthusiasts,...
Rajandran R
1 min read

Leave a Reply

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