RunCommandOnLastBar (Function)

image\trumpet2.gif Disclaimer

The RunCommandOnLastBar function allows you to run a Command Line instruction or Macro from within any EasyLanguage study.

This function only runs the command line instructions or Macro on the last bar of data.

EasyLanguage does not check the validity of the string that is specified for the keyword. If the command is not valid, a message will be displayed in the Events Log.

Syntax

RunCommandOnLastBar(CommandOrMacro);

Returns (Integer)

The value 1 when it runs on the last bar of data, otherwise it returns 0.

Parameters

Name

Type

Description

CommandOrMacro

String

Sets a string value that is either a command line MACRO, or an actual command line instruction sequence.

Remarks

You cannot historically back-test the results of orders place into the market with RunCommandOnLastBar.

Note: If the Update value intra-bar check box is enabled in an Indicator that calls the reserved word ’RunCommand’, it could execute the command line instructions or MACRO on every tick, this is probably not what you are intending.

Examples

Run the ’.CustBuyMarket’ MACRO if time is 10:00am and the Close price is greater than the Open price.

If Time = 1000 AND Close > Open Then
Value1=
RunCommandOnLastBar
(".CustBuyMarket MSFT, 500");

Run the function three times if Condition1 is TRUE. Each instruction set can contain one or more command sets.

If Condition1 Then Begin
Value1=
RunCommandOnLastBar
(".NWS");
Value1=RunCommandOnLastBar(".BuyLimit MSFT, 500 ;; .NewChart;; MSFT");

Value1=RunCommandOnLastBar(".BuyLimit DELL, 500 ;; .NewChart;; DELL");
End;