Parameters control the behavior of trading sessions and improve the quality of simulations.
Parameters are properties of trading sessions, defined by users, to determine their behavior and improve the quality of simulations.

The behavior of parameters may vary depending on the type of session.

Each testing session has its own set of parameters. This allows you to configure different trading sessions with different parameters, and go back and forth between them as required. For instance, you may have different backtesting sessions with different date ranges, different exchange fees or different slippage settings to account for different possible scenarios.


Parameters

Session Base Asset

Session Quoted Asset

Time Range

Time Frame

Slippage

Fee Structure

Snapshots

Heartbeats

User Defined Parameters

Session Base Asset

The base asset is the asset whose price is determined by the market. It is usually the first asset in the pair, as listed by the exchange.

Among other things, the parameter allows defining an initial balance of the corresponding asset, which may be used for trading with the corresponding trading system and trading session. Please see the configuration.

Click to learn more about session base assets

Adding a Session Base Asset Node

To add a parameter that may be missing, select Add Missing Params on the parameters node menu.

Configuring the Session Base Asset

Select Configure Base Asset on the menu to access the configuration.

{
"initialBalance": 0.001,
"minimumBalance": 0.0001,
"maximumBalance": 0.1
}
  • initialBalance is the amount of capital you wish to allocate to the trading system.

  • minimumBalance is the threshold of accummulated losses that switches off the session; when your overall balance (balanceAssetA + balanceAssetB) drops to this value, all trading stops; think of the minimumBalance as a general safety switch.

  • maximumBalance is a similar concept as with the minimumBalance but on the high side of the initialBalance.

Session Quoted Asset

The quoted asset is the asset on which the price of the base asset is denominated in the market. It is usually the second asset in the pair, as listed by the exchange.

The parameter allows defining an initial balance of the corresponding asset, which may be used for trading with the corresponding trading system and trading session. Please see the configuration.

Click to learn more about session quoted assets

Adding a Session Quoted Asset Node

To add a parameter that may be missing, select Add Missing Params on the parameters node menu.

Time Range

The time range parameter determines the period of time on which the trading session is run.

The parameter offers precise control over the duration, starting and ending points of the session. Several options are available, and there are differences in how backtesting and the rest of the types of trading sessions function in this regard.

Check the configuration to learn more.

Click to learn more about time ranges

Configuring the Time Range

Select Configure Time Range on the menu to access the configuration. The configuration varies slightly depending on the type of session you are running.

On Backtesting Sessions
{
"initialDatetime": "2019-09-01T00:00:00.000Z",
"finalDatetime": "2019-09-25T00:00:00.000Z"
}
  • initialDatetime is the datetime the session starts at.

  • finalDatetime is the datetime the session finishes at. If you don’t set a finalDatetime, the session runs until the date data is available.

On Paper Trading, Forward Testing and Live Trading Sessions
{
"initialDatetime": "2019-09-01T00:00:00.000Z",
"finalDatetime": "2019-09-25T00:00:00.000Z",
"allowStartingFromThePast": false
}
  • finalDatetime is the datetime the session finishes at. If you don’t set a finalDatetime at the level of the testing session or the trading system, then the session runs for one year.

By default, paper trading, forward testing and live trading sessions start at the datetime the session is run, that is, the present time. Such a behavior is in accordance with the most common use case, by which a user starting a new live trading session usually wishes the session to start at that moment.

However, users have requested to be allowed to start live sessions in the past. Such a feature may be useful, for example, to take an opportunity that was just missed for whatever reason, including technical ones.

  • initialDatetime, in combination with the allowStartingFromThePast parameter, is a hack to allow a live session to start from a date in the past. If there is a valid initialDatetime and allowStartingFromThePast is true, then the live session effectively starts from the specified date in the past. If allowStartingFromThePast is false the initialDatetime is ignored and the session starts from the present time.

  • allowStartingFromThePast may be true or false.

Time Frame

The time frame determines the collection of candles to be analyzed during a backtesting session, and the frequency with which the trading bot runs on paper trading, forward testing, and live trading sessions.

