Experts: Basic Trailing Stop

 

Basic Trailing Stop:

An EA template to add a simple trailing stop to your strategy.

Basic Trailing Stop Inputs

Author: Inovance

 

thank you so much for this smart Tool.

I worked with standard Trailing Stop in MT4, would you please tell me

what means "start" at 20 and what does it ? and as well "Step" and "stop" .

 
bah12ram:

thank you so much for this smart Tool.

I worked with standard Trailing Stop in MT4, would you please tell me

what means "start" at 20 and what does it ? and as well "Step" and "stop" .


The Start, Step and Stop in the table is valid when you optimize your EA. 
For example, let say that you want to try a different range of Take profit values 200-1000 

than,
Start = 200

Step (the "jumps" of the values = 10 (Check each 10 points 200..210..220... )

Stop = 1000

If you do wish to Optimize please read
https://www.mql5.com/en/articles/1385 

Testing and Optimization of Expert Advisors
Testing and Optimization of Expert Advisors
  • 2013.11.27
  • Michael
  • www.mql5.com
The article provides a detailed description of the process of testing and optimizing Expert Advisors in the MetaTrader 4 Strategy Tester. The importance of such information and the need for this publication cannot be underestimated. A lot of users who only get started with the MetaTrader 4 trading platform have a very vague idea of what and how needs to be done when working with Expert Advisors. The proposed article gives simple and clear answers to all of these questions and provides a slightly more professional approach to handling these issues using a specific example.
 

Please change your code a little bit;


if(isPositionOpen())

should be:


if(isPositionOpen(i))


and change the function to this:


bool isPositionOpen(int i)
  {
       return (OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==magicNumber && OrderSymbol()==Symbol());
  }


That makes way more sense instead of the double for-lus

Reason: