#
#
7. Parameters Description

#
#
7.1. Terminology

This section defines terms and values that are not direct parameters of portfolios, instruments, or connections, but are used throughout parameter descriptions.

#
#
7.1.1. lot_size

A multiplier used to convert order/trade quantities and positions from integers to fractional values.
All quantities in orders/trades and positions within the robot are stored as integers to avoid precision issues when working with floating-point arithmetic.

To convert to the same unit scale as displayed on exchange websites (for exchanges that allow fractional values in these fields), the lot_size multiplier is applied:

  • Integer → Fractional: multiply the integer value by lot_size.
  • Fractional → Integer: divide the fractional value by lot_size.

Example:
For many cryptocurrency spot instruments, quantities are quoted with up to 8 decimal places. In such cases, the lot_size equals 0.00000001.

#
#
7.2. Portfolio Parameters

This section describes portfolio parameters. All parameters are editable unless explicitly stated otherwise.
Some parameters are grouped for clarity.

#
#
7.2.1. Name

The portfolio name. Only Latin letters and digits are allowed, up to 30 characters.
The name of an existing portfolio cannot be edited.
To change the name: stop trading, clone the portfolio, set the desired name for the clone, and delete the original portfolio.

#
#
7.2.2. re_sell / re_buy

Enables selling/buying.
When checked, enables the robot for selling/buying.

Important! Unchecking re_sell or re_buy resets the robot’s error counter.

#
#
7.2.3. Type

Defines the trading algorithm type for the portfolio:

  • Arbitrage — Standard arbitrage trading using all configured parameters.
    The order is placed first for the Is first instrument. Once executed, orders are placed for the other instruments in the portfolio.

  • Option hedge — Arbitrage trading with options and automatic Count calculation for both legs.
    Intended for trading an option + underlying asset pair.
    The main leg is the option. The option Count is automatically calculated using the Black–Scholes model so that the option delta equals 1.
    The second leg always has Count = 1.
    Example: If the delta of 1 option lot = 0.5, then:

    • Option leg count = 2
    • Underlying leg count = 1
  • TP algo — Trading mode with a single “take profit” order placed for the main instrument.
    Only one TP order is maintained. After a non-TP order is executed, the TP order is canceled and replaced with a new volume.
    No orders are placed for the second leg.

  • TP algo 2 — Trading mode with “take profit” orders placed for the main instrument.
    After each execution of a non-TP order, a new TP order is placed.
    Each TP order has a Timer and SL.
    Orders for the second leg are placed in the same way as in Arbitrage.

    Important! If Hedge (sec) is enabled, then every Hedge (sec) seconds, if the main instrument’s portfolio position is non-zero and there are no active or pending orders reducing it to zero, an order is placed to flatten the position.
    This rule also applies to positions opened manually (via “clicker”).
    Closing via Hedge (sec) is possible only after trades on the main instrument have been executed by the algorithm (not manually). If no trades have occurred, there are no reference prices to place TP orders from.

#
#
7.2.4. Type trade

Defines the trading mode used for calculating Sell/Buy and Price_s/Price_b:

  • Price — trading based on instrument prices (bid and ask).
  • IV — volatility trading, using implied volatility values derived from instrument prices with the Black–Scholes model.

#
#
7.2.5. Type price

Defines how the instrument price is determined:

  • Bid/ask — use the best bid and the best ask price.
  • Orderbook — search for the required volume in the order book. Prices are aggregated starting from the best price in the chosen direction, moving deeper into the book, until the required volume is collected.
    The target volume is calculated by the formula:

