Equity Recorder – library MetaTrader 4

I often see people post “equity” curves from the backtester, showing only smooth lines and ignoring any drawdown between opening and closing a trade. Since MetaTrader only plots a new datapoint in the equity plot when a trade is closed, you simply can not get realistic plots. Also the time is completely missing, the x axis shows the number of trades and does not draw a clear picture of the time you would have waited. In general the equity plots produced by the backtester always tend to look much nicer than they really are.

This is about to change now!

Attached is a library that will allow you to produce realistic plots of the total equity (the only important number) versus time. The plots are saved as offline charts, you can view and analyze them just like ordiary charts.

Put the library into the include folder, include it in your EA and on every tick you call the function recordEquity() with name, period and magic number. Thats all!

The function can also be used to create plots of manual or automated trading in real time filtered by magic number and/or comment string. Use it to monitor the individual performances of your concurrently running EAs in separate charts. When in backtesting mode the name of the chart file will always be prepended with an underscore, so it doesn’t interfere with the live chart the same EA may have already produced over time.

If you want to make a plot of closed source EAs or of your manual trading then simply create an indicator with recordEquity() calls for every magic number or comment string you want to record in the start() function and attach it to any chart: 

Alternative:   ColorStochastic_HTF - indicator MetaTrader 5

Example code for using this library in such an indicator would look like this:


Attached is an image of an example plot. It is a simple grid system and the above library was used in the EA to create this equity chart:


Example Plot

📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks