forex software

Create and Test Forex Strategies

forex software

fst:manual:expert_options

Table of Contents

MT4-FST Expert Options

When we start the expert we see an Options dialog window. It has two taps: Common and Inputs.

Common Options

Common Options

The expert will work properly when its Common options are set as it's shown on the upper screen shot. If you want these options to be set for you by default when you start the expert, you can preset them in MT4 Options. You can find Options dialog box in Tools → Options menu or by pressing Ctrl + O.

MT4 Options

Inputs Options

Inputs Options

Inputs tab of Expert's starting dialog box shows external variables used in the Expert. You can change their values by double clicking on Value fields. The default values of these variables are set in the code of the expert.

  • Connection_ID is a unique number which must be set in both Expert and FST if you are running more than one copy of FST.
  • Protection_Min_Account - minimum account for automatic trade.

If account equity drops below this value, the expert will close out all positions and stop automatic trade. The value must be set in your account currency.

Example: When Protection_Min_Account = 700, the Expert will close all positions if the equity drops below 700 USD (EUR if you account is in EUR).

  • Protection_Max_StopLoss - maximum Stop Loss for each position.

The expert checks the open positions at every tick and if found no SL or SL lower (higher for short) than selected, it sets SL to the defined value. The value is in points.

Example: Protection_Max_StopLoss = 200 means 200 pips for 4 digit broker and 20 pips for 5 digit broker. extern int Protection_Max_StopLoss = 0;

  • Expert_Magic - a unique number which identifies the positions set from this expert.

You have to change this number if you want to trade several strategies on one and the same currency pair.

  • Separate_SL_TP - this is a boolean variable that has values of true or false.

It has to be set to true for STP brokers that cannot set SL and TP together with the position (with OrderSend()). When Separate_SL_TP = true, the expert first opens the position and after that sets a StopLoss and a TakeProfit to it by sending additional OrderModify command to the broker.

You can easily decide when to use this option if you check MT4 Order dialog window. If Stop Loss and Take Profit fields are gray, it means that the broker cannot instantly set SL and TP. In such a case, you have to set Separate_SL_TP = true. If the boxes are available for change, it means that the broker sets SL and TP together with the new order command. You have to leave Separate_SL_TP to its default false value.

If you miss to set that option, FST will set it for you after first deal.

New Order box

  • Write_Log_File - when this option is true, the expert will write a log file for every FST request.

The log files are located in MT4Folder\experts\files

Log Files Location

If you use Win 7 or Vista, you have to press “Compatibility files” menu item in order to see the files. You can find log files here:

C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\METATRADER\experts\files

Where USERNAME is your username and METATRADER is the name of your terminal. Usually AppData folder is hidden, but when you navigate to C:\Users\USERNAME, you can write AppData in the navigation bar and continue. For example my log files are here:

C:\Users\Miroslav Popov\AppData\Local\VirtualStore\Program Files (x86)\FXCM MetaTrader 4\experts\files