In the context of backtesting sessions, what time frame you decide to run the session depends on the trading system being tested. If the trading system makes decisions based on the 1-hour candle and above, then 01-hs may be the best choice. However, if decisions are influenced by sub-hour candles then you should match the time frame accordingly.

In other words, in backtesting sessions, you should match the time frame to the smallest period on which the trading system makes decisions.

In the context of live sessions, that is, paper trading, forward testing, and live trading, you should run the session on the 01-min time frame so that the trading bot reacts fast when the price tags the take profit or stop loss targets. Remember that stop and take profit orders are not placed at the exchange after the take position event, that is, once you enter the position. Instead, the trading bot checks the current price upon each execution cycle and determines whether targets have been hit or not. If targets are hit, only then orders are placed. That is why running live trading sessions at the 01-min time frame is recommended. Learn more about the management of take profit and stop loss targets.

If for whatever reason you don’t need to minimize the potential for slippage when hitting stop or take profit targets, you may choose whatever time frame you like, taking into account the explanations below.

Why the Time Frame Matters

Running trading sessions of any given trading system on different time frames may produce different results. This is because the behavior of a trading session may vary depending on how well the time frame on which the session is run matches the logic of the strategy.

This is why:

The trading bot evaluates closed candles only. At any given point in time, the current candle in each time frame is the candle that closed last.

For example:

Let’s say it’s 2020-06-11T11:39:30:00.000Z, that is, 11 hours, 39 minutes and 30 seconds of June 11th, 2020.

  • The current 1-minute candle is the one which closed at 11:38:59.999.
  • The current 5-minute candle is the one which closed at 11:34:59.999.
  • The current 30-minute candle is the one which closed at 11:29:59.999.
  • The current 1-hour candle is the one which closed at 10:59:59.999.
  • The current 2-hour candle is the one which closed at 09:59:59.999.
  • The current 6-hour candle is the one which closed at 05:59:59.999.
  • The current 24-hour candle is the one which closed at 23:59:59.999 of June 10th!

… and so on.

Let’s say the trading system implements conditions that evaluate 30-minute and 1-hour candles.

If a session is run at the 30-minutes time frame, all 30-minutes candles are evaluated. Also, all 1-hour candles are evaluated twice.

However, if the session is run at the 1-hour time frame, only one out of two 30-minute candles are evaluated.

And if the session is run at the 2-hour time frame, only one out of four 30-minute candles and one out of two 1-hour candles are evaluated.

This means that running the session (for this particular trading system) at the 30-minute time frame has higher probabilities of conditions evaluating 30-minute candles to be true during the session.

In other words, when running the session on time frames higher than the time frame on which decisions are made, chances are the bot will eventually skip candles on which conditions would have evaluated true, potentially skipping trading opportunities.

The above is true for all types of trading sessions.

Backtesting Vs. Live Sessions

In a backtesting session, the collection of candles evaluated is determined by the time frame selected to better simulate what would happen if the live trading session was run in the same time frame.

Click to learn more about time frames

Configuring the Time Frame

Select Configure Time Frame on the menu to access the configuration.

{
"value": "01-min"
}
  • value is the setting for the time frame. You may use any of the values below.

Available options at the sub-hour level are:

01-min
02-min
03-min
04-min
05-min
10-min
15-min
20-min
30-min
45-min

Available options at larger time frames are:

01-hs
02-hs
03-hs
04-hs
06-hs
08-hs
12-hs
24-hs

Slippage

The slippage is an assumption on the difference between the simulated rate and the actual fill rate of a market order, most relevant in the context of backtesting and paper-trading sessions. The parameter is a tool to make simulations more realistic.

In the context of forward testing and live trading sessions, slippage does not affect the actual transactions. However, the parameter is taken into account when creating the live trading simulation until the actual order fill values are obtained from the exchange.

Click to learn more about slippage

Configuring the Slippage

Select Configure on the menu to access the configuration.

