Download MetaTrader 5

Expert Advisor: I need help. - page 2

To add comments, please log in or register
Keith Watford
Moderator
10544
Keith Watford  
2015.07.30 15:49:21.171 2015.06.30 08:27  Neuer Versuch Long only EURUSD,M15: Open - Supertrend #-2147483645.87991
2015.07.30 15:49:21.171 2015.06.30 08:27  Neuer Versuch Long only EURUSD,M15: Openprice #1.12009
2015.07.30 15:49:21.171 2015.06.30 08:27  Neuer Versuch Long only EURUSD,M15: Supertrend #2147483647

 Your iCustom call to the indicator is returning EMPTY_VALUE, I don't see how this can be used when calculating a stop loss

Is this using the same parameters for the  iCustom call  as in your EA?

Do you think that -2147483645.87991 can be used as a stop loss?   

JD4
1100
JD4  
GumRai:

 Your iCustom call to the indicator is returning EMPTY_VALUE, I don't see how this can be used when calculating a stop loss

Is this using the same parameters for the  iCustom call  as in your EA?

Do you think that -2147483645.87991 can be used as a stop loss?   

If that is their intended stop loss value, I think we have the world record for the largest stop loss ever.
Trololo Tromberino
73
Trololo Tromberino  

Ok...in a second thought you may be right ...

But why is it working as an initial Stoploss? (You can see that in the picture)

And yeah...it is the same parameter as in my ea. Does this matter? Because i thought the value would be the same so i could use it as a stoploss too.


Worldrecord for largest stoploss...can i get that award please :D


Thanks for helping me out man!

Best regards

Keith Watford
Moderator
10544
Keith Watford  
TTromberino:

But why is it working as an initial Stoploss? (You can see that in the picture)

You are using the indicator value as SL initially
Trololo Tromberino
73
Trololo Tromberino  
GumRai:
You are using the indicator value as SL initially
Exactly. Then why it´s not working as a `trailingstoploss?
whroeder1
16529
whroeder1  
TTromberino: Worldrecord for largest stoploss...can i get that award please :D
Yes, that's a blown account and the loss of all your money.
Keith Watford
Moderator
10544
Keith Watford  
TTromberino:

But why is it working as an initial Stoploss? (You can see that in the picture)

GumRai:
You are using the indicator value as SL initially
TTromberino:
Exactly. Then why it´s not working as a `trailingstoploss?

You are not using the indicator value as a trailing SL

You are using Open minus the indicator value 

Trololo Tromberino
73
Trololo Tromberino  

Actually i changed that.

But now the ea sends 10000 Orders and the trailingstop doesn´t work either.

He has to send 1 Order per signal and just get with the trailingstop.


Here he places the Order...per 1 Signal:

if(rsio() == true && BBo() == true && sto() == true && OrdersTotal()== 0)  //Wenn Alle Indikatoren true sind und die offenen Positionen in diesem Markt 0 sind, eröffne eine long - Position.
      {
         
         
         if (Bid > sl) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,sl,0, "My Order",16384,0,Green);  //Order soll erstellt werden. 
         if(ticket == 0)
             {
                   Print("OrderSend failed with error #",GetLastError());
                
              }
          else
          Print("OrderSend placed successfully #" + string(ticket));






And this is, where the trailing stop should work:

if (Time[0] != OldBar) {
         
   if( OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()==0 ) //Trailingstop, der auf Basis des SuperTrend Indikators nachgezogen werden soll. (Nur für Long)
   {
      if( OrderType()==OP_BUY ) 
      {
        bool ordermodify = OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0);
        if (ordermodify == false)
        {Alert ("Stoploss NICHT nachgezogen! ERROR!");}
        else
        {Alert ("StopLoss nachgezogen");}
      }           
   }  
OldBar = Time[0];
} 

I don´t know, where i failed.....i searched the whole code.


thanks for helping me out.


Best regards.

Keith Watford
Moderator
10544
Keith Watford  
if (Time[0] != OldBar) {
         
   if( OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()==0 ) //Trailingstop, der auf Basis des SuperTrend Indikators nachgezogen werden soll. (Nur für Long)
   {
      if( OrderType()==OP_BUY ) 
      {
        bool ordermodify = OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0);
        if (ordermodify == false)
        {Alert ("Stoploss NICHT nachgezogen! ERROR!");}
        else
        {Alert ("StopLoss nachgezogen");}
      }           
   }  
OldBar = Time[0];
} 

I don't see any calculations for sl.

Why don't you print the error? 

if (Time[0] != OldBar) {
//
//
//
OldBar = Time[0];
} 

 A common error by some new coders is to check for a new bar more than once

The 2nd time, Oldbar has already been given the value of Time[0] so the 2nd block is not executed 

12
To add comments, please log in or register