Hi Jcl,
Thank you for your response.
I have modified the function according to your comments :
function TradeBBands()
{
var NbDevUp=1.7;
var NbDevDn=1.7;
var MaxTradePerAsset = 4;
vars Price = series(price());
BBands((series(1000*priceClose())),20,NbDevUp,NbDevDn,MAType_SMA);
vars upperBand = series(rRealUpperBand/1000);
vars lowerBand = series(rRealLowerBand/1000);
Lots = 1;
if (crossUnder(Price, lowerBand) && NumOpenLong <MaxTradePerAsset)
{
TakeProfit = 1.0375*price();
enterLong();
}
}
function run()
{
set(LOGFILE+PRELOAD+NFA+TICKS);
BarPeriod = 15;
Weekend = 0;
Verbose=7;
Capital = 0.009;
StartDate = 20150615;
EndDate = 20171001;
assetList("AssetsToUse.csv"); // load asset list
while (asset(loop(Assets)))
{
TradeBBands();
}
}
Tested it again and the issue is still present.
The trade is close at the right time only for one asset.
I don't know what variable I can check to diagnose the faulty element. Do you have any tips ?
BR, Johan