- Trading
- Program Trading
- Advisors for NetTradeX
- NetTradex Advisors (FAQ)
Frequently Asked Questions
All NetTradeX Advisors scripts are stored in the Documents\NeTTradeX Advisors\scripts folder. After the installation of the terminal on another computer, you need to copy all the contents of this folder into the corresponding folder on the new computer and restart the terminal.
To output lines without gaps, use the SetIndexStyle function with the type parameter that has ltSection value.
Once a tick comes, the expert should perform all the logic of the program within a limited time frame (60 seconds). When the limit is exceeded, the expert stops forcibly, and 3 additional seconds are given to the expert to complete the work. It is recommended to analyze the state of System.IsStopped flag for the expert to correctly complete its work. When the expert stops, the user recieves "stopped by timeout" message. In that case the program should be processed so that its execution takes less time.
Having made sure that the Deals.Open() function returns zero, you need to access the System.LastError property and receive the error code. Description of error codes is provided in the user manual in the section "Basics" – "Error Codes". Please pay attention to the fact that the property System.LastError should be accessed immediately after a trading function call, otherwise the subsequent trading operation will change that property in accordance with the results of its work
To access properties of a deal or an order, you should first call the Select() function and, having made sure that Select() has returned true value, refer to the deal or order properties.
To determine the type of a placed order, you need to access its properties after calling the Select() function. There are two conditions that must be met for the Buy Stop order: Orders.Direction == opBuy and Orders.IsLimit == false, respectively, for the Buy Limit order – fulfillment of the following conditions is required Orders. Direction == opBuy and Orders.IsLimit == true.
The Order subtype property is used for 'complex' orders and allows identifying which order is the main and which one is subordinate. For example, in case an activation order is present and it is triggered so that the two OCO orders are set, the activation order will be the main order (order level 1) and the OCO orders – subordinates (order level 2).
The deal symbol list in the opening position dialog window contains the same symbols as the Market Watch window. Therefore, before sending a request for opening a position, make sure that you are subscribed to the necessary symbol in the Market Watch.
Information on closed positions is shown on the History tab in the NetTradeX Advisors terminal. These positions can be accessed by means of the History object. Information on closed positions is kept until the terminal is restarted.
Before calling the Symbols.Distance() method, you must subscribe to the needed symbol in the Market Watch.
To run a script the Run () function is necessary. The functions Initialize () and DeInitialize () are optional and if no steps are required at initialization and deinitialization, they can be excluded from the program.
In some cases, such as creating files with descriptions of auxiliary user functions, there may also be no Run() function in the script. These files can be compiled, but not executed. Such scripts are used together with the #include > directive and are included in the code of the executable scripts.
Yes, all information displayed on the Journal tab is also stored in the log file, which is located in the Documents\ NetTradeX Advisors\ bases\ account_type\ account_number\ logs. . There is a separate file with a log for each day. This file can be opened in a text editor.
A global variable can be declared with the extern modifier and without it. If the extern modifier is present, after running the script, a window for changing such parameters will be opened. In addition, these parameters can be changed on the fly when an advisor or indicator is running.
Pressing the Ctrl+N key combination opens a list of symbols available for creating a quotation chart.
While working with charts, you can use the + and - keys on the numeric keypad to change the scale of the chart horizontally. The same operation can be performed when the cursor is on the time scale and the user holds the left mouse button and moves the mouse to the left or right. To change the vertical scale, move the cursor on the price scale, hold the left mouse button and move up or down.
To display the price chart for the most distant date, you can press the Home key, and to access the latest quotations – End key.
A double-click on an empty field of the Open Positions tab will open the deal window, and a double-click on an empty field of the order tab – the order setting window. The same operations can be performed by pressing F4 (making a deal) or F3 (setting an order).
It is convenient to change values of numeric fields in the making deals or setting orders dialog windows by turning the mouse wheel. For example, when setting prices for linked orders, the turn of the wheel by one step changes the price by one point.
Since both operands are integers, the result of the division operation will be an integer, so you must convert one of the operands to the double type as follows: double(2)/3, the result will be 2/3 = 0.666667.
Global variables can be seen through "Global Variables" window, which can be called from the menu View – Global Variables. Note that each account has its own global variables.
When using the method of Indicators.Fractals, it is useless to try getting the value for the last bar, as they will be zero. Reliable values of fractals are generated, beginning from the fourth bar (the bar with index 3), since, in this case, two fully formed bars will be used per each side of the required bar.
Figures in computer memory are saved in binary system of calculation. Because of that many figures, specified in decimal system, can be presented only as continued fraction. For example, a figure, given as 0.1, in fact, can be equal to 0.09999999. That is why using a double equality for comparing figures with floating point, is not correct. It is better to use Math.Abs(a - b) < delta mathematical method, where 'a' is the resulted value, 'b' - the value with which the comparison is performed and delta - an absolute error.