Error in backtesting using this code: MarketData.GetBars
Created at 12 May 2025, 17:15
Error in backtesting using this code: MarketData.GetBars
12 May 2025, 17:15
Hi,
I have this error during backtesting (version. 5.2.11.39935) :
Error | Failed to get symbol 'EURGBP': Symbol not found or has no quotes.
Info | Not Done with : EURGBP Renko20 at Robots.Test.OnStart() in .cs:line 211 Object reference not set to an instance of an object.
Here is my code:
foreach (var lTimeFrame in mTimeFrames.Keys)
{
foreach (string lSymbol in mSymbolFrom)
{
Bars lBars = MarketData.GetBars(lTimeFrame, lSymbol); //This line cause the error, cause lbars => null after this initialisation
}
}
FxPro is the broker.
Can you correct this bug ?
Best regards Frank
firemyst
13 May 2025, 03:38
Hard code it in there as a parameter and see if that works.
eg: MarketData.GetBars(lTimeFrame, “EURGBP”)
If you have a spread-betting account, some times those accounts have slightly different symbol names to indicate they're spread betting.
@firemyst