Name1, Name2 ... |
Up to 40 pointers, all different, normally strings with an asset or algo name. |
Assets |
Predefined array with all asset names; used for enumerating all assets in the asset list. |
The following variables are valid after a loop
call (not used 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, using for(used_assets)
var CommonParameter;
function tradeTrendLong()
{
...
}
function tradeTrendShort()
{
...
}
function tradeBollinger()
{
...
}
function run()
{
asset("EUR/USD");
asset("USD/CHF");
asset("GBP/USD"); // select 3 assets
CommonParameter = optimize(...);
for(used_assets) // loop through the 3 assets
{
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 before 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();
}
}