O que é order_id ? - página 4

 
2012.11.01 00:13:27 2012.09.27 15:33 Testador: obter lucro #13 em 1765.27 (1765.27 / 1765.80)
2012.11.01 00:13:27 2012.09.27 15:33 Testador: obter lucro #12 em 1765.25 (1765.27 / 1765.80)
2012.11.01 00:13:27 2012.09.27 15:15 ADX XAUUSD,M15: abrir #13 comprar 0.03 XAUUSD a 1762.27 sl: 1759.27 tp: 1765.27 ok
2012.11.01 00:13:27 2012.09.27 15:15 ADX XAUUSD,M15: abrir #12 comprar 0.03 XAUUSD a 1762.25 sl: 1759.25 tp: 1765.25 ok
2012.11.01 00:13:27 2012.09.27 13:20 Testador: pare a perda #11 em 1754.73 (1754.67 / 1755.20)
2012.11.01 00:13:25 2012.09.27 08:30 ADX XAUUSD,M15: abrir #11 comprar 0.03 XAUUSD a 1757.73 sl: 1754.73 tp: 1760.73 ok
2012.11.01 00:13:25 2012.09.27 08:24 Testador: pare a perda #10 em 1757.50 (1756.97 / 1757.50)
2012.11.01 00:13:24 2012.09.27 06:15 ADX XAUUSD,M15: aberto #10 venda 0,03 XAUUSD a 1754,50 sl: 1757,50 tp: 1751,50 ok
2012.11.01 00:13:23 2012.09.27 04:15 Testador: obter lucro #8 em 1756.40 (1756.41 / 1756.94)
2012.11.01 00:13:23 2012.09.27 04:14 Testador: obter lucro #9 em 1755.93 (1755.94 / 1756.47)
2012.11.01 00:13:22 2012.09.26 23:45 ADX XAUUSD,M15: abrir #9 comprar 0.03 XAUUSD a 1752.93 sl: 1749.93 tp: 1755.93 ok
2012.11.01 00:13:21 2012.09.26 21:45 ADX XAUUSD,M15: abrir #8 comprar 0.03 XAUUSD a 1753.40 sl: 1750.40 tp: 1756.40 ok
2012.11.01 00:13:14 2012.09.26 14:37 Testador: pare a perda #6 em 1760.83 (1760.80 / 1761.33)
2012.11.01 00:13:10 2012.09.26 07:32 Testador: pare a perda #7 em 1761.54 (1761.52 / 1762.05)
2012.11.01 00:13:10 2012.09.26 05:15 ADX XAUUSD,M15: abrir #7 comprar 0,03 XAUUSD a 1764,54 sl: 1761,54 tp: 1767,54 ok
2012.11.01 00:13:10 2012.09.26 05:14 Testador: pare a perda #4 em 1764.65 (1764.14 / 1764.67)
2012.11.01 00:13:09 2012.09.26 04:45 ADX XAUUSD,M15: abrir #6 comprar 0.03 XAUUSD a 1763.83 sl: 1760.83 tp: 1766.83 ok
2012.11.01 00:13:09 2012.09.26 04:07 Testador: obter lucro #5 em 1762.74 (1762.77 / 1763.30)
2012.11.01 00:13:09 2012.09.26 03:15 ADX XAUUSD,M15: abrir #5 comprar 0.03 XAUUSD a 1759.74 sl: 1756.74 tp: 1762.74 ok
2012.11.01 00:13:08 2012.09.26 02:00 ADX XAUUSD,M15: aberto #4 venda 0.03 XAUUSD a 1761.65 sl: 1764.65 tp: 1758.65 ok
2012.11.01 00:13:06 2012.09.25 19:42 Testador: pare a perda #3 em 1761.53 (1761.51 / 1762.04)
2012.11.01 00:13:06 2012.09.25 19:30 ADX XAUUSD,M15: abrir #3 comprar 0.03 XAUUSD a 1764.53 sl: 1761.53 tp: 1767.53 ok
2012.11.01 00:12:57 2012.09.25 03:57 Testador: pare a perda #2 em 1767.82 (1767.30 / 1767.83)

Isso está aqui. Como você vê, nenhuma ordem próxima


 

Eu não vejo a saída desta linha de código . . você está executando a versão correta do seu EA ?

Print("DIPlus1: ", DoubleToStr(DIPlus1, Digits), " DIMinus1: ", DoubleToStr(DIMinus1, Digits), " Main0: ",DoubleToStr(Main0, Digits), " Rsi: ",DoubleToStr(Rsi, Digits) );
 

Sim. Eu uso o MetaEditor do meu software MT4.

Este é todo o meu código . Você tem algum conselho para mim?

int start()
{
   int i ,times;
   string DIPlus1;
   string DIPlus0;
 
   string DIMinus1;
   string DIMinus0;
   
   string Main1;
   string Main0;
   string Main2;
   
   string MACD_main;
   string MACD_signal;
   string Rsi;
   
   string err = 26;
   string x = 70;
   string xx = 30;
   
   double sl = 300;
   double tp = 300;
   
   int MagicNumber1=1234,MagicNumber2=4321;
//----
/*DIPlus1=DoubleToStr(  DIPlus1, 4);
DIPlus0=DoubleToStr(    DIPlus0, 4);
DIMinus1=DoubleToStr(   DIMinus1, 4);
DIMinus0=DoubleToStr(   DIMinus0, 4);
Main1=DoubleToStr(      Main1, 4);
Main0=DoubleToStr(      Main0, 4);
Rsi=DoubleToStr(        Rsi, 4);
//err=DoubleToStr(err,4);
//x=DoubleToStr(x,4);
//xx=DoubleToStr(xx,4);*/

//---
 
DIPlus1=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,1);
DIPlus0=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,0);
 
DIMinus1=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,1);
DIMinus0=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,0);

Main1=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,1);
Main0=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0);
Main2=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,2);

Rsi = iRSI(NULL,0,14,PRICE_CLOSE,0);

times = Minute() % 15 ==0 && Seconds() ==0;

//MACD_main = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); 
//MACD_signal = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
   
//----
if(Minute() % 15 ==0 && Seconds() ==0)
{
   {if(DIPlus1 > DIMinus1)
         
           if( Main0 > err && Main1 < err &&   Rsi < x )

    
                OrderSend(Symbol(),OP_BUY,0.03,Ask,5,Ask-sl*Point,Ask+tp*Point,"",1234,0,Blue);
    }      
   
    {if(DIPlus1 < DIMinus1)
            if (Main0 > err && Main1 < err &&    Rsi > xx)
     
                OrderSend(Symbol(),OP_SELL,0.03,Bid,5,Bid+sl*Point ,Bid-tp*Point,"",4321,0,Red);
    }
}
     
  //---
 int PositionIndex;    
 
int TotalNumberOfOrders;  

TotalNumberOfOrders = OrdersTotal();   

for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)  
   {
   if(  OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES) ) continue;   
   
               Print("DIPlus1: ", DoubleToStr(DIPlus1, Digits), " DIMinus1: ", DoubleToStr(DIMinus1, Digits), " Main0: ",DoubleToStr(Main0, Digits), " Rsi: ",DoubleToStr(Rsi, Digits) );
   
               if( OrderMagicNumber() == MagicNumber2      
               && OrderSymbol() == Symbol()          
               && OrderType() == OP_BUY         
               || OrderType() == OP_SELL )  
                  {
                  if( DIPlus1 > DIMinus1 || Main0 < err || Rsi < xx)
                     {
                        if(! OrderClose(OrderTicket(),OrderLots(),Bid,3,Green))
                           Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError() );
                     } 
                  }
               if( OrderMagicNumber() == MagicNumber1      
               && OrderSymbol() == Symbol()          
               &&  OrderType() == OP_BUY          
               || OrderType() == OP_SELL )  
                  { 
                     if( DIPlus1 < DIMinus1 || Main0 < err || Rsi > x  )
                        {
                           if(! OrderClose(OrderTicket(),OrderLots(),Ask,3,Green))  
                              Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError() );
                        } 
                      
                  }

   
    }
 return(0);
 }
   
 

Eu acho que você precisa de um ! nesta linha . .

if( ! OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES) ) continue;   //  <--  modify this line
 

Você precisa resolver esta linha, não faz sentido ... o que ela deveria estar fazendo ?

times = Minute() % 15 ==0 && Seconds() ==0;
 
RaptorUK:

Você precisa resolver esta linha, não faz sentido ... o que ela deveria estar fazendo ?

2012.11.01 19:16:00 2012.09.27 23:45 Novo USDCAD,M15: número duplo inválido como parâmetro 1 para a função DoubleToStr
Você pode me dizer qual é este erro?
 
toi10005doi:
2012.11.01 19:16:00 2012.09.27 23:45 Novo USDCAD,M15: número duplo inválido como parâmetro 1 para a função DoubleToStr
Você pode me dizer qual é este erro?
O primeiro parâmetro que você está passando para a função DoubleToStr() é inválido. . . você olhou a documentação da função DoubleToSrt()? mostra a linha de código que gera o erro.
 
RaptorUK:
O primeiro parâmetro que você está passando para a função DoubleToStr() é inválido. . . você olhou a documentação da função DoubleToSrt()? mostra a linha de código que gera o erro.

int start()
{
   int i ,times;
   string DIPlus1;
   string DIPlus0;
 
   string DIMinus1;
   string DIMinus0;
   
   string Main1;
   string Main0;
   
   string MACD_main;
   string MACD_signal;
   string Rsi;
   
   string err = 25;
   string x = 70;
   string xx = 30;
   
   double sl = 300;
   double tp = 100;
   
   int MagicNumber1=1234,MagicNumber2=4321;
//----
 
DIPlus1=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,1);
DIPlus0=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,0);
 
DIMinus1=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,1);
DIMinus0=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,0);

Main1=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,1);
Main0=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0);

Rsi = iRSI(NULL,0,14,PRICE_CLOSE,0);

//times = Minute() % 15 ==0 && Seconds() ==0;

//MACD_main = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); 
//MACD_signal = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
   
//----
if(Minute() % 15 ==0 && Seconds() ==0)
   {if(Main0 > err && Main1 < err)
      {
      if( DIPlus0 > DIMinus0  && Rsi < x )
         OrderSend(Symbol(),OP_BUY,0.03,Ask,5,Ask-sl*Point,Ask+tp*Point,"",MagicNumber1,0,Blue);
      
      if( DIPlus0 < DIMinus0  && Rsi > xx )
         OrderSend(Symbol(),OP_SELL,0.03,Bid,5,Bid+sl*Point ,Bid-tp*Point,"",MagicNumber2,0,Red);
      }     
      
   }
     
  //---
 int PositionIndex;    
 
int TotalNumberOfOrders;  

TotalNumberOfOrders = OrdersTotal();   

for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)  
   {
   if( ! OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES) ) continue;   
   
    Print("DIPlus1: ", DoubleToStr(DIPlus1, Digits), " DIMinus1: ", DoubleToStr(DIMinus1, Digits), " Main0: ",DoubleToStr(Main0, Digits), " Rsi: ",DoubleToStr(Rsi, Digits) );
  
  if(Minute() % 15 ==0 && Seconds() ==0)
       {
         if( OrderMagicNumber() == MagicNumber2      
            && OrderSymbol() == Symbol()          
            && ( OrderType() == OP_BUY           
            ||   OrderType() == OP_SELL ) )   
           {if( DIPlus0 > DIMinus0)
               {if ( ! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), 3 ) )
                   Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError() ); 
               }
            } 
         if( OrderMagicNumber() == MagicNumber1      
            && OrderSymbol() == Symbol()          
            && ( OrderType() == OP_BUY           
            ||   OrderType() == OP_SELL ) )   
          { if( DIPlus0 < DIMinus0)
               {  if ( ! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), 3 ) )               
                  Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError() ); 
               }
          } 
        }          
    }
 return(0);
 }
Este é todo o meu código. O MetaEditor nota tudo ok.
 
toi10005doi:
Este é todo o meu código. O MetaEditor percebe tudo bem.

Esta é a última ajuda que estou lhe dando. . você precisa ler o Livro e aprender o básico . .

Por que estas variáveis são cadeias de caracteres?

   string DIPlus1;
   string DIPlus0;
 
   string DIMinus1;
   string DIMinus0;
   
   string Main1;
   string Main0;
   
   string MACD_main;
   string MACD_signal;
   string Rsi;
   
   string err = 25;
   string x = 70;
   string xx = 30;
 
toi10005doi:

@Raptor:

Sim, mas eu compreendi muito bem porque eu só estou começando a escrever EA. Sr por incomodá-lo.

Não entendo por que meu pedido fecha imediatamente após ele estrelar.

Neste posto não eram cordas . . .

   double DIPlus1;
   double DIPlus0;
 
   double DIMinus1;
   double DIMinus0;
   
   double Main1;
   double Main0;
   
   double MACD_main;
   double MACD_signal;
   double Rsi;
Razão: