Skip to content

RunningMode

Summary

Defines if a cBot is running in real time, in the silent backtesting mode, in the visual backtesting mode, or in the optimization mode.

Signature

1
public enum RunningMode

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 using cAlgo.API;
 namespace cAlgo.Robots
 {
     // This sample shows how to use the RunningMode property of your robot
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class RunningModeSample : Robot
     {
         protected override void OnStart()
         {
             switch (RunningMode)
             {
                 case RunningMode.RealTime:
                     // If the robot is running on real time market condition
                     break;
                 case RunningMode.SilentBacktesting:
                     // If the robot is running on backtest and the visual mode is off
                     break;
                 case RunningMode.VisualBacktesting:
                     // If the robot is running on backtest and the visual mode is on
                     break;
                 case RunningMode.Optimization:
                     // If the robot is running on optimizer
                     break;
             }
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 import clr
 clr.AddReference("cAlgo.API")
 # Import cAlgo API types
 from cAlgo.API import *
 # Import trading wrapper functions
 from robot_wrapper import *
 class Test():
     def on_start(self):
         #  Print the error to the log
         match api.RunningMode:
             case RunningMode.RealTime:
                 print("RealTime")
             case RunningMode.SilentBacktesting:
                 print("SilentBacktesting")
             case RunningMode.VisualBacktesting:
                 print("VisualBacktesting")
             case RunningMode.Optimization:
                 print("Optimization")

See Also

Fields

RealTime

Summary

The cBot is running in real time.

Signature

1
RunningMode.RealTime;

Return Value

RunningMode

SilentBacktesting

Summary

The cBot is running in the silent backtesting mode.

Signature

1
RunningMode.SilentBacktesting;

Return Value

RunningMode

VisualBacktesting

Summary

The cBot is running in the visual backtesting mode.

Signature

1
RunningMode.VisualBacktesting;

Return Value

RunningMode

Optimization

Summary

The cBot is running in the optimization mode.

Signature

1
RunningMode.Optimization;

Return Value

RunningMode