Beside entering (opening) and exiting (closing) the market (positions) our expert advisor has the ability to modify existing positions based on the idea of Trailing stop point.
We will know how we implement the idea of Trialing stop later in this lesson.
Now let’s resume our code cracking.
//---- input parameters extern double TakeProfit=350.0; extern double Lots=0.1; extern double TrailingStop=35.0;
In the above lines we have asked the wizard to declare three external variables (which the user can set from the properties window of our expert advisor).
The three variables are all double data type. We have initialized them to default values (the user can change these values from the properties window, but it recommended to leave the defaults).
I have to pause again to tell you a little story about these variables.
It’s a limit point you set to your order. When reached the order will be closed, this is useful to minimize your loss when the market goes against you.
Stop loss points are always set below the current asking price on a buy or above the current bid price on a sell.
It’s a kind of stop loss order that is set at a percentage level below (for a long position) or above (for a short position) the market price. The price is adjusted as the price fluctuates.
We will talk about this very important concept later in this lesson.