BacktestingDataMode usage
BacktestingDataMode usage
13 Sep 2024, 11:59
Can I check the back testing data mode in my cBot code to handle different scenarios accordingly, such as loading different data files or adjusting your strategy logic like below?
The following code doesn't compile.
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class BacktestingDataModeCheckBot : Robot
{
protected override void OnStart()
{
// Check the current backtesting data mode
if (BacktestingDataMode == BacktestingDataMode.M1Csv)
{
Print("Backtesting using M1 CSV data mode.");
// Perform specific logic for M1 CSV mode
}
else
{
Print("Backtesting using a different data mode.");
// Perform different logic for other data modes
}
}
protected override void OnTick()
{
// Your strategy logic here
}
}
}
PanagiotisCharalampous
14 Sep 2024, 05:06
Hi there,
This property is not available in cBots. It is only available in plugins.
Best regards,
Panagiotis
@PanagiotisCharalampous