Error in backtesting using this code: MarketData.GetBars
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
Replies
8034130
13 May 2025, 19:06
RE: Error in backtesting using this code: MarketData.GetBars
firemyst said:
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.
Thank you for your reply!
Always the same error, also with:
MarketData.GetBars(TimeFrame.Renko20, “EURGBP”)
Do you have a solution ?
Best regards
@8034130
8034130
15 May 2025, 17:32
RE: RE: Error in backtesting using this code: MarketData.GetBars
8034130 said:
firemyst said:
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.
Thank you for your reply!
Always the same error, also with:
MarketData.GetBars(TimeFrame.Renko20, “EURGBP”)
Do you have a solution ?
Best regards
Thank you for your reply!
I have always the same error, also with:
MarketData.GetBars(TimeFrame.Renko20, “EURGBP”)
Do you have a solution ?
Best regards
@8034130
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