Automatically setting InitialDeposit via Ini file or some other means

 

Does anyone know how to set the InitialDeposit from an .ini file configuration, an EA, or some other means?


I'm working on some fully automatic AI training in the strategy tester and this is the only thing I haven't been able to automatically set.


I'd be happy if it can be set anywhere in any configuration file.


Any help would be greatly appreciated.


-Thanks!

 

There are several ways. One such can be:


int loadParameters(string file_name)
{
int handle=FileOpen(file_name,FILE_READ|FILE_CSV,';');
if(handle<1) {
Print("ERROR: "+file_name+ " not found, the last error is ", GetLastError());
return(0);
}

while(!FileIsEnding(handle))
{ // stuff here is just to illustrate the idea...
string param=FileReadString(handle,0);
string value=FileReadString(handle,0);
Print(param," has value ",StrToDouble(value));
if(param=="stopLoss")
Print("setting stopLoss to value ", value);
}
FileClose(handle);
}



int start()

{

static int timeout_cfg=0;
if(TimeCurrent()- timeout_cfg>PERIOD_M15*60)

{ // load parameters each 15 minutes
loadParameters("xpto.txt");
timeout_cfg= TimeCurrent();
}

//.... your code here

//....

}


inside file xpto.txt

takeProfit; 80.0
stopLoss; 40.0
trailingStop; 20.0



when live trading, configuration file is put at folder C:\interbankfx4\experts\files (or equivalente path in your system)

when back-testing, configuration file is put at folder C:\interbankfx4\tester\files (or equivalente path in your system)


Have fun.

 

I had actually figured it out. I have the EA copy expertname.ini from tester/ to experts/files, have the EA make the appropriate changes to initialdeposit and the respective currency for the account, then I write the changes and have the EA copy the file back over for the automated test.


Thanks. :)


the file i was looking for was:


[metatrader client dir]/tester/expertname.ini





abstract_mind wrote >>

There are several ways. One such can be:


int loadParameters(string file_name)
{
int handle=FileOpen(file_name,FILE_READ|FILE_CSV,';');
if(handle<1) {
Print("ERROR: "+file_name+ " not found, the last error is ", GetLastError());
return(0);
}

while(!FileIsEnding(handle))
{ // stuff here is just to illustrate the idea...
string param=FileReadString(handle,0);
string value=FileReadString(handle,0);
Print(param," has value ",StrToDouble(value));
if(param=="stopLoss")
Print("setting stopLoss to value ", value);
}
FileClose(handle);
}



int start()

{

static int timeout_cfg=0;
if(TimeCurrent()- timeout_cfg>PERIOD_M15*60)

{ // load parameters each 15 minutes
loadParameters("xpto.txt");
timeout_cfg= TimeCurrent();
}

//.... your code here

//....

}


inside file xpto.txt

takeProfit; 80.0
stopLoss; 40.0
trailingStop; 20.0



when live trading, configuration file is put at folder C:\interbankfx4\experts\files (or equivalente path in your system)

when back-testing, configuration file is put at folder C:\interbankfx4\tester\files (or equivalente path in your system)


Have fun.

 

Does anyone know how to set the InitialDeposit from an .ini file configuration, an EA, or some other means?

extern double InitialDeposit = 10000.00;

Reason: