fnOpenOrder








The following table provides information about each parameter of the fnOpenOrder function.


symbol

The symbol name of the currency.  CHART specifies the the currency of the chart to which the EA is attached.

cmd

The type of order:

price

The price at which to enter the order.

MetaTrader usually requires Buy orders to use the Ask price and Sell orders to use the Bid price. These are the VTSdefault values for the price parameter.

slippage

The amount of points, as an integer, the price can move from the requested open price.  

VTS creates an extern (or Input)  variable named Slippage that can be used for this parameter;  its default value is 3.

lots

The number of lots to open.

  • VTS creates an extern (or Input)  variable named Lots that can be used for this parameter;  its default value is 1.0.
  • A value can be manually entered into the text-box.
  • A value can be selected using the Choose button.
  • A Money Management value can be entered by selecting MM Value, a percentage and an Account choice. This will dynamically calculate a lot size using the selected information.
  • A Money Management value can be entered by selecting the Choose button, selecting the MoneyMgt tab, and selecting the value MmLotSizePercentage.  The variable MmLotSizePercentage is an extern (or Input)  variable that can be entered in the Inputs window when attaching the Expert Advisor to a chart.  This will dynamically calculate a lot size using the Account Balance and the value of MmLotSizePercentage

stoploss

The value at which to close the trade for a loss.

  • VTS creates an extern (or Input)  variable named StopLoss that can be used for this parameter;  its default value is 200.
  • A value can be manually entered into the text-box.
  • A value can be selected using the Choose button.
  • A value can be entered as an integer or as a price level by selecting the Offset value or Absolute value button.  The Absolute value option is useful for using technical indicator values or price values such as Low[1] or High[1].

takeprofit

The value at which to close the trade for a profit.

  • VTS creates an extern (or Input)  variable named TakeProfit that can be used for this parameter;  its default value is 200.
  • A value can be manually entered into the text-box.
  • A value can be selected using the Choose button.
  • A value can be entered as an integer or as a price level by selecting the Offset value or Absolute value button.  The Absolute value option is useful for using technical indicator values or price values such as Low[1] or High[1].

trailingstop

The trailing stop option is enabled by checking the Use Trailing Stop checkbox.

  • The trade is not trailed until the trade is profitable.
  • VTS creates an extern (or Input)  variable named TrailingStop that can be used for this parameter;  its default value is 100.
  • A value can be manually entered into the text-box.
  • A value can be selected using the Choose button.
  • A value can be entered as an integer or as a price level by selecting the Offset value or Absolute value button.  The Absolute value option is useful for using technical indicator values or price values such as Low[1] or High[1].


comment

A string of text that is assigned to the order.  This text is displayed in the Trade tab of the MetaTrader platform.  

Note: The MetaTrader broker may change this text when the order is modified.

magicnumber

(advanced)

The unique integer number used to identify an open trade.

expiration

(advanced)

A datetime value that causes the order to expire.  Only used for non-market orders.

arrow_color

(advanced)

The color of the arrow drawn on the price chart.




The bottom portion of the window allows the Element Name to be saved.

Related Topics:
What is VTS
Why use VTS
System Requirements
Installing VTS
Main Menu
Property Window
Toolbox FUNCTIONS Pane
Welcome Screen
Everything You Need To Know About VTS
Expert Advisor Facts
Configure
Assignment
Condition
Configure
PLATFORM Function
Custom Indicators
MQL Function
TEXT Element
INPUT Manager
TRADETIME Manager
TRADESIGNAL Manager
COMMUNICATION Manager
OPENTRADE Manager
Message
Logic
MetaTrader Platform Configuration
Compiler
Compiler Flags
Platform
Editor
EA Output Folder
Custom Indicator Folder
License
Special Functions
fnModifyOrder
fnCloseOrder
init and deinit
MetaTrader Platform
Journal Tab
Experts Tab
Expert Menu
MQL Help
Trade Tab
ECN Brokers
Step 1
Step 2
Step 4
Function and Logic Power Plug-in
Logic
Candlestick Plug-in
Candlestick Function Parameters
Candlestick Drawing
Using a Candlestick Function in a Logic Element
Easy Email Plug-in
Configure Easy Email Settings
Using Easy Email from the Communication Manager
Using Easy Email from any Element
Using Easy Email with the fnSendEzEmail Function
Testing the Easy Email Connection
TrendLine Plug-in
Objects on the MetaTrader platform
Manually drawing a trend line
Removing a trend line
Building an Expert Advisor to manage a manually drawn trend line
Building an Expert Advisor to draw and manage a trend line
Grid Plug-in
FX PowerGrid Functions
Grid Main Settings
fnRemoveLines
Using FX PowerGrid
Script & Multi-Platform Plug-in
Building a MetaTrader Script
Using the Multi-Platform Feature
Profit Exits Plug-in
Using the Exit Plug-in
Profit Manager Plug-in
Using the Profit Manager
Target
Action
Price Chart
Client-Side Stops Plug-in
Emergency Stops
Using Client-Side Stops
Using an Offset Value
Using an Absolute Price Value
Fibonacci Trader Plug-in
Objects on the MetaTrader Platform
Manually Drawing a Fibonacci Retracement
Removing a Fibonacci Retracement
Building an Expert Advisor to manage a manually drawn Fibonacci retracement
Building an Expert Advisor to draw and manage a Fibonacci retracement
Signal Aggregator Plug-in
Signal Type: Element
Signal Type: MQL
Signal Type: Logic Condition
Configuring the Weight and Threshold
MQL-Mentor Plug-in
Using the Code Block Feature
Partial-Close Plug-in
Partial-Close Price Chart
EA-Indicator Plug-in
Enable the EA-Indicator Plug-in
Using the EA-Indicator Plug-in
Custom Indicators in the Toolbox
EA-Indicator Price Chart
EA-Indicator Video
Chart Objects Plug-in
fnDrawHorizontalLine
fnDrawVerticalLine
fnDrawArrow
fnDrawThumb
fnDrawLabel
fnDrawText
fnDrawCheckSign
fnDrawStopSign
Chart Objects on a MetaTrader Price chart
Market Score Plug-in
Adding Symbols
Order History Plug-in
EA Secure Plug-in
Enbale the EA Secure Plug-in
EA Secure Plug-in System Manager
EA Secure Configuration
EA Secure on Price Charts
Chart Execute Plug-in
Chart Execute Configuration
Chart Execute on Price Chart
Using Chart Execute
Chart Execute Notes
Money Manager Plug-in
Money Manager Configuration
Money Management Table
Package Plug-in
Load a Package
Pivot Points Plug-in
fnRemoveAllPivots
Using the Pivot Point Plug-in
Pivot Points on a MetaTrader Price Chart
File IO Plug-in
fnFileRead
fnFileWrite
fnDeleteFile
Multi Trade Plug-in
Using the Multi Trade Plug-in
Multi Trade on a MetaTrader Price Chart
Debug Manager Plug-in
Using the Debug Manager Plug-in
Debug Manager Plug-in on a VTS Drawing