Download MetaTrader 5

Experts: AutoTStop EA

To add comments, please log in or register
Automated-Trading
Admin
106507
Automated-Trading  

AutoTStop EA:

AutoTStop EA does not work to open the orders, but only helps trader to use Trailing Stop.

Author: 3rjfx

Larrydeelf
199
Larrydeelf  

Hi 3rjfx

Could you tell me how would i set my inputs perameters if i was going for a 100 pips TP an when i have 20 pips profit i would want the EA to trail up to my entry

an when i have 40 pips proft i would want the EA to sercure me 20 pips profit an when i have 60 pips profit i would want the EA to sercure me 40 pips profit . 

Roberto Jacobs
48605
Roberto Jacobs  
082419lf:

Hi 3rjfx

Could you tell me how would i set my inputs perameters if i was going for a 100 pips TP an when i have 20 pips profit i would want the EA to trail up to my entry

an when i have 40 pips proft i would want the EA to sercure me 20 pips profit an when i have 60 pips profit i would want the EA to sercure me 40 pips profit . 

082419lf

The idea of the Trailing Stop is not as you expect.
Because in forex, no one can guarantee that if the price moves up, it will continue to rise, or if the price goes down, it will continue to go down.
Trailing Stop will only secure the profit that you earn, when the price moves reversed.
I suggest you to use AutoTStop EA along with a built-in indicator of the MT4 "ZigZag" indicators, and trading on H4 or H1 timeframe, then I am sure you will easily make a profit.

Regards.

prozor7
8
prozor7  
Automated-Trading:

AutoTStop EA:

Author: 3rjfx

hi,

like yours EA, please explain following User input: 

 AutoTrailingStop = True; // Default Trailing Stop value = 6.0 - where I can adjuced this?

 AutomaticSystemTP = "Set AutomaticTakeProfit=True or False"; - which user input is this?

OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA - how does EA calculate this?

I'm using following setup and EA close buy orders mostly on 3.20(40) when price reach 3.60:

no problems with sell order 

//--- User Input
input string             AutoTStop = "Copyright © 2014 3RJ ~ created by Roy Philips-Jacobs";
extern bool            FridayTrade = True; // If True, EA still trading at Friday
extern bool        UseTrailingStop = True; // Use Trailing Stop, True (Yes) or False (Not)
extern bool       AutoTrailingStop = True; // Default Trailing Stop value = 6.0
extern double         TrailingStop = 24.0; // If Auto Trailing Stop False, input Trailing Stop Value
extern double     TrailingStopStep = 1.0; // Input Trailing Stop Step Value (default 1.0)
input string     AutomaticSystemTP = "Set AutomaticTakeProfit=True or False";
extern bool OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA
extern bool    NoMinimumTakeProfit = True; // True or False -> If Set True, 100% TP by EA not use minimum TP.
input string       MinimumSystemTP = "If Set NoMinimumTakeProfit=False"; // TP by EA on minimum TP values
extern double            MinimumTP = 10; // Minimum TP by EA on the AutomaticTakeProfit=True function, default value 10
input string        ManualSystemTP = "If Set AutomaticTakeProfit=False"; // TP by Terminal MT4 (same as manual trading)
extern double           TakeProfit = 20; // TP by System, values can adjust by user
input string     AutomaticSystemSL = "Set AutomaticStopLoss=True or False";
extern bool      AutomaticStopLoss = True; // SL will calculation by EA
input string        ManualSystemSL = "If Set AutomaticStopLoss=False"; // SL values can adjusted by user
extern double             StopLoss = 96; // SL adjusted by user

Roberto Jacobs
48605
Roberto Jacobs  
prozor7:

hi,

like yours EA, please explain following User input: 

 AutoTrailingStop = True; // Default Trailing Stop value = 6.0 - where I can adjuced this?

 AutomaticSystemTP = "Set AutomaticTakeProfit=True or False"; - which user input is this?

OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA - how does EA calculate this?

I'm using following setup and EA close buy orders mostly on 3.20(40) when price reach 3.60:

no problems with sell order 

