Problem with EA on Digits+1 broker.

 

Hello,


May be the subject will lead to some confuse, Sorry, but I can't find any other way to say it.

Digits+1 broker is those who use 5 digits decimal for GBPUSD, EURUSD, etc (the common broker usually use 4 digits for GBPUSD).


My code is :

//---- input parameters
extern double    Lots              = 0.1;
extern int       StopLoss          = 30;
extern int       TakeProfit        = 70;
 
int magic=123456;
 
 
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
    int ticket;
    double SL,TP;
 
    int dig=MarketInfo("GBPUSD",MODE_DIGITS);
    int x;
    if(dig==4) x=1;
    if(dig==5) x=10;
       
    int ordertotal=0;
    for(int i=OrdersTotal()-1;i>=0;i--)
     {
       OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
       if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
        {
          ordertotal++;         
        }
     } 
     
    if(ordertotal<1 )
     {
       if(long.condition)
        {
          SL=Ask-StopLoss*x*Point;
          TP=Ask+TakeProfit*x*Point;
          ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,TP,0,magic,0,Blue);
          if(ticket<=0) else Alert("Error on opening new order ",GetLastError());
        }
       if(short.condition)
        {
          SL=Bid+StopLoss*x*Point;
          TP=Bid-TakeProfit*x*Point;
          ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,SL,TP,0,magic,0,Red);
          if(ticket<=0) else Alert("Error on opening new order ",GetLastError());
        }       
     }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

I test it in 5 minutes EURUSD and I get numerous Error 130. The strange thing is it's working flawlessly on the backtester but not on the forward demo test. What should I do?

The broker is forexte.com


Thank you

 
Nobody can help? Stringo? Rosh maybe?
 

Hello,



I had the same problem before, 0.1 Lots is for normal digits (4 in EUR/USD)

To trade 0.1 Lots with 5 digits (EUR/USD), you must use 1.0 Lots instead.



And for Sl and TP, it is the same thing, you must do :

(what you want) x 10

for example, if you want a StopLoss of 10 in normal digits :

10 x 10 = 100



Have a nice day.

 
devilian1899:
Nobody can help? Stringo? Rosh maybe?

Change source such:

    if(ordertotal<1 )
     {
       if(long.condition)
        {
          SL=Ask-StopLoss*x*Point;
          TP=Ask+TakeProfit*x*Point;
          ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,TP,0,magic,0,Blue);
          if(ticket<=0) 
                {
                Alert("Error on opening new BUY order, error=",GetLastError());
                Print("Point="+DoubleToString(Point,5),"  StopLevel=",MarketInfo(Symbol(),MODE_STOPLEVEL));
                }
        }
       if(short.condition)
        {
          SL=Bid+StopLoss*x*Point;
          TP=Bid-TakeProfit*x*Point;
          ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,SL,TP,0,magic,0,Red);
          if(ticket<=0) 
                {
                Alert("Error on opening new SELL order, error=",GetLastError());
                Print("Point="+DoubleToString(Point,5),"  StopLevel=",MarketInfo(Symbol(),MODE_STOPLEVEL));
                }
 
        }       
     }
 
nazoreen:

Hello,



I had the same problem before, 0.1 Lots is for normal digits (4 in EUR/USD)

To trade 0.1 Lots with 5 digits (EUR/USD), you must use 1.0 Lots instead.



And for Sl and TP, it is the same thing, you must do :

(what you want) x 10

for example, if you want a StopLoss of 10 in normal digits :

10 x 10 = 100



Have a nice day.

Hello Nazoreen,


Thanks for your reply, but as far I concern thats what the

    int dig=MarketInfo("GBPUSD",MODE_DIGITS);
    int x;
    if(dig==4) x=1;
    if(dig==5) x=10;
use for.
 

@ Rosh, sorry I wrote the wrong code,

it's not

if(ticket<=0) else Alert("Error on opening new order ",GetLastError());
but
if(ticket<=0) Alert("Error on opening new order ",GetLastError());

the real code is

if(ticket>0) blablabla;
else Alert("Error on opening new order ",GetLastError());

I'm forgot to delete the "else" word.

 

Hi Rosh,


The problem is still occur.


It was written on the journal :

2008.04.16 02:41:23 EA EURUSD,M1: Alert: Error on opening new order130
2008.04.16 02:41:23 EA EURUSD,M1: Point=0.00001 StopLevel=10


SL=30

TP=70


Any other idea maybe?

 

Try chopping off 5th digit from Ask/Bid when calculating SL/TP:


SL=NormalizeDouble(Bid,Digits-1)+StopLoss*x*Point;

 
devilian1899:

Any other idea maybe?


What execution use your broker - market or instant? In matter market execution you can not open order with non-zero StopLoss and TakeProfit. First time you have open order and then in second time you may to modify opened order.

Reason: