AccountEquity() as indicator? - page 3

 

Thank you, now everything is complied. But I am to stupid so it isn't running untill now.

I did the following steps:

1. offline_charts.mqh in the include-folder and compiled

2. The following file "Kontostand.mq4" in the indicator-folder and compiled:

#property indicator_separate_window

#include <offline_charts.mqh>

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
recordEquity("Universal_EA", PERIOD_M5, 1002);
return(0);
}

3.In the start-Function of my "Universal_EA" I put the following line:

iCustom(NULL,0,"Kontostand",0,0);

1002 is the magicnumber of my "Universal_EA"-trades.

What did I wrong and where is my chart?

THANK YOU!!

 

you have to include offline_charts.mqh in your ea

it doesnt need to be compile separately, it compiles with your ea

in the start function of the ea call recordEquity once,

the chart can be found in the history folder, in the folder of your account or the account you currently using while testing

you can open the chart in terminal File -> OpenOffline, the navigate to the folder and choose the filename, in your cas Universal_EA,

while testing a prefix "_" is added to the filename

 
sunshineh:

Thank you, now everything is complied. But I am to stupid so it isn't running untill now.

I did the following steps:

1. offline_charts.mqh in the include-folder and compiled

2. The following file "Kontostand.mq4" in the indicator-folder and compiled:

#property indicator_separate_window

#include <offline_charts.mqh>

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
recordEquity("Universal_EA", PERIOD_M5, 1002);
return(0);
}

3.In the start-Function of my "Universal_EA" I put the following line:

iCustom(NULL,0,"Kontostand",0,0);

1002 is the magicnumber of my "Universal_EA"-trades.

What did I wrong and where is my chart?

THANK YOU!!



You could make it without the indicator.


Just put the following lines into your EA:

#include <offline_charts.mqh>


and at the beginning of the EA's start function:

int start(){
recordEquity("Universal_EA", PERIOD_M5, 1002);


Be careful with the names, the name must not be longer than 12 characters.


Then compile the EA and let it run. It will NOT draw the equity chart backwards, only beginning from the moment you first started it. The chart will start at a fictive balance of $5000. This is because it records only a part of the trades, only those with this magic number, so it can not use the absolute account equity which would always include all other trading too. On a demo account you might get strange gaps in the chart when old trades are deleted from the account history by the broker. this should not happen on a live account.


Then, when it is running, select in the metatrader menu -> "File" -> "open offline" and open the chart.

 
It works!!! Lots of thanks!!!! That is really great!!
Reason: