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 18:04, 16 October 2013
, 16 October 2013→Monitoring from Script
Line 16: | Line 16: | ||
<br> | <br> | ||
<br> | <br> | ||
''' | '''Var: Scale(0);''' | ||
<br> | <br> | ||
<br> | <br> | ||
'''Condition1 = close > close[1];''' | |||
<br> | <br> | ||
<br> | <br> | ||
'''If MinMove < 10 then''' <br> | |||
'''Scale = 1;'''<br> | |||
'''If MinMove > 99 and MinMove > 1000 then''' <br> | |||
'''Scale = 2;'''<br> | |||
'''If MinMove > 999 and MinMove > 10000 then'''<br> | |||
'''Scale = 3;'''<br> | |||
'''If MinMove > 9999 and MinMove > 100000 then'''<br> | |||
'''Scale = 4;'''<br> | |||
'''If MinMove > 99999 and MinMove > 1000000 then'''<br> | |||
'''Scale = 5;''' | |||
<br> | <br> | ||
'''The date is | <br> | ||
'''If Condition1 = true then begin'''<br> | |||
'''print( "======================", NewLine,'''<br> | |||
'''"The date is ", DateToString(DateToJulian(Date)), ",", NewLine,'''<br> | |||
'''"time is ", TimeToString(ELTimeToDateTime(Time)), ",", NewLine,'''<br> | |||
'''"bar # is ", maxbarsback+currentbar, ",", NewLine,'''<br> | |||
'''"current bar open is ", open, ",", NewLine,'''<br> | |||
'''"current bar high is ", high, ",", NewLine,'''<br> | |||
'''"current bar low is ", low, ",", NewLine,'''<br> | |||
'''"current bar close is ", close, ",", NewLine,'''<br> | |||
'''"market position on chart is", MarketPosition, ",", NewLine,'''<br> | |||
'''"market position at broker is", MarketPosition_at_Broker, ",", NewLine,'''<br> | |||
'''"Condition1 is true, so at close of this bar the limit order to buy at ", NumToStr(close,scale), " is generated by the script", NewLine, '''<br> | |||
'''"to be executed at bar # ", maxbarsback+currentbar+1);'''<br> | |||
'''Buy next bar at close limit;'''<br> | |||
<br> | |||
'''end else begin<br> | |||
'''print( "======================", NewLine,<br> | |||
'''"The date is ", DateToString(DateToJulian(Date)), ",", NewLine,<br> | |||
'''"time is ", TimeToString(ELTimeToDateTime(Time)), ",", NewLine,<br> | |||
'''"bar # is ", maxbarsback+currentbar, ",", NewLine,<br> | |||
'''"current bar open is ", open, ",", NewLine,<br> | |||
'''"current bar high is ", high, ",", NewLine,<br> | |||
'''"current bar low is ", low, ",", NewLine,<br> | |||
'''"current bar close is ", close, ",", NewLine,<br> | |||
'''"market position on chart is", MarketPosition, ",", NewLine,<br> | |||
'''"market position at broker is", MarketPosition_at_Broker, ",", NewLine,<br> | |||
'''"Condition1 is false, so no order is generated.");<br> | |||
'''end;''' | |||
<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: | |||
<br> | |||
<br> | |||
''======================<br> | |||
''The date is 10/8/2013,<br> | |||
''time is 4:00:00 PM,<br> | |||
''bar # is 995.00,<br> | |||
''current bar open is 865.32,<br> | |||
''current bar high is 865.98,<br> | |||
''current bar low is 851.63,<br> | |||
''current bar close is 853.67,<br> | |||
''market position on chart is 1.00,<br> | |||
''market position at broker is 0.00,<br> | |||
''Condition1 is false, so no order is generated.<br> | |||
''======================<br> | |||
''The date is 10/9/2013,<br> | |||
''time is 4:00:00 PM,<br> | |||
''bar # is 996.00,<br> | |||
''current bar open is 856.28,<br> | |||
''current bar high is 862.65,<br> | |||
''current bar low is 842.98,<br> | |||
''current bar close is 855.86,<br> | |||
''market position on chart is 1.00,<br> | |||
''market position at broker is 0.00,<br> | |||
''Condition1 is true, so at close of this bar the limit order to buy at 855.9 is generated by the script<br> | |||
''to be executed at bar # 997.00<br> | |||
[[Category:FAQ]] | [[Category:FAQ]] |