//--- User Input
input string             AutoTStop = "Copyright © 2014 3RJ ~ created by Roy Philips-Jacobs";
extern bool            FridayTrade = True; // If True, EA still trading at Friday
extern bool        UseTrailingStop = True; // Use Trailing Stop, True (Yes) or False (Not)
extern bool       AutoTrailingStop = True; // Default Trailing Stop value = 6.0
extern double         TrailingStop = 24.0; // If Auto Trailing Stop False, input Trailing Stop Value
extern double     TrailingStopStep = 1.0; // Input Trailing Stop Step Value (default 1.0)
input string     AutomaticSystemTP = "Set AutomaticTakeProfit=True or False";
extern bool OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA
extern bool    NoMinimumTakeProfit = True; // True or False -> If Set True, 100% TP by EA not use minimum TP.
input string       MinimumSystemTP = "If Set NoMinimumTakeProfit=False"; // TP by EA on minimum TP values
extern double            MinimumTP = 10; // Minimum TP by EA on the AutomaticTakeProfit=True function, default value 10
input string        ManualSystemTP = "If Set AutomaticTakeProfit=False"; // TP by Terminal MT4 (same as manual trading)
extern double           TakeProfit = 20; // TP by System, values can adjust by user
input string     AutomaticSystemSL = "Set AutomaticStopLoss=True or False";
extern bool      AutomaticStopLoss = True; // SL will calculation by EA
input string        ManualSystemSL = "If Set AutomaticStopLoss=False"; // SL values can adjusted by user
extern double             StopLoss = 96; // SL adjusted by user


Right-click your Chart Trading Terminal and in Expert Advisors > Properties you can see customization options (User input)

AutoTrailingStop = True; // Default Trailing Stop value = 6.0 - where I can adjuced this? ~>  extern double   TrailingStop = 24.0; // If Auto Trailing Stop False, input Trailing Stop Value

AutomaticSystemTP = "Set AutomaticTakeProfit=True or False"; - which user input is this? ~> extern bool OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA

OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA - how does EA calculate this? ~>  See Function: void CalcSTP()  //-- function: for calculation Automatic Take Profit.

I'm using following setup and EA close buy orders mostly on 3.20(40) when price reach 3.60: no problems with sell order

~ Value automatic take profit depending on your Internet speed and the speed of movement of the price change.

prozor7
8
prozor7  
3rjfx:


Right-click your Chart Trading Terminal and in Expert Advisors > Properties you can see customization options (User input)

AutoTrailingStop = True; // Default Trailing Stop value = 6.0 - where I can adjuced this? ~>  extern double   TrailingStop = 24.0; // If Auto Trailing Stop False, input Trailing Stop Value

AutomaticSystemTP = "Set AutomaticTakeProfit=True or False"; - which user input is this? ~> extern bool OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA

OptimizationTakeProfit = True; // TP will calculation by EA and Automatic TP by EA - how does EA calculate this? ~>  See Function: void CalcSTP()  //-- function: for calculation Automatic Take Profit.

I'm using following setup and EA close buy orders mostly on 3.20(40) when price reach 3.60: no problems with sell order

~ Value automatic take profit depending on your Internet speed and the speed of movement of the price change.

 thx for explanations, I have constant error for all symbols :

2015.05.07 11:47:16.359 AutotStop EURUSD,M5: invalid stoploss for OrderModify function

2015.05.07 14:12:25.127 AutotStop EURUSD,Daily: invalid stoploss for OrderModify function

2015.05.07 14:13:09.030 AutotStop GBPUSD,Daily: invalid stoploss for OrderModify function

2015.05.07 14:30:57.739 AutotStop EURJPY,H1: invalid stoploss for OrderModify function
 

what I'm doing wrong 

on this setup:

input string             AutoTStop = "Copyright © 2014 3RJ ~ created by Roy Philips-Jacobs";
extern bool            FridayTrade = True; // If True, EA still trading at Friday
extern bool        UseTrailingStop = True; // Use Trailing Stop, True (Yes) or False (Not)
extern bool       AutoTrailingStop = False; // Default Trailing Stop value = 6.0
extern double         TrailingStop = 13.0; // If Auto Trailing Stop False, input Trailing Stop Value
extern double     TrailingStopStep = 5.0; // Input Trailing Stop Step Value (default 1.0)
input string     AutomaticSystemTP = "Set AutomaticTakeProfit=True or False";
extern bool OptimizationTakeProfit = False; // TP will calculation by EA and Automatic TP by EA
extern bool    NoMinimumTakeProfit = True; // True or False -> If Set True, 100% TP by EA not use minimum TP.
input string       MinimumSystemTP = "If Set NoMinimumTakeProfit=False"; // TP by EA on minimum TP values
extern double            MinimumTP = 10; // Minimum TP by EA on the AutomaticTakeProfit=True function, default value 10
input string        ManualSystemTP = "If Set AutomaticTakeProfit=False"; // TP by Terminal MT4 (same as manual trading)
extern double           TakeProfit = 35; // TP by System, values can adjust by user
input string     AutomaticSystemSL = "Set AutomaticStopLoss=True or False";
extern bool      AutomaticStopLoss = False; // SL will calculation by EA
input string        ManualSystemSL = "If Set AutomaticStopLoss=False"; // SL values can adjusted by user
extern double             StopLoss = 89; // SL adjusted by user 

Roberto Jacobs
48605
Roberto Jacobs  
prozor7:

 thx for explanations, I have constant error for all symbols :

2015.05.07 11:47:16.359 AutotStop EURUSD,M5: invalid stoploss for OrderModify function

2015.05.07 14:12:25.127 AutotStop EURUSD,Daily: invalid stoploss for OrderModify function

2015.05.07 14:13:09.030 AutotStop GBPUSD,Daily: invalid stoploss for OrderModify function

2015.05.07 14:30:57.739 AutotStop EURJPY,H1: invalid stoploss for OrderModify function
 

what I'm doing wrong 

on this setup:

input string             AutoTStop = "Copyright © 2014 3RJ ~ created by Roy Philips-Jacobs";
extern bool            FridayTrade = True; // If True, EA still trading at Friday
extern bool        UseTrailingStop = True; // Use Trailing Stop, True (Yes) or False (Not)
extern bool       AutoTrailingStop = False; // Default Trailing Stop value = 6.0
extern double         TrailingStop = 13.0; // If Auto Trailing Stop False, input Trailing Stop Value
extern double     TrailingStopStep = 5.0; // Input Trailing Stop Step Value (default 1.0)
input string     AutomaticSystemTP = "Set AutomaticTakeProfit=True or False";
extern bool OptimizationTakeProfit = False; // TP will calculation by EA and Automatic TP by EA
extern bool    NoMinimumTakeProfit = True; // True or False -> If Set True, 100% TP by EA not use minimum TP.
input string       MinimumSystemTP = "If Set NoMinimumTakeProfit=False"; // TP by EA on minimum TP values
extern double            MinimumTP = 10; // Minimum TP by EA on the AutomaticTakeProfit=True function, default value 10
input string        ManualSystemTP = "If Set AutomaticTakeProfit=False"; // TP by Terminal MT4 (same as manual trading)
extern double           TakeProfit = 35; // TP by System, values can adjust by user
input string     AutomaticSystemSL = "Set AutomaticStopLoss=True or False";
extern bool      AutomaticStopLoss = False; // SL will calculation by EA
input string        ManualSystemSL = "If Set AutomaticStopLoss=False"; // SL values can adjusted by user
extern double             StopLoss = 89; // SL adjusted by user 

I do not know what happened to your code.
I have never experienced such error for this EA code, this EA I use every day and no error.

Try to see update_3.


prozor7
8
prozor7  
3rjfx:
I do not know what happened to your code.
I have never experienced such error for this EA code, this EA I use every day and no error.

Try to see update_3.


 

I'm using update_3 and discover what cause an error. I'm using buy and sell script with an SL and TP and yours EA can't handle this.

 also found that manual ( AutoTrailingStop = False;) doesn't work as predicted. for example in EUR/USD.

 AutoTrailingStop = False;)

 TrailingStop = 13.0;

TrailingStopStep = 1.0;

 AutomaticStopLoss  = False;

EA should move TS when price move 13 pips (130 points) and jump every 1 pip (10 points)

