How To Make An Advisor

Table of contents:

How To Make An Advisor
How To Make An Advisor

Video: How To Make An Advisor

Video: How To Make An Advisor
Video: Rhody How To Make an Advisor Appointment on eCampus YouTube 2024, May
Anonim

When playing on the stock exchange, it is very important to keep track of all trading operations in time, and to facilitate the work, many Forex players create a trading robot advisor. It is not difficult to create an Expert Advisor, and if everything is done correctly, the Expert Advisor will simplify the process of making trade operations for opening and closing buy and sell positions for you. However, your profit depends only on you, not on the advisor, and in this case, he can only provide additional help.

How to make an advisor
How to make an advisor

Instructions

Step 1

First, form a strategy for creating an Expert Advisor - for example, based on the Moving Average line. Place a buy position with some Take Profit and Stop Loss values if the instrument price rises above the Moving Average line.

Step 2

Set the StopLoss and TakeProfit functions to 250 points. The robot should not open new positions while there is some kind of open trade position. Based on this strategy, start creating an advisor.

Step 3

Open MetaEditor and start the Expert Advisor Wizard. Select the "Advisor" option in the wizard's menu, click "Next" and write down the main parameters that the advisor should be endowed with. If you are creating a trading robot for the first time, leave the window with the parameters blank and click "Finish".

Step 4

Now you need to write code in MQL, which is the main element of creating a robot. In the code editor, program the prepared strategy. Skip the int init () and int deinit () blocks.

Step 5

Go straight to specifying the advisor's algorithm in the int star () block. Using the OrderSelect () trading function, the EA should check if you have any existing open positions in the terminal. If the advisor finds open positions in the terminal, it will wait until the deals are closed.

Step 6

Accordingly, you need to enter the following code:

if (OrderSelect (0, SELECT_BY_POS, MODE_TRADES) == False)

{ }

In curly braces, write the conditions for buying and selling.

Step 7

Since you have assigned the Moving Average line as a signal to execute a trade, enter in the code the block of the function that influences the opening of a trade for a downtrend. This function should mirror the previous function that affects the opening of a trend if the values of the current price exceed the Moving Average line. Compile a trading robot and test it on several types of currencies.

Step 8

Now you just need to enter the parameters of the robot settings. After the line #property link https:// … enter the following parameters:

extern double LotTrend = 0, 1; / * number of lots to open a position * /

extern int TP = 250; / * number of points to close TakeProfit * /

extern int SL = 250; / * number of points to close StopLoss * /

Step 9

Change the code with parameters so that the Expert Advisor can work directly from the trading terminal. Test the Expert Advisor using the "Strategy Tester" terminal function.

Recommended: