Slippage
Last updated
Last updated
Slippage is a conditional order parameter that determines the deviation from the price of the condition, for the worse for you.
Slippage only works for conditional orders! For other order types, slippage is not used. However, the program has a mode for "by market" orders, which is enabled by the "Convert by market to limit orders" setting (agent's settings), when placing such an order, slippage from the agent's Trading settings can be used.
In trading settings, slippage is set for the entire agent. In percentages and in steps, both parameters are summed up before order formation and represent a single slippage parameter for a conditional order.
Slippage in trading settings has a lower priority than slippage, which is located directly in the block for entering and/or exiting a position (set in absolute values):
If there are 5 points in a certain entry block, and a slippage of 1% is set in the trading settings, then 5 points will be taken for orders of this signal, and 1% for the rest of the script
Currently, not implemented in the program, the columns themselves are present, but not filled.
Under slippage, the user can understand not only the Parameter in a conditional order, but simply, the execution at prices different from the price of the order. You place an order to buy "By market" at the opening of the bar, at the current price of 100 (the price of the last transaction on the market, it is also the Opening of the bar), and the execution price from the exchange comes 105. This difference can be understood as slippage, not a parameter in the order, and slippage performance.
As part of the execution slippage, the execution price can be either worse than the order price or better.
If during the period between the triggering of the condition and placing the limit order, the price went sharply in our direction, the broker (or program) will execute the order at the best price, below is an example with a picture for a conditional order "Sell if lower". Positive "execution slippage" often occurs when the slippage parameter is set to 0 in a conditional order. The slippage set in the order works only in the direction of the order and in no way limits the execution price from above (for selling), from below (for buying).
Conditional order "Sell if below price 114510, with 0 slippage". That is, sell at a price of 115510 or higher as soon as the transaction price for the instrument (the current quote) touches the condition price.
All previous settings, both in blocks for entering a position, and in blocks for exiting a position, and in trading settings, are not taken into account in any way when optimizing the script and work only when trading. When developing a script, testing and optimizing, use the "Commission" blocks in order to take into account possible "execution slippage", all commissions, all slippage parameters,
Current price: 90
We place an order: "Buy 5 lots, if above 100, slippage 10"
When the current price reaches the level of 100, a limit order is placed (by the broker or by us, depending on whether the broker supports conditional orders): Buy at a price of 110
Thus:
if there is a total volume of 5 for sale between prices 0 and 110, there will be transactions in the order queue (in the order book). The average trade price is the order execution price.
if there are no 5 lots between prices 0 and 110 in the queue of orders for sale, then transactions will be completed at the existing volume and a limit order at the price of 110 will be placed on the balance, that is, the current price has become higher than 110
if there is no Wait for execution parameter in the trading settings, the order will be canceled for recalculation and will be partially executed.
if at the same time Auto open / Auto close is enabled in the trading settings, then the order on the market will go to the rest. The market order will be an integral part of the total portfolio order for this signal.