| Name1, Name2 ... |
Up to 40 arguments, all different, usually strings with an asset or algo name. |
| Assets |
Predefined array with all asset names; used for enumerating all assets in the asset list. |
| Algos |
Predefined array, set up by script to a list of all algo names. |
The following variables are valid after a loop
call (not for of):
// of() nesting
string Str1,Str2,Str3;
while(Str1 = of("AA","BB","CC"))
while(Str2 = of("XX","YY","ZZ"))
while(Str3 = of("11","22","33"))
printf("\n %s %s %s",Str1,Str2,Str3);
// filling a string array
string Strings[5];
for(i=0; Strings[i]=of("A","B","C","D","E"); i++);
// portfolio strategy with 3 assets and 3 trade algos,
// all components separately trained, using loop()
function tradeTrendLong()
{
var MyParameter = optimize(...);
...
}
function tradeTrendShort()
{
var MyParameter = optimize(...);
...
}
function tradeBollinger()
{
var MyParameter = optimize(...);
...
}
function run()
{
while(asset(loop("EUR/USD","USD/CHF","GBP/USD"))) // loop through 3 assets
while(algo(loop("TRL","TRS","BOL"))) // and 3 different trade algorithms
{
if(Algo == "TRL") tradeTrendLong();
else if(Algo == "TRS") tradeTrendShort();
else if(Algo == "BOL") tradeBollinger();
}
}
// portfolio strategy with 3 assets and 3 trade algos,
// with common trained parameters
var CommonParameter;
function tradeTrendLong()
{
...
}
function tradeTrendShort()
{
...
}
function tradeBollinger()
{
...
}
function run()
{
asset("EUR/USD"); // select one of the assets for the common parameter
CommonParameter = optimize(...);
while(asset(of("EUR/USD","USD/CHF","GBP/USD"))) // loop through 3 assets witrh no specific optimization
{
algo("TRL"); tradeTrendLong();
algo("TRS"); tradeTrendShort()
algo("BOL"); tradeBollinger()
}
}
// portfolio strategy with 3 assets and 3 trade algos,
// with a combination common and separately trained parameters,
// using of()
var CommonParameter,MyParameter1,MyParameter2,MyParameter3;
function tradeTrendLong()
{
// uses CommonParameter,MyParameter1;
...
}
function tradeTrendShort()
{
// uses CommonParameter,MyParameter2;
...
}
function tradeBollinger()
{
// uses CommonParameter,MyParameter3;
...
}
function run()
{
...
asset("EUR/USD"); // select asset for optimize()
CommonParameter = optimize(...);
MyParameter1 = optimize(...);
MyParameter2 = optimize(...);
MyParameter3 = optimize(...);
while(asset(of("EUR/USD","USD/CHF","GBP/USD"))) // loop through 3 assets
while(algo(of("TRL","TRS","BOL"))) // and 3 different trade algorithms
{
if(Algo == "TRL") tradeTrendLong();
else if(Algo == "TRS") tradeTrendShort();
else if(Algo == "BOL") tradeBollinger();
}
}