Strategy 1 [Test]
function run() {
NumYears = 1;
while(asset(loop("GBP/USD"))) {
while(algo(loop("ALGO1", "ALGO2"))) {
TakeProfit = 100 * PIP;
Stop = 100 * PIP;
if (Bar % 99 == 0) {
enterLong();
}
}
}
}
Produces
Portfolio analysis OptF ProF Win/Loss Wgt%
ALGO1 avg .000 0.91 29/31 50.0
ALGO2 avg .000 0.91 29/31 50.0
GBP/USD:ALGO1 .000 0.91 29/31 50.0
GBP/USD:ALGO1:L .000 0.91 29/31 50.0
GBP/USD:ALGO1:S .000 ---- 0/0 -0.0
GBP/USD:ALGO2 .000 0.91 29/31 50.0
GBP/USD:ALGO2:L .000 0.91 29/31 50.0
GBP/USD:ALGO2:S .000 ---- 0/0 -0.0
Expected a "avg" line for each of 2 algos and 1 asset that were looped over.
Observed that the line like "GBP/USD avg 0.91 58/62" is absent.
I arrived at this expectation after observing that Strategy 2 [Test]:
function run() {
NumYears = 1;
while(asset(loop("GBP/USD", "EUR/USD"))) {
while(algo(loop("ALGO1"))) {
TakeProfit = 100 * PIP;
Stop = 100 * PIP;
if (Bar % 99 == 0) {
enterLong();
}
}
}
}
Produces
Portfolio analysis OptF ProF Win/Loss Wgt%
EUR/USD avg .000 0.41 19/41 89.8
GBP/USD avg .000 0.91 29/31 10.2
ALGO1 avg .000 0.62 48/72 100.0
EUR/USD:ALGO1 .000 0.41 19/41 89.8
EUR/USD:ALGO1:L .000 0.41 19/41 89.8
EUR/USD:ALGO1:S .000 ---- 0/0 -0.0
GBP/USD:ALGO1 .000 0.91 29/31 10.2
GBP/USD:ALGO1:L .000 0.91 29/31 10.2
GBP/USD:ALGO1:S .000 ---- 0/0 -0.0
which does contain a line for each of the 2 assets and the 1 algo even though there is only 1 algo.
So a loop of 1 asset behaves differently than a loop of 1 algo. I would rather they both behave like the second example. Nothing special should happen for a loop of length 1, compared to 2. I still want an average stat even if there is only 1 asset.