{
"positionRate": 0.1,
"stopLoss": 0.2,
"takeProfit": 0.3
}
  • positionRate is the slippage value applied to the rate of all market orders throughout the position, expressed as a percentage (i.e.: 0.1 means 0.1%).

  • stopLoss is the slippage value applied to the stop loss target defined by the formulas of each stop loss phase in the manage stage of the trading system, expressed as a percentage (i.e.: 0.2 means 0.2%). The slippage value is applied to the value resulting from the corresponding stop loss formula, and the actual stop loss target is the resulting number. For example, if the stop loss formula results in 1000 and the stopLoss slippage value is 0.2, then the resulting stop loss target is 1000 ± 1000 * 0.2 / 100. Read below for an explanation on when the slippage is added or subtracted.

  • takeProfit works similarly as the stopLoss setting, but affecting the take profit target instead of the stop loss target.

The number you enter is applied as a percentage of the rate (of market orders in the case of positionRate and stop loss and take profit targets in the latter cases) and added to or subtracted from the price depending on the circumstances, always working against you. For instance, "positionRate": 0.1 means that market orders will be set at a rate 0.1% worse than ideally.

Slippage is added or subtracted depending on how you define your trading system, but the application is automatic, so you do not need to know every detail. However, if you do wish to understand the details, you need to learn about how the open and close stages are defined in term of the initial targets, along with stop loss and take profit targets in the manage stage. Read about the Open Stage Initial Targets

Fee Structure

The fee structure is a parameter fundamental to the calculation of fees, both in testing and live trading sessions.

Exchange fees are a crucial part of trading. A strategy may work like a charm when you leave fees out of the equation but would lead you to bankruptcy in a live trading situation.

Exchanges don’t usually report the amount charged in fees on each transaction, thus, the system calculates fees and subtract them from balances. Learn more about the handling of fees.

To illustrate how fees affect your bottom line, take a look at the image below.

Trading-Simulation-Fees-Fails

The trade hits the take profit target above the Position Rate level, however, due to fees, the trade has a negative 0.32% ROI.

Click to learn more about fee structures

Configuring the Fee Structure

Select Configure Fee Structure on the menu to access the configuration.

{
"maker": 0.15,
"taker": 0.25
}
  • maker is the setting for the fee the exchange charges when an order adds liquidity to the market, such as with limit orders.

  • taker is the setting for the fee the exchange charges when an order takes liquidity from the market, such as with market or instant orders.

Snapshots

Snapshots are CSV files output by the trading bot listing every trade in a backtesting session. The snapshots parameter determines whether snapshots shall be produced, and how.

Learn more about snapshots and check the configuration file to control if and how snapshots are produced.

Click to learn more about snapshots

Configuring the Snapshots

Select Configure Slippage on the menu to access the configuration.

{ 
   "strategy": true,
   "position": true
}
  • strategy determines whether to take a snapshot at the trigger on event or not; possible values are true or false.

  • position determines whether to take a snapshot at the take position event or not; possible values are true or false.

Heartbeats

During a trading session, the backend communicates with the frontend via heartbeats to inform the frontend about the status of the session. The parameter controls what information is made available to the user through the frontend.

This parameter affects how you see the progress of the trading session below the trading bot instance node on the design space.

Click to learn more about heartbeatss

Configuring the Heartbeats

Select Configure Slippage on the menu to access the configuration.

{ 
   "date": true,
   "candleIndex": false
}
  • date determines whether the date is shown in the progress notice below the trading process instance node; possible values are true or false.

  • candleIndex determines whether the index of the candle is shown in the progress notice below the trading process instance node; possible values are true or false.

User Defined Parameters

Users may define parameters to be used within the trading system during the trading session.

Parameters defined in the configuration file of these node become available to trading systems using the following path: sessionParameters.userDefinedParameters.config.parameterName.

These parameters may be useful, for example, when you wish to use a constant multiple times across several nodes in the definition of a strategy. Instead of feeding a constant value to all formulas involved, you may feed the parameter instead. This gives you the added benefit of being able to change the value of such a constant in a single point.

Click to learn more about user defined parameterss

Configuring the User Defined Parameters

Select Configure Slippage on the menu to access the configuration.

{ 
   "param1Name": "A text string value example",
   "param2Name": 0
}
  • param1Name is an example of a name. You may change the names of the parameters as required. Values including text strings go between quotation marks, while numeric values, without. You may define as many parameters as you wish; simply separate them with a comma to keep a valid JSON format for the configuration file.