» Instrument Planned_Order
Order instrument Planned_Order (23) is used to open or place an order of the selected type at the specified time.
Permissions for Placing the Instrument
The chart instrument Planned_Order is placed on the price chart and is not placed on any particular order.
Limitations on Placing the Instrument
The Instrument Planned_ Order is going to be placed (down):
When the Instrument Planned_Order is placed no other instruments may be deleted. The user may place up to 30 instances of the instrument Planned_Order instances on the chart.
If Instrument Planned_Order has already been placed (across):
Placing any other Instruments does not result in deleting the Instrument Planned_Order.
Requirements for Placing the Instrument
To place the Planned_Order instrument no other instruments are required.
Placing the Instrument
To place the instrument Planned_Order, click the instrument icon in the Control Panel, drag it to the right from the zero bar on the chart. The instrument icon will be displayed in the following coordinates: price – according to the instrument execution price, time – on the bar, where the user releases the mouse button. If the instrument has been placed successfully, the notification area will display a confirmation message and you will also hear a corresponding sound alert.
The user may place up to 30 instances of instrument Planned_Order on the chart. When the total number of instruments instances placed on the chart reaches 30, the attempt to place one more instance will be considered "invalid" by AutoGraf 4. In this case placing another instance of Instrument Planned_Order will fail; the notification area will display a message stating that the user has made an error. You will also hear a corresponding sound alert.
Placing Instrument Planned_Order.
1. To bring up the scale of order types, click the Instrument Planned_Order icon in the Control Panel and move it moderately sideways.
2. A Sell order type is chosen from the scale.
3. Instrument Planned_Order is placed to open a Sell order at the desired time.
4. A BuyLimit order type is chosen from the scale.
5. A Planned_Order is placed on the chart to place a BuyLimit order at the desired price and time.
6. The settings for Instrument Planned_Order are displayed (238/93 upwards):
- the execution price parameter is not specified for the instance of Instrument Planned_Order, that is placed to open a Sell order;
- on the other hand, the execution price parameter IS specified for the Instrument Planned_Order instance to open a BuyLimit order.
Instrument Planned_Order is characterized by the following parameters:
The indexes of the instrument parameters correspond to the indexes of these parameters in array Instrument[i][j], where:
0 - the unchangeable index for the Planned_Order instrument in the first dimension of array Instrument;
1 - the unchangeable index for the Planned_Order instrument in the second dimension of array Instrument;
i - the number of the Planned_Order instrument instance (from 1 to 30) (across);
j - the index of Planned_Order instrument parameter;
Instrument - the number of Planned_Order instances placed on the chart.
- the fact of placing the instrument; this parameter can be modified in the manual mode by placing and deleting the instrument.
- the instrument execution time; this parameter can be modified in the manual mode by moving the instrument icon to the right from the zero bar (horizontally). The Instrument execution time is displayed below the Instrument icon, the color of the current parameter value matches the color of the Instrument icon.
To change the Instrument execution time with a step equal to a timeframe, move the icon horizontally. To set the Instrument execution time with the accuracy of 1 minute, enter the desired value on the ‘Properties’ Panel of the Instrument. To show the panel, right click the icon to bring up the context menu, choose ‘Properties’. Enter desired instrument execution time on the object ‘Properties’ panel (Parameters – Time). When settings are changed, the icon will be displayed on the bar corresponding to the requested time.
An attempt to place the Instrument to the left of the zero bar will not change the time parameter value and the Instrument icon will return back to its initial position according to the current parameter value.
- the Instrument execution price for Pending orders; price coordinate for Instrument icons.
When placing the Instrument, the parameter takes on the value of the price on which the instrument icon is dropped. Dragging the instrument icon downwards decreases the execution price, dragging it upwards – increases. The execution price takes on the value of the price at which the user releases the mouse button (drops the icon on a new price).
To change the Instrument execution price with the accuracy of one pip, Moving the instrument icon vertically allows the user to change the execution price with the accuracy of 1 pixel. To specify the exact Instrument execution price, enter the desired value on the ‘Properties’ panel of the instrument. To show the panel, right click the icon to bring up the context menu, choose ‘Properties’. Enter a desired execution price of the instrument on the object ‘Properties’ panel (Parameters – Value). When settings are changed, the icon will be displayed on the chart according to the selected price.
If the Instrument is intended to place a pending order, the parameter value is displayed above the Instrument icon. If the Instrument is intended to place a market order, the value of the ‘execution price’ parameter will only define the position of the instrument icon on the chart, but will not affect the Instrument execution (market orders are opened at the market price). In this case, the ‘execution price’ parameter will not be displayed above the instrument icon.
- StopLoss of a market order, that is going to be opened (in pips).
- TakeProfit of a market order, that is going to be opened (in pips).
When the instrument is placed, the SL and ТР parameters take on the values of SL and ТР settings in AutoGraf 4 sub-window. Instrument parameters may be adjusted at any moment by choosing a new value from the scale. To bring up the scale, click the current parameter value that is displayed to the right (above and below) of the instrument icon and move it moderately sideways. The value chosen by the user from the scale is accepted as the new order parameter.
Please note, that the SL and TP parameters may be displayed either above or below the instrument icon depending on the order type (Buy or Sell) and their color matches the color of these parameters color in AutoGraf 4 sub-window.
- the type of the Planned_Order; it may have values from 0.0 to 5.0 according to the following numbering: Buy = 0.0, Sell = 1.0, BuyLimit = 2.0, SellLimit = 3.0, BuyStop = 4.0, SellStop = 5.0.
The user must choose the type of order to be opened before placing the instrument. To choose the order type, that will be opened when the Instrument Planned_Order is executed, click the Instrument icon in the Control Panel and move it moderately sideways. As a result, a scale with six order types will appear in the sub-window; icons on the scale will have the colors, that were pre- set by the user to identify order types (the same as the color of order lines). To choose an order type, click the icon on the scale and move it moderately sideways.
- the number of lots for the planned order; when placing the instrument, it takes on the value of the Lot setting, displayed in AutoGraf 4 sub-window.
The user may arbitrarily enter the lot size value, as long as it is divisible by the minimum modification step. The minimum parameter value is the minimum lot size allowed by your broker. The maximum lot size is the current Lot size setting value in AutoGraf4.
The parameter value also can be modified by choosing a new value from the scale. To bring up the scale, click the current parameter value that is displayed to the left of the instrument icon and move it minimally in a sideways direction. The value chosen by the user from the scale is accepted as the new order parameter.
AutoGraf 4 doesn’t analyze the parameter value. Therefore, you may enter a lot size that is not covered by your current free margin. Meaning, that the trader may count on the profits he plans to make before the Instrument Planned_Order is executed.
1. Changing the execution time for the Instrument Planned_Order intended to open a Sell order (the price coordinate is used to position the Instrument icon on the chart, but it is not taken into consideration when opening a market order).
2. Entering the exact parameter values on the ‘Properties’ panel for the Instrument icon. When you click OK on the “Properties” panel, the position of the Planned_Order icon on the chart changes automatically according to the new parameter value.
To allow Planned_Order instrument execution in AutoGraf 4, the semi-automatic or the automatic mode must be enabled (drag the AG or AT icon upwards).
The instrument is executed when the Correct Price reaches the execution price for the Instrument Planned_Order. At this point, a new order with the pre-set parameters is opened.
Market orders are opened at the current market price.
Pending orders are opened at the execution price, that the user specified for Instrument Planned_Order. If the instrument execution price has not been reached by the time, specified by the user as the ‘instrument execution time’, a Pending Order will be placed at the requested execution price. If by the time specified as the “instrument execution time”, the requested execution price has already been reached and the the market moved past it, a pending order will be placed at the closest available price. This condition comes in effect when, by the time, when Planned_Order must be executed, the market price is above the execution price for Planned_Order instruments, used to place BuyStop and SellLimit Orders, and below the execution price for Planned Order Instruments used to place Buy Limit and Sell Stop orders.
When generating a trading order to execute the Instrument Planned_Order, AutoGraf 4 takes into consideration all the requirements and limitations for making trading operations.
If the manual mode is enabled when the Instrument Planned_Order is executed, its execution fails.
1. Instrument Planned_Order is executed when the current time reaches the Instrument execution time.
2. A BuyLimit pending order is opened with the pre-set Instrument parameters – execution price, lot number, StopLoss and TakeProfit.
Deleting the Instrument
All instruments in AutoGraf 4 are executed while they are placed and are present on the chart. To stop the execution of an instrument - delete it from the chart. The instrument Planned_Order can be deleted manually by the user or automatically (by the system).
To delete Instrument Planned_Order manually, click the icon and press Delete. Such control action is always executed by AutoGraf 4 application without failure (as opposed to trading orders that are executed on the server side and may fail). When deleting the instrument manually, make sure that other instruments or order lines are not selected. Deleting other objects together with the instrument icon may (depending on what kind of objects are selected) result in deleting other instruments or generating unplanned trading orders (order deleting and modification).
The Instrument Planned_Order is automatically deleted, if the manual mode is enabled when the instrument execution time comes.
The Instrument Planned_Order is automatically deleted after its execution is complete.
If the manual mode is enabled at the execution time of the Instrument (AG or AT icons are downwards), the Instrument Planned_Order is automatically deleted.
The Instrument Planned_Order is also automatically deleted after its execution is complete.
Placing and deleting of the Instrument Planned_Order programmatically
When working with AutoGraf 4, the user may change the number Planned_Order instances placed on the chart (i.e. place a new one or delete instances that have already been placed). As a result of this action, AutoGraf 4 will update the array Instrument in order to delete empty lines. The necessary calculation is done shortly before control is transmitted to the trading function AG_AT(), i.e. the updated arrays are sent to the trading function during each new iteration.
For instance, three instances of the Planned_Order instrument have been placed on the chart. Their parameters are already indicated in the array Instrument in the lines Instrument[j],, Instrument[j] or Instrument[j] (j – parameter index). If the instrument instance with the index 2 is deleted, the array Instrument is updated – the values in the line Instrument[j] remain unchanged, the values of the line Instrument[j] are copied to the empty line Instrument[j], then the values of the line Instrument[j] are set to zero. As a result, the instrument that used to have index 3, will get index 2.
1. 3 instances of the Planned_Order instruemts have been placed on the chart. Their (corresponding to the order number i ) reflect the succession in which these instances have been placed.
2. When the user deletes the instance #2 from the chart, the indexes of the remaining Planned_Order instances in array Instrument are automatically updated.
If the automatic mode is enabled (the AT icon is upwards), the control will be transmitted to the function AG_AT() with a new iteration, only when all arrays, including the array Instrument, have been updated.
Placing and deleting Planned_Order instrument programmatically is illustrated in the following example 15.