Count×Percentofquantity×0.01×{v_in_left,ifopenposev_out_left,ifclosepose,Count \times Percent\enspace of\enspace quantity \times 0.01 \times \begin{cases} v\_in\_left, &\text{if } \enspace open\enspace pose\\ v\_out\_left, &\text{if } \enspace close\enspace pose \end{cases},

  • Orderbook+filter — same as Orderbook, but excludes the robot’s own orders if they are present at the corresponding prices.

Order book depth is determined by the portfolio instrument parameter Depth OB.


#
#
7.2.6. Quote

Controls quoting behavior for the Is first instrument.

  • If enabled, an order for the Is first instrument is always maintained in the order book.
  • If disabled, orders for the Is first instrument are placed only under these conditions:

#
#
7.2.7. Order ID

Identifier for all portfolio orders. Also determines the execution priority of the portfolio’s trading algorithm.

Example:
Suppose multiple portfolios contain the same instrument. When the best bid or ask for that instrument changes, the trading algorithm is triggered for all such portfolios.
Execution order is based on ascending Order ID:

  • The portfolio with the smallest Order ID runs first.
  • The portfolio with the largest Order ID runs last.

If two portfolios share the same Order ID, their execution order is undefined and may vary.


#
#
7.2.8. Hedge (sec)

Time interval in seconds after which any unhedged position is automatically hedged if the second-leg order was not placed by the algorithm (e.g., due to exchange-side technical issues, rate-limit restrictions, or other non-market conditions).

  • If set to -1, unhedged position checks are disabled.

Note:
If the position mismatch exceeds the Overlay value (including active orders), a correcting order is placed without canceling existing active orders.

  • When a correcting order is placed, the error counter for that instrument is reset.
  • Mismatches are calculated separately for each second-leg instrument.
  • At most one correcting order can be active per second-leg instrument at a time.
  • If the correcting order is not executed, it is re-submitted once per second.

#
#
7.2.9. Only maker

For quoting mode (Quote), places orders for the Is first instrument with the maker only flag (cancel if the order would act as a taker), provided the exchange supports this order type.

Important!
When using this parameter, it is strongly recommended to also enable Simply first to avoid an excessive number of rejected transactions (e.g., when an order unintentionally crosses the book). Otherwise, frequent rejections may trigger exchange sanctions.

#
#
7.2.10. Simply first

When enabled, if Price_s/Price_b fall into a wide spread or move to the opposite side of the order book, first-leg orders will always be placed no deeper than one price step into the spread (i.e., at the best available price in the order book).

Additionally, during quoting, this condition is maintained dynamically as the order book updates. For example:

  • If another order is placed ahead of the robot’s order.
  • Or if orders behind the robot’s order are canceled, creating a gap greater than one price step.

In such cases, the robot’s order will automatically be adjusted.

The resulting placement logic for first-leg orders is as follows:

Price_s1=max(Price_s0,askstep),Price\_s_1=\max\left(Price\_s_0,ask-step\right),

Price_b1=min(Price_b0,bid+step),Price\_b_1=\min\left(Price\_b_0,bid+step\right),

Here, bid, ask, and step represent the bid, ask, and price step of the Is first instrument.
The subscript 0 denotes the current value of a parameter, while subscript 1 denotes the new value.

If the Is first instrument has the Only Maker flag enabled and the current spread equals one price step, then:

  • The sell order will be placed at ask.
  • The buy order will be placed at bid.

Otherwise, the order could not be placed and would generate unnecessary transaction attempts (“spam”) on the exchange.

Important! If our order is the bid or offer and is the only order at that price level, then in the previous formula, the bid and offer used are taken excluding our order from the order book.

Important! If the calculated order price falls outside the instrument's allowed price range, the price will be adjusted to the nearest boundary (i.e., if the calculated price is below the minimum allowed price, the minimum allowed price is used; if it exceeds the maximum allowed price, the maximum allowed price is used).

Important! To use this parameter correctly, market depth (order book) data for the main instrument must be available. Therefore, for market data connections where the order book is enabled via a separate stream, this stream must be activated. On crypto markets, when using this flag, avoid connections whose names end with _top, as they do not provide order book data.

Non-obvious point!
All of the above applies only if the calculated prices Price_s/Price_bfall into the wide spread or on the opposite side of the order book. If these prices fall on the "same" side of the book (buy price within buy levels, sell price within sell levels), the Simply first parameter has no effect on the prices.

Moreover, if the condition specified by the Threshold, parameter is met, the price recalculation via Simply first will also not be performed.

#
#
7.2.11. Equal prices

If the checkbox is not set, the price of the second leg is determined based on the prices that were present at the moment the signal was generated to place an order for the is first instrument. If the checkbox is set, the order for the second leg will be placed at such a price that Sell = Lim_sell and Buy = Lim_buy (works only for portfolios with two financial instruments).
Thus, the prices in the orders will strictly match Lim_sell, even if better prices were available at the moment.

Enabling this parameter reduces the number of negative slippages on the second leg but also decreases the number of positive slippages (when you buy at a better price than intended).

Example: the first leg's price is 100, the second leg's price is 95. We want to buy the first leg at 100, provided the second leg is also at 100, i.e., the spread is zero. At the moment, the market in the second leg suddenly spikes up to 110. If the checkbox is enabled, we will buy the first leg at 100 and attempt to sell the second leg at 100 (since a zero spread was acceptable). If the checkbox is not enabled, we will use the price that triggered the trade signal, i.e., buy the first leg at 100 and attempt to sell the second leg at 110.

Formula for the second leg's buy price:

Price=±(Lim_sellPrice_s{+,Ratio_sign1=+×,Ratio_sign1=×ratio1){,Ratio_sign2=+/,Ratio_sign2=×ratio2Price=\pm\left(Lim\_sell-Price\_s \begin{cases}+,& Ratio\_sign_1=+\\ \times,& Ratio\_sign_1=\times\end{cases} ratio_1\right) \begin{cases}-,& Ratio\_sign_2=+\\ /,& Ratio\_sign_2=\times\end{cases} ratio_2

for sell:

Price=±(Lim_buyPrice_b{+,Ratio_sign1=+×,Ratio_sign1=×ratio1){,Ratio_sign2=+/,Ratio_sign2=×ratio2Price=\pm\left(Lim\_buy-Price\_b \begin{cases}+,& Ratio\_sign_1=+\\ \times,& Ratio\_sign_1=\times\end{cases} ratio_1\right) \begin{cases}-,& Ratio\_sign_2=+\\ /,& Ratio\_sign_2=\times\end{cases} ratio_2

The ± sign depends on the value set for the On_buy parameter on the second leg (if set to Buy, then "+", if set to Sell, then "-").

#
#
7.2.12. Volumes

A group of parameters responsible for the volume of placed orders. The group can be divided into two pairs of parameters: v_in_left/v_in_right and v_out_left/v_out_right, as well as the parameters Virt_0_pos and n_perc_fill.

#
#
7.2.12.1. v_min/v_max

Minimum/maximum allowed portfolio position. Measured in number of portfolios.

#
#
7.2.12.2. v_in_left/v_in_right

Responsible for the minimum/maximum allowed volume for a single entry into a position (in number of portfolios);
If the price determination type Type price is set to Orderbook or Orderbook+filter then the volume v_in_right for a single entry is not used.

#
#
7.2.12.3. v_out_left/v_out_right

Responsible for the minimum/maximum allowed volume for a single exit from a position (in number of portfolios); If the price determination type Type price is set to Orderbook or Orderbook+filter then the volume v_in_right for a single entry is not used.

#
#
7.2.12.4. Virt 0 pos

This parameter allows the Is first order, placed by the algorithm, on a financial instrument directed toward closing the position not only to bring the position to zero but also immediately open a new position in the opposite direction. Additionally, the order volume can never be less than v_in_left and v_out_left.

Important! If the To0 flag is enabled, the robot may exhibit behavior where the position never reaches exactly zero but constantly flips from one side to the other. With the Virt 0 pos parameter enabled, the robot might not reach the v_min/v_max positions, as it "bumps into" the limits set by v_in_left/v_in_right and v_out_left/v_out_right (the robot will not place orders smaller than these values).

#
#
7.2.12.5. n_perc_fill

This parameter defines the relationship between the position in the first-leg instrument and the portfolio position, and effectively determines hedging conditions in cases where the Count of the first leg may not be an integer multiple of its position. Based on this parameter, the ratio of the position (Curpos) in the main instrument to the Count parameter of the same instrument is rounded. The n_perc_fill parameter can only take values from 50 to 100 and 0. A value ofn_perc_fill equal to zero disables the rounding mechanism, resulting in the position always being rounded down in absolute value. In all other cases, the following rules apply:

  • if, upon changing the position in the main instrument of the portfolio, the integer part of the position has not changed, and the remainder of dividing Curpos by Count falls within the range from (100 - n_perc_fill) to n_perc_fill percent of Count, then the portfolio position remains unchanged; if the remainder is to the left of this range, rounding is performed downward in absolute value; if to the right — upward in absolute value;

  • if, when increasing the position, the integer part of dividing Curpos by Count and the absolute value of the remainder is greater than or equal to n_perc_fill percent of Count, then the portfolio position is rounded up in absolute value; otherwise — down;

  • if, when decreasing the position, the integer part of dividing Curpos by Count decreases, and the absolute value of the remainder is less than or equal to (100 - n_perc_fill) percent of Count, then the portfolio position is rounded down in absolute value; otherwise — up.

Thus, using the n_perc_fill parameter with a non-zero value makes sense only when the Count of the first-leg instrument is greater than one. In this case, a non-zero value of the n_perc_fill parameter acts as a kind of "hysteresis" and provides the ability to filter out position "jitter" on the first-leg instrument within certain limits.

#
#
7.2.13. Delta

Minimum deviation of Price_s and `Price_b from the price of the currently placed sell or buy order, respectively. If this deviation is exceeded, the robot may re-quote the order — that is, replace the order on the Is first instrument (used only when the Quote mode is enabled);

Example:
Delta = 10; a quoting sell order is placed at price 95 (i.e., at the time of placement, Price_s = 95). As soon as Price_s becomes less than 85 or greater than 105, the order will be replaced at a new price.

#
#
7.2.14. First delta

Specified in percent (%), this is one of the parameters that triggers re-quoting an order with a new volume if its current unexecuted volume falls below First delta percent of the initially placed volume (used only when the Quote) mode is enabled). This allows maintaining the required minimum volume in the quoting order.

Example:
First delta = 20. You are quoting a sell order with volume 100, and your order starts being filled partially. The order remains active as long as its unexecuted volume is greater than or equal to 20. Once it drops below 20, the order is canceled and, if possible, a new order is placed at price Price_s with the full volume.

#
#
7.2.15. Market volume

This parameter restricts placing an order on the Is first instrument if the queue depth in the order book at the intended price level already exceeds the value set in Market volume. The value is displayed in the same unit as the instrument position shown in the exchange terminal (unless otherwise specified for a particular connection).

Important! For display on the website, lot_size is used. When using С++ Formulas or API to obtain the correct parameter value, you must manually multiply by lot_size.

#
#
7.2.16. Price check

If the intended order price for the Is first financial instrument falls deeper into the order book than Price check ticks, the order will not be placed. That is, if ask + Price check < Price_s, where ask is the best sell price of the Is first instrument, then the order will not be placed. The same logic applies for buy orders.

#
#
7.2.17. Max not hedged

The value represents the maximum allowed number of unhedged openings on the Is first instrument (i.e., when at least one non-Is first instrument has active orders totaling no less than Max not hedged) plus placement errors (all errors except crosses). Once this threshold is reached, trading on the Is first instrument will be suspended until at least one of the unhedged positions is hedged or the error counter is reset.

important! The Max not hedged parameter should be used in conjunction with Hedge (sec); otherwise, trading may halt after accumulating a certain number of errors.

Non-obvious point! On some trading platforms, a two-way position model is used, allowing simultaneous long and short positions. On such platforms, instead of two possible order sides — "buy" and "sell" — four are used: "open buy", "open sell", "close buy", and "close sell". When using instruments from such platforms as second-leg instruments in the portfolio, the Max not hedged parameter must be set to "1"; otherwise, the robot's algorithm cannot function correctly.

#
#
7.2.18. Overlay

Hedge only if the difference (in portfolios) between the Is first financial instrument and the other instruments in the portfolio is greater than or equal to this parameter's value (measured in number of portfolios, i.e., in the same unit as v_in_left/v_in_right).

#
#
7.2.19. Lim_sell/Lim_buy

Lim_Sell – signal price for selling; an order on the Is first financial instrument is placed if Sell ≥ Lim_Sell , regardless of whether the Quote mode is enabled.

Lim_Buy – signal price for buying; an order on the Is first financial instrument is placed if Buy ≤ Lim_Buy regardless of whether the Quote mode is ebabled.

#
#
7.2.20. Threshold

When Threshold > 0, during strong spread movement by the amount Threshold— i.e., when either Sell ≥ Lim_Sell + Threshold or Buy ≤ Lim_Buy - Thresholdis satisfied — the calculation of prices Price_s and Price_bwill be performed as if the Simply first flag is cleared, regardless of its actual value (i.e., the parameter is temporarily disabled). Additionally, when placing an order on the Is first financial instrument, the Only maker flag will not be set in the order, regardless of the current setting. Note that the user-visible portfolio settings remain unchanged; all parameter deactivations occur internally and virtually.

when Threshold = 0 , this parameter has no effect on the algorithm — effectively disabling this functionality.

Important! It is not possible to modify an already placed order on an exchange by changing its Only maker flag. Therefore, when the Thresholdconditions are met, re-quoting is always implemented as a separate cancel-and-replace sequence.

#
#
7.2.21. Trading signal shift

A group of parameters responsible for creating the arbitrage channel.

#
#
7.2.21.1. K

Price shift coefficient that improves the order price for each subsequent entry.
The Lim_sell level (in case of selling) or Lim_buylevel (in case of buying) is shifted by the value of K when building a position. In other words, this defines how much the order price improves after a fill (a "fill" is defined as a trade with volume no less than v_in_left).

#
#
7.2.21.2. ТР

Opposite-side order level after a fill. Using the ТР parameter, you specify where the opposite-side order will be placed after a fill (applies only after the first fill). For example, if we were filled at Lim_sell = 150, then with ТР = 50, Lim_buy will be placed at 150 – 50 = 100.

#
#
7.2.21.3. K1

The coefficient specifies the shift of the opposite-side order after the second fill that increases the position. For example, if Lim_buy = 100 from the previous example, with K1 = 5, it will be set to 100 + 5 = 105, after the second fill on Lim_sell. After another trade, Lim_buy will increase by another 5 to 110; after the next trade on Lim_sell, it will become 115, and so on.

#
#
7.2.21.4. K2

The coefficient that shifts the order price to improve it for each subsequent exit. Lim_sell (in case of selling) or Lim_buy(in case of buying) is shifted by the value of K2 when exiting a position. In other words, this defines how much the next exit order improves after a prior fill (a "fill" is defined as a trade with volume no less than v_out_left). From the earlier example, where Lim_buy = 105, with K2 = 3, after a fill at Lim_buy, its value becomes 105 - 3 = 102.

#
#
7.2.22. Limits timer

Timer duration (set in seconds) after which both Lim_sell and Lim_buy are shifted by the value of K. The timer starts when trading is enabled and a buy or sell signal occurs, but trading is blocked because the robot has already reached the maximum position (according to v_min/v_max). The timer stops when Percent > 100%.

Example: Limits timer = 10 sec, Percent = 60. Consider a 10-second time window: suppose the signal was present for 2 sec, then absent for 3 sec, present again for 4 sec, and absent for 1 sec. Over 10 seconds, the signal was active for a total of 6 seconds, which is ≥ 60% of 10 seconds — thus, the condition is met and the shift is applied.

#
#
7.2.23. Percent

The percentage of Limits timer after which the shift occurs. If the trading signal persists for the specified percentage of the Limits timer duration, then Lim_sell/Lim_buy are moved by K , regardless of whether any trades occurred on the Is Is first financial instrument.

#
#
7.2.24. Always timer

When Always timer ia enabled, the Limits timer is always active, even if the portfolio position has not reached v_min or v_max. When Always timer is disabled, the levels Lim_sell and/or Lim_buy shift only when trades occur or when the portfolio position reaches v_min or v_max.Enabling this parameter allows level adjustments even if no trade occurred, as long as the robot attempted to place an order.

#
#
7.2.25. Pos

Current portfolio position (in number of portfolios), calculated using the formula:

Pos=[CurposfirstCountfirst],Pos=[\frac{Curpos_{first}}{Count_{first}}],

Where Curposfirst and Countfirst - are the Curpos and Count parameters for the portfolio instrument with the Is first flag set, rounded up or down depending on the value of the n_perc_fill parameter. The value is updated by the robot but can also be manually edited by the user.

#
#
7.2.26. Timetable

Enable trading according to a schedule. The schedule consists of a list of weekdays specifying the days on which trading will be active, and a list of trading periods (the same for all trading days), each with its own set of parameters:

Begin - start of the trading period.
End - end of the trading period.
re_sell - behavior of re_sell during this interval: always enable, always disable, or "manual" mode.
re_buy - behavior of re_buy during this interval: always enable, always disable, or "manual" mode.
Close - attempt to close the position immediately after the end of the trading period (within 10 seconds). Position closure is not guaranteed, as orders may fail to be placed due to external reasons.
To market - attempt to flatten the position immediately after the end of the trading period (within 10 seconds). Position flattening is not guaranteed, as orders may fail to be placed due to external reasons.
To0 - behavior of To0 during this interval: always enable, always disable, or "manual" mode.
Save history - whether to save the history of changes to certain portfolio parameters during this interval.

If the current local server time (curTime) falls within one of the defined periods, i.e., BeginicurTimeEndiBegin_i \le curTime \le End_i, control over the above-mentioned portfolio parameters is transferred to the schedule. Otherwise (if the current time does not fall within any of the periods), the aforementioned parameters are automatically disabled.

The "manual" mode means that the respective portfolio parameter is not controlled by the schedule during that time interval, i.e., the user can adjust the parameter manually even when the schedule is active.

The weekly trading schedule can also be applied to multiple portfolios simultaneously by selecting them in the Portfolios table widget and choosing the TradingDays option from the Actions menu.

Important! Current time is determined by the server clock where the robot is running. Currently, for robots trading on cryptocurrency exchanges, this is UTC; for all others, it is UTC+3 (MSK). The server time is displayed in the Robots widget under the Robot time column.It is strongly recommended to use this time as reference.

Important! There is a difference between two scenarios: (1) when a non-trading period is explicitly defined between trading periods, starting exactly at the end of one trading period and ending just before the next, and (2) when there is a time gap between trading periods but no non-trading period is defined in the schedule. In the second case, all flags described above will be automatically disabled during the gap. In the first case, the behavior can be specifically configured.

#
#
7.2.27. To0

Enabling this parameter allows trading only in the direction of closing the position. When the portfolio position reaches zero, trading will stop.

Important! If the Virt_0_posflag is enabled, the robot may exhibit behavior where the position never reaches exactly zero but constantly flips from one side to the other.

#
#
7.2.28. Opened

A parameter used to calculate the financial result, computed using the formula:

Opened=(iboughttradePricei×tradeAmounti×lotSizei×Multi)+(isoldtradePricei×tradeAmounti×lotSizei×Multi),Opened = -\left(\sum_{i\in bought}tradePrice_i\times tradeAmount_i\times lotSize_i\times Mult_i\right)+ \left(\sum_{i\in sold}tradePrice_i\times tradeAmount_i\times lotSize_i\times Mult_i\right),

where tradePricei - trade price;
tradeAmounti - number of lots in the trade;
lotSizei - multiplier to convert integer volumes into fractional ones;
bought - list of buy trades;
sold - list of sell trades;
Multi - Fin res multiplier of the portfolio instrument.

#
#
7.2.29. Commision sum

Total commission across all portfolio trades, used in calculating the financial result.

#
#
7.2.30. Decimals

A parameter that defines the number of decimal places displayed for parameters with fractional values. Note that the robot uses actual prices received from the exchange, while the interface may display rounded values when the Decimals parameter is applied.

#
#
7.2.31. Custom trade

When this flag is enabled, the standard spread price calculation is disabled. Instead, the value displayed as the spread price in the Finres history and Finres for today widgets in the Price field will be determined by the result of the formula entered in the Trade formula field. Therefore, ensure that a valid formula is provided in the Trade formula field when enabling this flag.

#
#
7.2.32. Trade formula

A formula written in C++ programming language used to calculate the spread value displayed in the Price field of the Finres history and Finres for today widgets. You write only the function body and must return a value of type double. The function is called at the moment when all necessary trades for calculating the spread and adding it to the table are received (note that trades may not be present for all financial instruments in the portfolio). For each financial instrument, no more than one trade will be available; if multiple trades occurred for a given instrument within the same spread calculation, only one trade will be accessible, with aggregated volume and average price.

Important! Values produced by this formula are used exclusively in the Price field of the Finres history and Finres for today widgets and nowhere else. The financial result shown in the Fin res field of the Portfolios table widget is calculated directly from trade prices and does not depend on the output of this formula.

Non-obvious point! The default formula code returns a zero value and is not suitable for use in live trading.

#
#
7.2.33. Extra formulas

A flag that enables the calculation of Extra field#1 and Extra field#2.

#
#
7.2.34. Extra field#1 and Extra field#2

Fields for additional formulas written in C++ programming language. You write only the function body and must return a value of type double.

#
#
7.2.35. Shared formulas

A flag; when enabled, allows editing fields of this portfolio from formulas in another portfolio. If disabled, any attempt to edit will throw an exception std::domain_error with the message Editing "<FIELD_NAME>" value is not allowed.

#
#
7.2.36. Disable portfolio

Completely disable the portfolio from all calculations and trading without deleting it. This flag is not a substitute for the re_sell/re_buy flags. When the disabled flag is set, the portfolio stops receiving both market data and updates on its own active orders, if any. Therefore, before using this flag, ensure that trading is disabled and there are no active orders on either leg of the portfolio.

Important! When unchecking this flag and restoring portfolio operation, market order books may be reopened, potentially causing a temporary suspension of trading in all portfolios using the same data connection during the order book reinitialization period.

#
#
7.2.37. Sell/Buy clicker

A "clicker" function to place a sell/buy order for a specified number of portfolios. Orders are placed immediately across all instruments in the portfolio. This provides a manual way to execute trades for the entire portfolio at once, without waiting for the Sell>=Lim_sell or Buy<=Lim_buy signals to trigger.

#
#
7.2.38. To market

The "clicker" allows forcibly flattening the portfolio position. When clicked, the following actions occur: first, all orders are canceled except for algorithmically placed orders on the first leg; then, market orders are placed on the remaining instruments with the same volumes, adjusted according to the k_sl parameter. If it is evident that even full execution of these orders would not fully flatten the portfolio position, additional balancing orders are placed on the second-leg instruments — no more than one per instrument. These balancing orders are also placed at market price, taking into account the k_sl parameter.

#
#
7.2.39. Place order

Allows placing an order on one of the portfolio instruments without waiting for the portfolio's configured conditions to trigger, including when portfolio trading is disabled. To use this option, click the blue cell in the Place order column of the Portfolios table , set the desired order parameters, and then click the Place order button.
When trading is enabled, an order placed this way may trigger the following mechanisms:
Hedge (sec), SLE, TE.
An order placed in this manner can be canceled either manually via the exchange terminal or using the Hard stop button.

#
#
7.2.40. Sell/Buy

Sell – calculated sell price. Non-editable parameter. Buy – calculated buy price. Non-editable parameter.
Simplified formula for two financial instruments:

Isfirst:Onbuy=Buy,Secondleg:Onbuy=Sell{Is\enspace first: On\enspace buy=Buy, Second\enspace leg: On\enspace buy=Sell}

Buy=ask1Ratio_sign1ratio1bid2Ratio_sign2ratio2{Buy=ask_1Ratio\_sign_1ratio_1-bid_2Ratio\_sign_2ratio_2}

Sell=bid1Ratio_sign1ratio1ask2Ratio_sign2ratio2{Sell=bid_1Ratio\_sign_1ratio_1-ask_2Ratio\_sign_2ratio_2}

Ratio_sign=+or×{Ratio\_sign =+\enspace or\enspace \times}

Formulas for calculating Sell and Buy for any number of legs:

Buy=i{bidi,Onbuyi=Sellaski,Onbuyi=Buy{+,Ratio_signi=+×,Ratio_signi=×ratioiBuy=\sum_{i} \begin{cases}-bid_i,& On\enspace buy_i=Sell\\ ask_i,& On\enspace buy_i=Buy\end{cases} \begin{cases}+,& Ratio\_sign_i=+\\ \times,& Ratio\_sign_i=\times\end{cases} ratio_i

Sell=i{bidi,Onbuyi=Buyaski,Onbuyi=Sell{+,Ratio_signi=+×,Ratio_signi=×ratioiSell=\sum_{i} \begin{cases}bid_i,& On\enspace buy_i=Buy\\ -ask_i,& On\enspace buy_i=Sell\end{cases} \begin{cases}+,& Ratio\_sign_i=+\\ \times,& Ratio\_sign_i=\times\end{cases} ratio_i

#
#
7.2.41. Price_s/Price_b

Price_s – the price at which a sell order is placed for the Is first financial instrument, calculated as the inverse function of Sell, where the Sell price is replaced with Lim_Sell. Non-editable parameter.
Price_b – the price at which a buy order is placed for the Is first financial instrument, calculated as the inverse function of Buy, where the Buy price is replaced with Lim_Buy. In general, this is the price at which the robot "wants" to buy or sell the Is first instrument. Non-editable parameter.

Formulas for calculating Price_s and Price_b for two financial instruments:

Price_s=(Lim_sell+ask2{+,Ratio_sign2=+×,Ratio_sign2=×ratio2){,Ratio_sign1=+/,Ratio_sign1=×ratio1k1Price\_s=\left(Lim\_sell+ask_2 \begin{cases}+,& Ratio\_sign_2=+\\ \times,& Ratio\_sign_2=\times\end{cases} ratio_2\right) \begin{cases}-,& Ratio\_sign_1=+\\ /,& Ratio\_sign_1=\times\end{cases} ratio_1 - k_1

Price_b=(Lim_buy+bid2{+,Ratio_sign2=+×,Ratio_sign2=×ratio2){,Ratio_sign1=+/,Ratio_sign1=×ratio1+k1Price\_b=\left(Lim\_buy+bid_2 \begin{cases}+,& Ratio\_sign_2=+\\ \times,& Ratio\_sign_2=\times\end{cases} ratio_2\right) \begin{cases}-,& Ratio\_sign_1=+\\ /,& Ratio\_sign_1=\times\end{cases} ratio_1 + k_1

Formulas for calculating Price_s and Price_b for any number of legs:

Price_s=(Lim_selliiisfirst{bidi,Onbuyi=Buyaski,Onbuyi=Sell{+,Ratio_signi=+×,Ratio_signi=×ratioi){,Ratio_sign=+/,Ratio_sign=×ratio_sisfirstkisfirstPrice\_s=\left(Lim\_sell_i-\sum_{i \neq isfirst} \begin{cases}bid_i,& On\enspace buy_i=Buy\\ -ask_i,& On\enspace buy_i=Sell\end{cases} \begin{cases}+,& Ratio\_sign_i=+\\ \times,& Ratio\_sign_i=\times\end{cases} ratio_i \right) \begin{cases} -,& Ratio\_sign=+\\ /,& Ratio\_sign=\times \end{cases} ratio\_s_{isfirst} - k_{isfirst}

Price_b=(Lim_buyiiisfirst{bidi,Onbuyi=Sellaski,Onbuyi=Buy{+,Ratio_signi=+×,Ratio_signi=×ratioi){,Ratio_sign=+/,Ratio_sign=×ratio_bisfirst+kisfirstPrice\_b=\left(Lim\_buy_i-\sum_{i \neq isfirst} \begin{cases}-bid_i,& On\enspace buy_i=Sell\\ ask_i,& On\enspace buy_i=Buy\end{cases} \begin{cases}+,& Ratio\_sign_i=+\\ \times,& Ratio\_sign_i=\times\end{cases} ratio_i \right) \begin{cases} -,& Ratio\_sign=+\\ /,& Ratio\_sign=\times \end{cases} ratio\_b_{isfirst} + k_{isfirst}

#
#
7.2.42. Sell/Buy status

Status of the sell/buy order for the Is first financial instrument, placed for quoting in Quote mode or upon meeting the condition BuyLim_Buy for a buy order and SellLim_Sell for a sell order. Thus, the Sell status and Buy status fields display the statuses of two specific orders. Orders placed via the clicker are not reflected in these fields.

The following statuses are possible:

  • free - no order is present
  • adding - order is being placed (a command to place the order has been sent to the exchange; confirmation not yet received)
  • moving - order is being modified (a command to change the order has been sent to the exchange; confirmation not yet received)
  • deleting/first_deleting/sl_deleting - order is being canceled (a cancel command has been sent to the exchange; confirmation not yet received)
  • running - order is active on the exchange (confirmation of successful placement received; no other pending commands for this order)

An order may remain in the free and running states for extended periods, while all other states are transitional. When connected via transactional API and operating online, orders should not remain in a transitional state for more than a few seconds.

To release a "stuck" order, double-click the corresponding cell in the table. Manually changing the status may cause the robot to lose track of the order; this action is recommended only in exceptional cases.

#
#
7.2.43. Return first

Turnover for the Is first financial instrument, calculated since the server part of the robot started, as the sum of absolute values of traded lot quantities for the Is first instrument. Can be reset to zero by double-clicking. The value is displayed in the same unit as the instrument position shown in the exchange terminal (unless otherwise specified for a particular connection).

Important! For display on the website, lot_size is used. When using С++ Formulas or API , to obtain the correct parameter value, you must manually multiply by lot_size .

#
#
7.2.44. Fin res

Estimated financial result of the portfolio, calculated using the formula:

Finres=Opened+Commissionsum+isecsCurposi×lotSizei×Multi×{secBidi,ifCurposi>0secaski,ifCurposi<0,Fin\enspace res=Opened+Commission\enspace sum+\sum_{i\in secs}Curpos_i \times lotSize_i \times Mult_i \times \begin{cases} secBid_i, &\text{if } Curpos_i>0\\ secask_i, &\text{if } Curpos_i<0 \end{cases},

where secBidi - best buy price of the portfolio instrument;
secaski - best sell price of the portfolio instrument;
lotSizei - multiplier to convert integer volumes into fractional ones;
Curposi - current position of the portfolio instrument;
Mult - Fin res multiplier of the portfolio instrument;
secs - list of portfolio instruments.

#
#
7.2.45. Fin res wo C

Fin res without commission. Calculated using the formula:

Finres=Opened+isecsCurposi×lotSizei×Multi×{secBidi,ifCurposi>0secaski,ifCurposi<0,Fin\enspace res=Opened+\sum_{i\in secs}Curpos_i \times lotSize_i \times Mult_i \times \begin{cases} secBid_i, &\text{if } Curpos_i> 0\\ secask_i, &\text{if } Curpos_i< 0 \end{cases},

where secBidi - best buy price of the portfolio instrument;
secaski - best sell price of the portfolio instrument;
lotSizei - multiplier to convert integer volumes into fractional ones;
Curposi - current position of the portfolio instrument;
Multi - Fin res multiplier of the portfolio instrument; secs - list of portfolio instruments.

#
#
7.2.46. Is trading

Displays the current trading status of the portfolio. Possible values are:

  • Not trading - trading for the portfolio is disabled (i.e., both re_sell and re_buy flags are cleared), and there are no active orders for the portfolio on exchanges;
  • Trading- trading for the portfolio is enabled (i.e., at least one of the re_sell or re_buy flags is set);
  • Has active orders - trading for the portfolio is disabled (i.e., both re_sell and re_buy flags are cleared), but there are still active orders for this portfolio on exchanges.

Non-editable parameter.

#
#
7.2.47. Comment

A comment can be added to each portfolio if needed. Maximum allowed number of characters is 100.

#
#
7.2.48. Color

The portfolio can be highlighted with a color in the color field, if necessary..

#
#
7.3. Portfolio Instrument Parameters

Below is a description of portfolio instrument parameters. All parameters are editable unless otherwise specified.

#
#
7.3.1. SecKey

Unique identifier of the portfolio instrument. Non-editable parameter.

#
#
7.3.2. SecBoard

Trading board (mode) of the portfolio instrument. Non-editable parameter.

#
#
7.3.3. SecCode

Code of the portfolio instrument. Non-editable parameter.

#
#
7.3.4. Exchange

Name of the exchange where the financial instrument is traded. Non-editable parameter.

#
#
7.3.5. Curpos

Current portfolio position in this instrument. The value is displayed in the same unit as the instrument position shown in the exchange terminal (unless otherwise specified for a particular connection).

Important! For display on the website, lot_size is used. When using С++ Formulas or API , to obtain the correct parameter value, you must manually multiply by lot_size.

#
#
7.3.6. Count type

This parameter allows selecting a constant value for Count or using a Count formula

#
#
7.3.7. Count

The quantity of the instrument in one portfolio unit. The value is displayed in the same unit as the instrument position shown in the exchange terminal (unless otherwise specified for a particular connection).

Important! For display on the website, lot_size is used. When using С++ Formulas or API, to obtain the correct parameter value, you must manually multiply by lot_size.

Important! When Virt 0 pos is enabled, Count – represents the minimum quantity the robot will trade for the corresponding instrument; otherwise, an order with a volume smaller than Count may be placed (e.g., when closing a position or to reach v_min/v_max).

#
#
7.3.8. Count formula

The number of lots of the instrument in one portfolio, defined as code in C++. programming language. You write only the function body and must return a value of type double.

Important! The values of Count or Count formula define the ratio between the positions of portfolio instruments (the ratio within a specific trade may differ). For this reason, the value of Count formula does not depend on the order direction being placed.

Important: It is strongly recommended to never return a value of 0 for the Is first financial instrument. If you wish to stop trading, use the Ratio formula and set appropriate spread values. If you do end up with a Count equal to 0 for the Is first financial instrument, the portfolio will not trade any financial instruments, and when calculating the portfolio position, wherever division by the Count of the Is first instrument (which is 0 in your case) is required, division by 1 will be used instead.

#
#
7.3.9. On buy

Determines whether we will buy or sell the instrument when a buy signal is triggered on the main instrument. This parameter is configurable only for the second leg. For the first leg, it is always On Buy = Buy. by default. When a sell signal is triggered, the robot will take the opposite action.

Example: For theis_first instrument On Buy = Buy For the second leg On Buy = Sell With these settings, when a buy signal is triggered, the robot will attempt to buy the first leg and then sell the second leg. When a sell signal is triggered, the robot will attempt to sell the first leg and then buy the second leg.

For the is_first instrument On Buy = Buy For the second leg On Buy = Buy With these settings, when a buy signal is triggered, the robot will attempt to buy both legs. When a sell signal is triggered, the robot will attempt to sell both legs.

#
#
7.3.10. Is first

Indicates whether the financial instrument is the primary (main) instrument of the portfolio. The portfolio position is calculated based on the main financial instrument. The On buy setting for this instrument is always treated as Buy.

#
#
7.3.11. k

Sets the size of artificial slippage (offset from the market price): when buying, the order price is ask + k; when selling, the order price is bidk, where bid and ask – are the best bid and ask prices, respectively).

#
#
7.3.12. k_sl

Analogous to the k, parameter, but used only when re-quoting orders triggered by SLE and TE. Sets the size of artificial slippage (offset from market price): for a buy order, the placement price is ask + k_sl; for a sell order, the placement price is bidk_sl, where bid and ask – are the best bid and ask prices, respectively.

#
#
7.3.13. SLE

Enable/disable stop-loss re-quoting functionality. Orders re-quoted due to stop-loss will subsequently be re-quoted according to a specific algorithm.

#
#
7.3.14. SL

Stop-loss value; when reached, the order (if not yet filled) must be canceled and resubmitted at the current market price. The stop-loss is measured from the original order placement price.

#
#
7.3.15. TE

Parameter responsible for enabling/disabling timer-based re-quoting. Orders re-quoted due to timer will subsequently be re-quoted according to a specific algorithm.

#
#
7.3.16. Timer

Defines the time interval after which an unfilled order should be canceled and resubmitted at the current market price.

#
#
7.3.17. Percent of quantity

If the volume available at the best bid or ask price on the exchange (or within the found volume in the order book when Type price = Orderbook or Type price = Orderbook + filter) contains a sufficient percentage (%) of the order volume for the non-Is first instrument, and this condition holds true for all non-Is first instruments, then an order may be placed on the Is first instrument. Thus, if there is insufficient hedge volume in the second leg, the order on the first leg will not be placed, even if a buy or sell signal is present.

#
#
7.3.18. Ratio sign

The sign used before the Ratio coefficient when calculating Sell and Buy prices: either ”+” or ”×”.

#
#
7.3.19. Ratio

Coefficient used in the calculation of Sell and Buy prices.

#
#
7.3.20. Fin res multiplier

Fin res multiplier - a multiplier used to calculate the financial result, ensuring all prices are converted into the same unit of measurement.

#
#
7.3.21. Commission type and Commission

Comission type - parameter defining the commission calculation method. Allows setting either a fixed fee or a percentage of the trade volume.

Commission - instrument-specific commission. If Commission type is set to %, the commission is specified as a percentage of the trade price; if set to pt, the commission is specified in the same unit used for the portfolio's financial result (e.g., for Sberbank stock, commission is typically 0.01% of the trade value; for a futures contract on Sberbank stock, it is often 0.25 points for scalping trades).

#
#
7.3.22. Client code

Client code from which orders for this financial instrument should be placed. An empty string means using the "default" client code. Displays all available codes eligible for trading the given instrument. The code virtual means virtual trading and can be used for strategy testing. A code starting with Round robin indicates the use of the Round robin order routing mode.

Important! The Round robin mode means placing and canceling orders sequentially across all exchange connections associated with the same client code, following a specific algorithm. The behavior of this algorithm differs between the Moscow Exchange and cryptocurrency exchanges due to differences in market mechanics and connection types. On crypto exchanges, when using the Round robin mode, orders are placed and canceled sequentially through connections that share the same client code. For some crypto exchanges, this allows increasing the total throughput of a client account by using multiple API key pairs. On the Moscow Exchange, all connections with the same client code are kept in a queue, where their position depends on their current order submission speed (the faster connection takes priority). The queue order is updated no more than once per second, and resets every second, resulting in non-uniform load distribution. Only certain "important" orders are considered when measuring round-trip latency. Important orders include those placed on the first leg via the main algorithm (not via clicker, stop-loss, or other methods), but only when quoting is disabled. Also considered important are second-leg orders placed according to the core algorithm (i.e., after a fill on the first leg). Round-trip values are reset hourly to allow reassessment of each connection's speed and selection of the fastest one. Thus, for the Moscow Exchange, the fastest connection is selected, and orders are placed through it whenever possible.

Important! The client code cannot be empty for financial instruments with a Count different from zero.

Important! By default, a single live robot is allowed up to 100,000 virtual trades per day; free robots are allowed up to 1,000,000 virtual trades per day. If the virtual trade limit is exceeded, trading will be automatically disabled for the portfolio when attempting to place an order in virtual mode, and a log message will appear: Trading on "PORTFOLIO_NAME" was stopped. Daily limit of robot's virtual trades was exceeded

#
#
7.3.23. MM

A flag; when enabled, all orders for the instrument are submitted with the "market maker" designation (supported only by certain connections). Use of this designation must be explicitly approved by the exchange.

#
#
7.3.24. TP

Take-profit level. Used when Type is set to TP algo or TP algo 2. The value is measured from the execution price of the order for the Is first instrument.

#
#
7.3.25. Ratio type

Allows configuring whether a constant Ratio value or the result of the Ratio formula is used in calculating Sell and Buy prices.

#
#
7.3.26. Ratio buy formula

Parameter used in calculating the Buy price, defined as code in C++ programming language. You write only the function body and must return a value of type double.

#
#
7.3.27. Ratio sell formula

Parameter used in calculating the Sell price, defined as code in C++ programming language. You write only the function body and must return a value of type double.

#
#
7.3.28. Depth OB

Maximum depth level of the order book up to which prices and volumes are calculated (measured in number of price steps, counting from bid/ask). Available only for non-Is first instruments, and used only in Type price = Orderbook and Type price = Orderbook + filter modes.
if you have selected Type price = Orderbook and Type price = Orderbook + filter, you must monitor the Depth OB value if it is set too low, the robot will not be able to calculate prices and volumes, resulting in zero values for the Sell and Buy parameters.

#
#
7.3.29. Calc price OB

Price type used to calculate Sell, Buy, Price_s and Price_b. Available only for non-Is first financial instruments and used only in Type price = Orderbook and Type price = Orderbook + filter modes:

  • Deepest – price of the order book level at which the required volume is reached;
  • Weighted avg. – volume-weighted average price across all levels up to and including the one where the required volume is filled.

#
#
7.3.30. Trading price OB

Price type used during trading. Available only for non-Is first financial instruments and used only in Type price = Orderbook and Type price = Orderbook + filter modes:

  • Deepest – price of the order book level at which the required volume is reached;
  • Weighted avg. – volume-weighted average price across all levels up to and including the one where the required volume is filled.

Example:
Trading price OB- Deepest:

Suppose you are looking to buy 1000 lots in the order book: 500 lots are available at price 100, 490 lots at price 99, and the remaining 10 lots at price 5. In this case, the resulting price will be 5.

Trading price OB - Weighted avg:

Using the same example: (500 × 100 + 490 × 99 + 10 × 5) / 1000 = 98.56 — this is the resulting price. Before placing the order, the robot rounds the price according to the instrument’s price step. For sell orders, rounding is upward; for buy orders, rounding is downward. So, if the price step in this example is 1, the selling price will be 99.

#
#
7.3.31. Level to0

If for at least one financial instrument in the portfolio the absolute difference between Mark price and Liquidation price is strictly less than this value, then set the To0 flag and prevent it from being cleared while the condition holds; when the condition no longer applies, clear the To0 flag. This allows preventing position increases for a given portfolio while the current price is dangerously close to the liquidation price.

#
#
7.3.32. Level close

If for at least one financial instrument in the portfolio the absolute difference between Mark price and Liquidation price is strictly less than this value, then set the To0 flag and prevent it from being cleared while the condition holds (clear the flag when the condition no longer applies). Every 5 seconds, place an order in the direction of position closing with volume v_out_left portfolios, continuing until the condition no longer holds or the portfolio position reaches zero. Thus, the portfolio position is gradually reduced following hedging rules until the liquidation price returns to a safe level.

#
#
7.3.33. Leverage

Parameter defining the leverage for placed orders.

#
#
7.3.34. Decimals

Parameter that determines the number of decimal places displayed for parameters with fractional values.

Important! This parameter also controls the number of decimal places shown in trade prices for this financial instrument within the spreads table. When changed, existing trades already added to the table will retain their original precision and will not be updated.

#
#
7.3.35. Max trans time

Maximum allowed Round trip time (i.e., the difference between the time the exchange response is received and the time the order command was sent), in microseconds, for this instrument. If this threshold is exceeded, order placement on the first leg will be suspended for Ban_period seconds.

#
#
7.3.36. Ban period

The duration in seconds during which the robot will not place any orders on the first leg of the portfolio. Used in conjunction with Max trans time.

#
#
7.4. Notifications Parameters

The robot can notify the user about the occurrence of certain events. In addition to purely signaling functionality, all notifications can disable trading for a given portfolio. When the corresponding event occurs, the notification appears on the website and also in the Telegram-bot (if it is connected and configured).

For all notifications that have parameters Time (sec) and Value, the logic of these parameters is the same:

  1. The current value of the selected parameter is recorded at the current moment in time.
    • If within the time period of Time (sec) seconds the value of the selected parameter changes by an amount strictly greater than the specified limit (i.e., if the saved value is X, then for the new value Y the inequality XY>Value\lvert X - Y \rvert > \mathit{Value}), the notification is triggered and the algorithm proceeds to step 1.
    • If within the time period of Time (sec) seconds the value does not change by more than the specified limit, then after Time (sec) seconds have elapsed, the algorithm proceeds to step 1.

Thus, the user will receive a notification if, within no more than Time (sec) seconds from the moment a value was recorded, the current value of the specified parameter differs from this recorded value by strictly more than Value.

There are also notifications configured for a specific exchange trading connection; they are described in the section Position Parameters.

#
#
7.4.1. FinRes fall

Notification about financial result drop:

  • Fall (%) - percentage drop in financial result that should trigger the notification;
  • Time (sec) - time period in seconds over which the drop is measured;
  • Min fall (pt) - minimum change that should trigger a response;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled).

Important! Works only when trading is enabled for the portfolio

#
#
7.4.2. Lim_Sell change and Lim_Buy change

Notify about changes in the portfolio's Lim_Sell/Lim_Buy:

  • Time (sec) - time period in seconds over which the change is measured;
  • Value - threshold value for the change in Lim_Sell/Lim_Buy;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled.

Important! Works only when trading is enabled for the portfolio

#
#
7.4.3. Severe sell change and Severe buy change

Notify about "sharp" changes in the portfolio's Sell/Buy:

  • Time (sec) - time period in seconds over which the change is measured;
  • Value - threshold value for the change in Sell/Buy;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled).

Important! Works only when trading is enabled for the portfolio.

Important! Note that when prices for the portfolio’s financial instruments are unavailable and/or when it is impossible to calculate Sell/Buy, the values of Sell/Buy parameters will be equal to 0.

#
#
7.4.4. Severe pos change

Notify about a "sharp" change in the portfolio's position Pos портфеля:

  • Time (sec) - time period in seconds over which the change is measured;
  • Value - threshold value for the position change;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled).

Important! Works only when trading is enabled for the portfolio.

#
#
7.4.5. Too much running orders

Notify about an excessive number of active orders for non-Is first instruments in the portfolio. That is, if for each non-Is first instrument in the portfolio we obtain the number of active orders and take the maximum among these values, then the notification will be sent if this maximum is strictly greater than the specified percentage of Max not hedged.

  • Percent (%) - threshold percentage;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled).

#
#
7.4.6. Too much not hedged

Notify about an excessively large unhedged position for the Is first instrument in the portfolio:

  • Limit portfolios - threshold value for the unhedged position (calculated in number of portfolios); in the robot's algorithm, the condition uses the "strictly greater than" comparison;
  • Stop trading - disable trading for the portfolio together with the notification (the schedule will also be disabled).

#
#
7.5. User Parameters

The robot includes a group of 20 user-defined parameters called User fields with identifiers ranging from 0 to 19. These parameters are not used in the robot’s main algorithm. They can be used either to display values computed in C++ Formulas, or conversely as input parameters for formula calculations. The values of these parameters are preserved across robot restarts. In the main table of the Portfolios table widget, these parameters appear as table columns named User field#0 ... User field#19. In the portfolio settings form, the User fields parameters are configured on a separate tab, where both the value and label of each parameter can be set. Parameter values are of type double.

Non-obvious detail!
Column headers in the main table of the Portfolios table widget are fixed and cannot be renamed — you cannot change User field#0 ... User field#19 into custom names. Moreover, a single user field from one column may be used differently in formulas across various portfolios. However, on the USER FIELDS tab in the portfolio settings within the Portfolios table widget, you can define custom labels for the user fields. Here is how a label is set in the settings:

Alt text

And here is how it might appear in the main table of the Portfolios table widget when different portfolios have different field labels:

Alt text

#
#
7.6. Position Parameters

#
#
7.6.1. Instrument Position Parameters

Instrument position parameters are displayed separately for each connection on the "Positions/Balance" tab of that connection and are presented as a table. The rows of the table correspond to the instruments of this connection used in the robot’s portfolios. If multiple client accounts are accessible through this trading connection, each row will represent a pair (client account, instrument). Instruments with zero position may be hidden (to do this, uncheck the Show_zero_posesflag). Below are descriptions of the table columns; parameters are assumed to be editable unless otherwise specified.

#
#
7.6.1.1. SecKey

Unique instrument identifier. Corresponds to the portfolio instrument parameter SecKey. Non-editable parameter.

#
#
7.6.1.2. SecCode

Instrument code. Corresponds to the portfolio instrument parameter SecCode. Non-editable parameter.

#
#
7.6.1.3. Pos

Exchange position for the instrument. Non-editable parameter.

#
#
7.6.1.4. Robot pos

Total instrument position across all portfolios in the robot trading via this connection, using the specified financial instrument and client account. Non-editable parameter.

#
#
7.6.1.5. Mark price

"Mark" price of the instrument. Non-editable parameter. If Mark price reaches Liquidation price, the instrument's position will be forcibly closed by the exchange.

#
#
7.6.1.6. Liquidation price

Instrument liquidation price. Non-editable parameter. If Mark price reaches Liquidation price, the instrument's position will be forcibly closed by the exchange.

#
#
7.6.1.7. Pos lag

Value against which the difference between Pos and Robot pos is compared. The comparison itself and subsequent actions are determined by the parameter Check equality.

#
#
7.6.1.8. Check equality

If the flag is set, then in the following situation:

posrobot_pospos_lagpos-robot\_pos\neq pos\_lag

you will receive log notifications indicating that the exchange position and robot position do not match. (pos - position on the exchange, robot_pos - position in the robot across portfolios trading this financial instrument via this connection) If the flag is not set, notifications will be sent only if:

posrobot_pos>pos_lag|pos-robot\_pos|>pos\_lag$

#
#
7.6.1.9. Tgr notify

If the flag is set, send notifications about mismatch between robot and exchange positions to Telegram.

#
#
7.6.1.10. Pos leveling

Place an order with specified direction, price, and volume. By default, direction and volume are set to align the exchange position with the robot's position (this order does not change positions in the robot’s portfolio instruments).

#
#
7.6.2. Currency Position Parameters

Currency position parameters are displayed separately for each connection on the "Positions/Balance" tab of that connection and presented as a table. The rows correspond to currencies/cryptocurrencies included in the instruments traded through this connection and used in the robot’s portfolios. If multiple client accounts are accessible via this trading connection, each row represents a pair (client account, currency). Currencies with zero balance may be hidden (to do this, uncheck the Show zero poses flag). Below are descriptions of the table columns; parameters are assumed to be editable unless otherwise specified.

#
#
7.6.2.1. Currency

Short name of the currency/cryptocurrency.

#
#
7.6.2.2. Limit

Currency limit.

#
#
7.7. Portfolio Parameter Validation Rules upon Portfolio/Instrument Creation or Editing

If any condition listed below is TRUE, then such settings are NOT valid:

#
#
7.7.1. For the portfolio

  1. The Quote parameter is disabled, while Simply first is enabled;

  2. The robot build lacks order book support and the Simply first parameter is enabled;

  3. The robot build lacks order book support and the value of the Type price parameter is set to bid/ask;

  4. The Quote parameter is disabled and Only maker is enabled;

  5. The value of the Max not hedged parameter is greater than 1, and the financial instrument's position on the exchange has separate buy and sell legs;

  6. The values of the v_min/v_max parameters have opposite signs (or one of them equals 0), and the financial instrument's position on the exchange has separate buy and sell legs;

#
#
7.7.2. For the financial instrument

  1. For OKEX-SPOT financial instruments: Client code does not end with "/cash", "/cross_base", "/cross_quote" or "/isolated" or is set to “virtual”;

  2. For OKEX-FUT financial instruments: Client code does not end with "/cross" or "/isolated" or is set to “virtual”;

  3. For the first leg, Count type = constant and Count = 0;

  4. For the first leg, On_by = Sell;

  5. An empty value is selected for Сlient code and Count is not 0;

#
#
7.7.3. The following portfolio parameters are prohibited from being changed when the portfolio is trading or has active orders

  1. Is first

  2. Client code

  3. On_by

  4. Leverage

  5. Curpos

  6. Count

  7. Count formula

  8. TP

  9. Ratio

  10. Ratio type

  11. Ratio sign

  12. Ratio buy formula

  13. Ratio sell formula

  14. Custom trade

  15. Extra formulas

  16. Trade formula

  17. Extra field#1

  18. Extra field#2

  19. Type trade

  20. Type price

  21. Type