Expert Advisor: I need help.

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
Moderator
3404
GumRai 2015.07.30 21:12 #
 

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?   

avatar
313
JD4 2015.07.31 03:22 #
 
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.
avatar
22
TTromberino 2015.07.31 09:54 #
 

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

avatar
Moderator
3404
GumRai 2015.07.31 13:02 #
 
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
avatar
22
TTromberino 2015.07.31 13:50 #
 
GumRai:
You are using the indicator value as SL initially
Exactly. Then why it´s not working as a `trailingstoploss?
avatar
12983
WHRoeder 2015.07.31 13:51 #
 
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.
avatar
Moderator
3404
GumRai 2015.07.31 22:22 #
 
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 

avatar
22
TTromberino 2015.08.03 12:59 #
 

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.

avatar
Moderator
3404
GumRai 2015.08.03 15:07 #
 
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 

Back to topics list   | 1 2  

To add comments, please log in or register