Using External *.set files

 
I have tried and tried but can not figure this out so hopefully someone can see the tree through the forest here.

I want to program an EA to use either it's programmed settings or else use an external *.set file.

So if:

extern bool UseExternSet = true;

it will use the settings in the external set file rather than the programmed settings.

Know it can be done but simple lost here.

Any ea example will do

Bernard
 
Pheniox:
I have tried and tried but can not figure this out so hopefully someone can see the tree through the forest here.

I want to program an EA to use either it's programmed settings or else use an external *.set file.

So if:

extern bool UseExternSet = true;

it will use the settings in the external set file rather than the programmed settings.

Know it can be done but simple lost here.

Any ea example will do

Bernard

i'm not sure. why don't u just load your set file manually when u apply your EA? it is more simple than must looking around its code?

 

When you set UseExternSet = false, it will use the hard-coded values set in the init() section, otherwise it will use the *.set file as per normal.

extern bool UseExternSet = true;
extern int var1,var2,var3...

int init()
{

if (!UseExternSet)
if (Symbol()=="EURUSD") { var1=1; var2=2; var3=3....} else
if (Symbol()=="USDJPY") { var1=1; var2=2; var3=3....} else
if (Symbol()=="NZDUSD") { var1=1; var2=2; var3=3....} else
Print("Does not compute...");
...
}

 
blogzr3:

When you set UseExternSet = false, it will use the hard-coded values set in the init() section, otherwise it will use the *.set file as per normal.

extern bool UseExternSet = true;
extern int var1,var2,var3...

int init()
{

if (!UseExternSet)
if (Symbol()=="EURUSD") { var1=1; var2=2; var3=3....} else
if (Symbol()=="USDJPY") { var1=1; var2=2; var3=3....} else
if (Symbol()=="NZDUSD") { var1=1; var2=2; var3=3....} else
Print("Does not compute...");
...
}

Great start here.


Since we are using an external *.set file we need to open the external file, readd it and then import the values from the external file.


What I want to do here is to have the EA running, set an internal timer and since I optimize several times a week I want to place the new optimized file in the presets folder, have the EA stop at a pre determined time, read the external file the import the new settings into the EA.

So

if (Symbol()=="EURUSD") { var1=1; var2=2; var3=3...


var1, var2 and var 3 if not more settings are actually located in the new optimized external file and the var settings in the EA are changed based on the external file settings.


I have read through the entire thread on auto automated optimization both english and Russian version and can not get it to work. Also the auto optimized routine take far too much resources on the computer and is not networkable. So if I can simply do this manually, the optimization part then transfer the new file to the trade server manually I am good to go.


So what we need to try to do is have the EA stop at a pre determined time, look for the external optimized file in the presets folder, open the external file, read it, and then place the new settings in the var variables you noted earlier.


Pheniox

 
What I want to do here is to have the EA running, set an internal timer and since I optimize several times a week I want to place the new optimized file in the presets folder, have the EA stop at a pre determined time, read the external file the import the new settings into the EA.

If I read you correctly, then just read "new optimized file" directly from your EA.


The *.set file is just a text file that you can File open and read and then set your variables according to what it finds.

 
blogzr3:

If I read you correctly, then just read "new optimized file" directly from your EA.


The *.set file is just a text file that you can File open and read and then set your variables according to what it finds.

Here is what a external set file looks like:




<inputs>
Broker=------Broker Five or Four Digit------
FiveDigitsBroker=1
SetTimeZone=+++Difference between Broker and GMT +++
GMTOffSet=2

TradingTime=Depending broker, Do not change Trading Time
OpenHour=18
CloseHour=22

S1=---------------- Entry Settings


S2=---------------- Money Management
Lots=0.10
RiskManagement=0
RiskPercent=10
MinProfit=100

There is a lot more information but what we want to look at and import into the EA are the new settings for :

ShortEma=2 // would be equal to var1=
MediumEma=12 // would be equal to var2=

LongEma=50 // would be equal to var3=


So if we set :


int init()
{

if (!UseExternSet)
if (Symbol()=="EURUSD") { ShortEma=1; MediumEma=2; LongEma=3....} else
if (Symbol()=="USDJPY") { var1=1; var2=2; var3=3....} else
if (Symbol()=="NZDUSD") { var1=1; var2=2; var3=3....} else
Print("Does not compute...");

...


So once the external file, lets call it optimize.set is opened and the results are taked it should change the settings in the above code to reflect what it finds and the EA should know somehow that tese are the setting that it should use.

Hope this explains it clearer.



Pheniox

 

I'm sure it's clearer now.


What is still unclear is what have you tried yourself, given the new information on optimize.set, so far?

Reason: