Why an Order Was or Was Not Executed: Difference between revisions
From MultiCharts
Why an Order Was or Was Not Executed (view source)
Revision as of 15:27, 11 June 2014
, 11 June 2014no edit summary
No edit summary |
|||
Line 1: | Line 1: | ||
It | It's common for a customer to expect an order to be generated and executed or vice versa, not be generated and not to be executed at a particular place on a chart. A combination of the 2 following methods should help you understand why an order was filled or not during auto trading. | ||
==Order and Position Tracker== | ==Order and Position Tracker== | ||
If an order was generated and sent from script to broker plugin, it is displayed in Order and Position Tracker on Orders tab. If an order is filled you can see it execution price and details (see [[Order and Position Tracker|Orders Tab]]). | If an order was generated and sent from the script to a broker plugin, it is displayed in the Order and Position Tracker on the Orders tab. If an order is filled, you can see it's execution price and details (see [[Order and Position Tracker|Orders Tab]]). | ||
<br> | <br> | ||
There are 2 possible reasons why an order is not placed at broker: | There are 2 possible reasons why an order is not placed at the broker: | ||
# The order was '''rejected''' either by MultiCharts, or by broker (in most cases you can find the reason | # The order was '''rejected''' either by MultiCharts, or by the broker (in most cases, you can find the reason for rejection in the Logs tab of the Order and Position Tracker (see [[Order and Position Tracker|Logs Tab]]) | ||
# The order was '''cancelled''' from script. According to logic of EasyLanguage/PowerLanguage, an order will be maintained as long as the conditions for its generation are met on each calculation. Once a condition is not met, it will be cancelled. | # The order was '''cancelled''' from the script. According to the logic of EasyLanguage/PowerLanguage, an order will be maintained as long as the conditions for its generation are met on each calculation. Once a condition is not met, it will be cancelled. | ||
<br> | <br> | ||
==Monitoring from Script== | ==Monitoring from Script== | ||
This method is extremely useful not only for backtesting, since Order and Position Tracker has nothing in common with the | This method is extremely useful not only for backtesting, since the Order and Position Tracker has nothing in common with the historical calculation process, but also for live auto trading because you can see the strategy logic printed out in real-time. | ||
Adding the following line under the same conditions right before the line, generating your buy/sell orders will help you to understand at what particular bar, when and at what price | Adding the following line under the same conditions right before the line, when generating your buy/sell orders, it will help you to understand at what particular bar, when, and at what price, your order is triggered in the code: | ||
<br> | <br> | ||
<br> | <br> | ||
Line 64: | Line 64: | ||
<br> | <br> | ||
<br> | <br> | ||
If the script is applied to your chart and it is opened in PowerLanguage Editor, you will be able to see the following lines in the Output tab: | If the script is applied to your chart and it is opened in the PowerLanguage Editor, you will be able to see the following lines in the Output tab: | ||
<br> | <br> | ||
<br> | <br> |