Download MetaTrader 5

why expert closes trade at price 0.00000 ?

To add comments, please log in or register
Brian Kester
823
Brian Kester  

My expert closes some orders NOT from TP and SL like it should, but for no apparent reason at price 0.00000, and in the journal it shows "close order#(order details here)....at price 0.00000"

All the normal closes from TP and SL show up under the Experts tab instead of the journal tab.

what would make the expert perceive a 0.00000 price and close order and log it in the journal tab?

 

thanks. first post! :D

qjol
3243
qjol  
no one can answer that without seeing the related code
Simon Gniadkowski
Moderator
18025
Simon Gniadkowski  
c3po:

My expert closes some orders NOT from TP and SL like it should, but for no apparent reason at price 0.00000, and in the journal it shows "close order#(order details here)....at price 0.00000"

All the normal closes from TP and SL show up under the Experts tab instead of the journal tab.

what would make the expert perceive a 0.00000 price and close order and log it in the journal tab?

Was the order closed or deleted ?  was it a Market order or Pending order ?
Brian Kester
823
Brian Kester  

It was "closed" (at price 0.0000 is the unusual part)

it was a market order about half way between the SL and the TP. closes two or three orders at teh same time. it happens for about half the trades that the expert opens for no apparent reason. thanks, i thought this might be a known issue to folks already.  

Simon Gniadkowski
Moderator
18025
Simon Gniadkowski  
c3po:

It was "closed" (at price 0.0000 is the unusual part)

it was a market order about half way between the SL and the TP. closes two or three orders at teh same time. it happens for about half the trades that the expert opens for no apparent reason. thanks, i thought this might be a known issue to folks already.  

Can you provide a screen shot showing the order that was closed at 0.0000
Brian Kester
823
Brian Kester  

Heres 2 screenshots (pasted into one jpeg) one of the history and one of the Journal.

these odd closes show up in the Journal tab, unlike normal closes which show up in the Experts tab.

 

Im wonderign is this internet-connection related, ?

oh and im using range-bars. could it be that the range bar chart didnt update fast enough?

 

thanks i appreciate you taking the time to look.

Brian Kester
823
Brian Kester  

hmm teh file didnt upload. ill have to do this after work later. :)

wth76
7
wth76  

hey man.. i know it's a topic few yrs ago. But recently i met exactly the same problem for my ea testing in practicing account. and i googled, seems no one else having this problem besides u. 

So may i know if you have solved it? and it is caused by code, or the connection, or the other problem?

Alain Verleyen
Moderator
33334
Alain Verleyen  
wth76:

hey man.. i know it's a topic few yrs ago. But recently i met exactly the same problem for my ea testing in practicing account. and i googled, seems no one else having this problem besides u. 

So may i know if you have solved it? and it is caused by code, or the connection, or the other problem?

Forum on trading, automated trading systems and testing trading strategies

why expert closes trade at price 0.00000 ?

Simon Gniadkowski, 2012.11.05 18:33

Can you provide a screen shot showing the order that was closed at 0.0000

Lorentzos Roussos
12622
Lorentzos Roussos  

One of our users received a zero close recently .
The broker is Pepperstone .



If there is no info on this , i presume its an error in the code unless stated otherwise . 

Thanks 

This is the relevant part of the code that handles Closes

      //If Order Is Short
        if(OrderType()==OP_SELL)
        {
        //get active price
          active_price=MarketInfo(OrderSymbol(),MODE_ASK);
          rsl=OrderStopLoss();
          rtp=OrderTakeProfit();  
          rsy=OrderSymbol();        
          //Check TP1 State 
          if(TL_TP1_Io[tl]==0)
          {
          closer=false;
          closer_attempts=0;
          //check for breach below tp1
            if(active_price<=TL_TP1[tl])
            {
            //attempt to close
              while(closer_attempts<10&&closer==false)
              {
              closer_attempts++;
              closer=OrderClose(TL_Ticket[tl],TL_LS1[tl],active_price,100,clrRed);
              Sleep(200);
              }
            //attempt to close ends here 
            //succesful close
              if(closer==true)
              {
              TL_TP1_Io[tl]=1;
              TL_Ticket[tl]=FindRogue(OP_SELL,rsl,rtp,rsy);
              }
            //succesful close ends here 
            }
          }
          //Check TP1 State Ends Here 
          //Check TP2 State 
          if(TL_TP2_Io[tl]==0)
          {
          closer=false;
          closer_attempts=0;
          //check for breach below tp2
            if(active_price<=TL_TP2[tl])
            {
            //attempt to close
              while(closer_attempts<10&&closer==false)
              {
              closer_attempts++;
              closer=OrderClose(TL_Ticket[tl],TL_LS2[tl],active_price,100,clrRed);
              Sleep(200);
              }
            //attempt to close ends here 
            //succesful close
              if(closer==true)
              {
              TL_TP2_Io[tl]=1;
              TL_Ticket[tl]=FindRogue(OP_SELL,rsl,rtp,rsy);
              }
            //succesful close ends here 
            }
          }
          //Check TP2 State Ends Here   
          //If Trailing is active
          if(PATT_Trailing==pv_yes)
          {
          //check trail 1 (BE)
            if(TL_TP1_Trail_Io[tl]==0)
            {
            
              if(active_price<=TL_TP1[tl])
              {
              //try to set SL to B.E.
              moder=false;
              moder_attempts=0;
              while(moder==false&&moder_attempts<10)
                {
                moder_attempts++;
                moder=OrderModify(TL_Ticket[tl],0,OrderOpenPrice(),OrderTakeProfit(),0,clrRed);
                Sleep(200);
                }
              //if it succeeds
                if(moder==true)
                {
                TL_TP1_Trail_Io[tl]=1;
                }
              //if it succeeds ends here 
              //try to set SL to B.E. Ends Here 
              }
            }
          //check trail 1 (BE) Ends here 
          //check trail 2 
            if(TL_TP2_Trail_Io[tl]==0)
            {
            
              if(active_price<=TL_TP2[tl])
              {
              //try to set SL to B.E.
              moder=false;
              moder_attempts=0;
              while(moder==false&&moder_attempts<10)
                {
                moder_attempts++;
                moder=OrderModify(TL_Ticket[tl],0,TL_TP1[tl],OrderTakeProfit(),0,clrRed);
                Sleep(200);
                }
              //if it succeeds
                if(moder==true)
                {
                TL_TP2_Trail_Io[tl]=1;
                }
              //if it succeeds ends here 
              //try to set SL to B.E. Ends Here 
              }
            }          
          //check trail 2 ends here 
          }
          //If Trailing is active ends her e                         
        }
      //If Order Is Short Ends Here      
Alain Verleyen
Moderator
33334
Alain Verleyen  
Lorentzos Roussos:

One of our users received a zero close recently .
The broker is Pepperstone .



If there is no info on this , i presume its an error in the code unless stated otherwise . 

Thanks 

This is the relevant part of the code that handles Closes

What is the close price in trades history ?
12
To add comments, please log in or register