AddOrder ( int type, IDataHolder condition, IDataHolder price, IDataHolder tradeSize, CustomColor tickColor, CustomColor arrowColor, String name);
tradeSize: specified by strategy settings
name: "<strategy name>"
Adds an order of specified side and position effect for the next bar when the condition is true.
|type||OrderType.BUY_AUTO||Defines order side and position effect using the OrderType constants.|
|condition||-||Defines condition upon which the order is added.|
|price||open[-1]||Defines price at which the order is added.|
Defines the number of contracts traded. Note that this value overrides the trade size specified in Strategy Global Settings.
|tickColor||Color.MAGENTA||Defines the color of tick marking the trade price.|
|arrowColor||Color.MAGENTA||Defines the color of signal arrow.|
|name||Color.MAGENTA||Defines the order name which will be displayed on "Orders" tabs in strategy settings, in strategy report, and as captions to the Buy/Sell signal arrows on chart. By default, all orders use the same name as the strategy itself.|
AddOrder(OrderType.BUY_AUTO, close > close, open[-1], 50, Color.ORANGE, Color.ORANGE, "Sample buy @ " + open[-1]);
If the current Close price is higher than the previous, the code opens the long position or closes the short one at the Open price of the next bar. The trade size will be equal to 50, signals will be colored orange, and each signal will display the buying price.