Order Handling Methods |
ArthaChitra submits 2 (two) types of orders, namely, historical orders and live orders.
Historical orders are submitted while processing the historical bars and are essentially dummy or synthetic orders and no actual orders are submitted (to the associated account). Live orders on the other hand are actual orders (except for simulated account) and are reflected in the account associated with it.
Any position opened in the historical bars must be closed before a live order can be submitted. The strategies (as listed in Strategies tab in Main View) highlighted in pink reflects that a position has been opened in historical bars and is waiting to be closed. Once the position turns flat, live orders will be submitted on the next trigger. The below screenshot further demonstrates it.
In order to ensure no redundant orders are submitted by a strategy, ArthaChitra lays down order handling rules which guides how an order will be processed. The order handling rules may ignore an order if it deems fit. Below are some of the scenarios which discusses the order handling rules.
Enter methods (e.g. EnterLong) will be ignored when:
Exit methods (e.g. ExitPosition) will be ignored when:
Set methods will be ignored when:
Note: Orders ignored by the Order Handling Rules are displayed in the Output View. Please make sure you have set TraceOrders to "true".
The EntriesPerDirection property determines how many entries in the same direction will the strategy allows. For example if the EntriesPerDirection is set to 1 (one) then only 1 (one) entry will be allowed. If the strategy triggers a 2nd entry in the same direction then the order handling rules will ignore the call. A 2nd entry in the same direction can only take place once we exit the first trade.
The EntriesPerDirection is calculated based on how the user has configured the EntryHandling settings. If EntryHandling is set to AllEntries then all current trades are taken into consideration while calculating the EntriesPerDirection. However if the EntryHandling is set to UniqueEntries, then orders with the same unique name will be taken into consideration to calculate the EntriesPerDirection value.
Let's exemplify the scenario. Say the strategy generates 3 (three) long entries.
Scenario 1 : If Entries per direction is set at 1 (one)
AllEntries | Only the first entry will be taken. the 2nd and 3rd entries will be ignored. |
UniqueEntries | The 1st and the 2nd entries will be taken. the 3rd entry will be ignored. |
Scenario 2 : If entries per direction is set to 2 (two)
AllEntries | The 1st and the 2nd entry will be taken. the 3rd entry will be ignored. |
UniqueEntries | All the orders will be taken. |
Multi-series consideration
The EntriesPerDirection in a multi-series envirionment is independent of each other, i.e. BarsArray[0] will calculate its own EntriesPerDirection and BarsArray[1] will have its own EntriesPerDirection and both are independent of each other. For example if you set the EntriesPerDirection to 1 (one) and the EntryHandling is set to AllEntries, and you submit a long order in the primary bars (BarsArray[0]) then all subsequest long orders in that bars series will be ignored. However you can submit a long order in the secondary bars series (BarsArray[1]). Since they are independent of each other the long order in the secondary series will be NOT ignored. Subsequest long orders in the secondary series will however will be ignored (as per the EntriesPerDirection rule)
Action | Result |
---|---|
Long order in primary bars (BarsArray[0]) | Order will be submitted |
Long order in primary bars (BarsArray[0]) | Order will be ignored |
Long order in secondary bars (BarsArray[1]) | Order will be submitted |
Long order in secondary bars (BarsArray[1]) | Order will be ignored |
Clicking on Close or Reverse button from any of the views, will close the global position for that instrument (global position includes positions created manually and by strategies) and will disable all the strategies pertaining to the said instrument.
ArthaChira lets you configure (from Settings > Options > Strategy tab in Main View) on how the strategy will deal with connection loss or order rejection etc. Please refer here for more details.
If the account suppots margin order then user have the choise set the 'Is Margin' property from the Strategy Selector View. The 'Is Margin' property can be set when the Strategy State is in Initialize mode only.