here is what EA is doing  when price move 6 pips jumps every 1 pip

Roberto Jacobs
48605
Roberto Jacobs  
prozor7:

 

I'm using update_3 and discover what cause an error. I'm using buy and sell script with an SL and TP and yours EA can't handle this.

 also found that manual ( AutoTrailingStop = False;) doesn't work as predicted. for example in EUR/USD.

 AutoTrailingStop = False;)

 TrailingStop = 13.0;

TrailingStopStep = 1.0;

 AutomaticStopLoss  = False;

EA should move TS when price move 13 pips (130 points) and jump every 1 pip (10 points)

here is what EA is doing  when price move 6 pips jumps every 1 pip


The workings of the Trailing Stop is like that, it will move and changed the Stop Loss to secure profits.

Try changing scripts void CalcSTP() with this code:

void CalcSTP() //-- function: for calculation Automatic Take Profit.
   { 
//----
      RefreshRates();
      double spread=Ask-Bid;
      int tfr[]={30,240}; // timeframes arrays tp
      double bstp[]={20,35,50}; //arrays tp value
      //-
      fClB=false;
      fClS=false;
      int zh1,zl1;
      //--
      for(int iz=bar-1; iz>=0; iz--) //- for(iz tfh)
        {
          //--     
          if(iHigh(symbol,tfh,iz)==iCustom(symbol,tfh,"ZigZag",1,iz))
            {zh1=iz;}
          if(iLow(symbol,tfh,iz)==iCustom(symbol,tfh,"ZigZag",2,iz))
            {zl1=iz;}
          //--
        } //-end for(iz tfh)
      //-
      if(zl1==0) {bool stB=true;}
      if(zh1==0) {bool stS=true;}
      //-
      if(opttp && nomintp)
        {   
          //--
          if(_Period<tfr[0])
            {tp=NormalizeDouble((bstp[0]*pp),digit);}
          else if((_Period>=tfr[0])&&(_Period<tfr[1]))
            {tp=NormalizeDouble((bstp[1]*pp),digit);}
          else if((_Period>=tfr[1]))
           {tp=NormalizeDouble((bstp[2]*pp),digit);}
          //-
          dvab=tp*0.5;
          //--
          if(stB==true) {fClS=true;}
          if(stS==true) {fClB=true;}
          //--
        }
      //--
      if(opttp && !nomintp)
        {      
          //--
          if(_Period<tfr[0])
            {tp=NormalizeDouble((bstp[0]*pp),digit);}
          else if((_Period>=tfr[0])&&(_Period<tfr[1]))
            {tp=NormalizeDouble((bstp[1]*pp),digit);}
          else if((_Period>=tfr[1]))
           {tp=NormalizeDouble((bstp[2]*pp),digit);}
          //-
          tpABS=NormalizeDouble((MinimumTP*pp),digit);
          //--
        }
      else {tp=NormalizeDouble(TakeProfit*pp,digit);}
      //--
      if(autsl) {sl=NormalizeDouble((pp*99)+spread,digit);}
      else {sl=StopLoss*pp;}
      //--
      RefreshRates();
      pBo=High[0]-Close[0];
      pSo=Close[0]-Low[0];
      //--
      pdifB=pp*difB;
      pdifS=pp*difS;
      mdHC=(pBo>pdifB);
      mdLC=(pSo>pdifS);
      mdUp=(Close[0]<(lastBid-pdifB));
      mdDn=(Close[0]>(lastAsk+pdifS));
      //--
      return;
//----
   } //-end CalcSTP()
//---------//

mahabubislam
15
mahabubislam  
please can you give me the link of zigzag that u mentioned in this comment
Roberto Jacobs
48605
Roberto Jacobs  
mahabubislam:
please can you give me the link of zigzag that u mentioned in this comment
ZigZag it is not a link, ZigZag is a built-in custom technical indicators created by MetaQuotes® for MetaTrader®.
You can see the ZigZag indicator at the end of the list of indicators.
Scripts ZigZag above is intended to get the value of the ZigZag indicator without the need to put ZigZag indicator on the chart trading terminal.
12
To add comments, please log in or register