Posted By: edu
Number of trades in an asset loop - 03/08/21 10:46
Hi everyone
I dont understand why the number of trades that I get when I run a script with an asset loop is not equal to the sum of trades that I get when I run the same script on each asset individually.
Shouldn’t they be the same?
For example:
Script run for each pair individually
Number of trades:
EURUSD: 281
GBPUSD: 298
USDCAD: 271
AUDUSD: 304
----------------------------
Sum: 1154
Script run using an asset loop
Number of trades: 964
Here's the code I used
Thanks in advance
I dont understand why the number of trades that I get when I run a script with an asset loop is not equal to the sum of trades that I get when I run the same script on each asset individually.
Shouldn’t they be the same?
For example:
Script run for each pair individually
Number of trades:
EURUSD: 281
GBPUSD: 298
USDCAD: 271
AUDUSD: 304
----------------------------
Sum: 1154
Script run using an asset loop
Number of trades: 964
Here's the code I used
Thanks in advance
Code
function run() { StartDate = 2010; EndDate = 2020; BarMode = BR_FLAT; set(PARAMETERS+TESTNOW); BarPeriod=60; NumWFOCycles=3; LookBack = 500; Capital = 1000000; while(asset(loop("EUR/USD","GBP/USD","USD/CAD","AUD/USD"))) { vars Price = series(price()); int MMP = optimize(300,200,400,40); vars MM1 = series(LowPass(Price, MMP)); int MMIP = 300; vars MMI_Raw = series(MMI(Price,MMIP)); vars MSmooth = series(LowPass(MMI_Raw,300)); if( NumOpenLong < 1 and valley(MM1) and falling(MSmooth) ) enterLong(); if( NumOpenShort < 1 and peak(MM1) and falling(MSmooth) ) enterShort(); Stop = ATR(25)*3; Trail = ATR(25)*3; } }