Why an Order Was or Was Not Executed

From MultiCharts
Revision as of 19:03, 3 July 2012 by Andrew MultiCharts (talk | contribs) (Created page with "It is a common situation when a customer expects an order to be generated and executed or vice versa not be generated and not to be executed at a particular place on chart. Ad...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

It is a common situation when a customer expects an order to be generated and executed or vice versa not be generated and not to be executed at a particular place on chart. 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 is your order triggered in code:

print("The date is ", DateToString(DateToJulian(Date)), ", time is ", TimeToString(ELTimeToDateTime(Time)), ", bar # is ", maxbarsback+currentbar-1, ", market position on chart is", MarketPosition, ", market position at broker is", MarketPosition_at_Broker, ", here a LIMIT/STOP order to BUY/SELL is generated by the script at ", "100 price (example)");

Example: ...
If condition1 = true and condition2 = false then begin
print("The date is ", DateToString(DateToJulian(Date)), ", time is ", TimeToString(ELTimeToDateTime(Time)), ", bar # is ", maxbarsback+currentbar-1, ", market position on chart is", i_marketposition, ", market position at broker is", i_MarketPosition_at_Broker, ", here a LIMIT/STOP order to BUY/SELL is generated by the script at ", "100 price");
sellshort next bar at 100 limit;
end;


If the script is applied to your chart and it is opened in PowerLanguage Editor, you will be able to see the following line in the Output tab:

The date is 03.07.2012, time is 18:45:00, bar # is 4362.00, market position on chart is 1.00, market position at broker is 1.00, here a LIMIT order to SELL is generated by the script at 100 price