Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. 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. Building GenAI Applications. 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

Fisher Transform – Amibroker AFL Code

The Fisher Transform is a technical analysis indicator developed by John F. Ehlers, designed to identify potential turning points in the price movements of...
Rajandran R
2 min read

My Experience Converting SSL Hybrid from PineScript to Amibroker…

As a trader and coding enthusiast, I often find myself needing to translate trading indicators from one programming language to another. Recently, I embarked...
Rajandran R
8 min read

Line Trading – OpenAlgo Automation Module for Amibroker Users

The line Trading Automation tool is designed for Manual traders who want to perform level-based trade execution faster and also bring some advanced trade...
Rajandran R
59 sec read

Leave a Reply

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