Download MetaTrader 5
To add comments, please log in or register
Your broker does not support mobile MetaTrader 5? Ask him to buy them!
chukwudi joshua
232
chukwudi joshua 2015.04.11 13:15 

please handy code to open order buy 10 pips or 10 ticks above the current open order,please help me see what i have done so far

but it seems as its not working as i want.

if( ma1 > Bid + (10*Point)&& CurrentTime != Time[1])
  {
      Opn_B=true;
     }

CurrentTime= Time[1];
Aleksei Beliakov
22650
Aleksei Beliakov 2015.04.11 17:15  
futureseer:

please handy code to open order buy 10 pips or 10 ticks above the current open order,please help me see what i have done so far

but it seems as its not working as i want.

if( ma1 > Bid + (10*Point)&& CurrentTime != Time[1])
  {
      Opn_B=true;
     }

CurrentTime= Time[1];
buy 10 pips or 10 ticks can you explain that
chukwudi joshua
232
chukwudi joshua 2015.04.11 17:36  
goverkms:
buy 10 pips or 10 ticks can you explain that



Goverkms for example my ea opened buy  order, I want the ea to open next order 10pips steps above my buy price. Or bid price.

Aleksei Beliakov
22650
Aleksei Beliakov 2015.04.11 17:37  
it's clear but what about ticks
chukwudi joshua
232
chukwudi joshua 2015.04.11 17:38  
goverkms:
it's clear but what about ticks



No ignore that all I mean is pips steps above my buy price line.thanks for your attention
Aleksei Beliakov
22650
Aleksei Beliakov 2015.04.11 17:47  
if( ma1 > Ask + (10*Point)&& CurrentTime != Time[1])
  {
      Opn_B=true;
     }
chukwudi joshua
232
chukwudi joshua 2015.04.11 17:52  
goverkms:
if( ma1 > Ask + (10*Point)&& CurrentTime != Time[1])
  {
      Opn_B=true;
     }


Thanks goverkms I will try it now finally please goverkms how can close all my buy orders when pips reach 40pip above buy order. See what I have done so far to help me correct it if am wrong

its working but my problem is it only closes 2pip only above buy but when you set the value 40pips it will ignore the orders opened.

chukwudi joshua
232
chukwudi joshua 2015.04.11 17:57  
 
  if ( profit * Lot + MarketInfo( Symb, MODE_TICKVALUE ) >=2)
   {
    for(Ticket= OrdersTotal()-1; Ticket>=0; Ticket--)
       {       
       if(OrderSelect(Ticket,SELECT_BY_POS, MODE_TRADES)==true)
       if(OrderSymbol()!=Symbol())    // if symbol of order didn't match 
       
       continue;                        // or the magic numb of order    
     int type   = OrderType();
               
    Bool   result = false;
              
       switch(type)
          { 
          //Close opened long positions
          case OP_BUY  : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,Pink);
                         break;
          
 
          //Close pending orders
            case OP_BUYLIMIT  :
            case OP_BUYSTOP   :
            case OP_SELLLIMIT :
            case OP_SELLSTOP  : result = OrderDelete( OrderTicket() );                
          }
          
       if(result == false)
          {
            Sleep(3000);
          }  
       }
   Return(0);
   }     
Aleksei Beliakov
22650
Aleksei Beliakov 2015.04.11 18:19  
i dont see any OP_buy case
chukwudi joshua
232
chukwudi joshua 2015.04.11 18:40  
goverkms:
i dont see any OP_buy case

Sorry actually this is two eas with separate magic numbers that handle orders separately but same system I actually removed it against interfering or close each others positins on same symbol



But goverkms you can go ahead with the correction I will understand and make the changes accordingly,its just I don't want to bore you with heaps of codes, Because your only wanted to helping and I have knowledge of mql4 code to an extent .or you can add the case OP_BUY any how I will understand. Thanks in advance for your assistance

Aleksei Beliakov
22650
Aleksei Beliakov 2015.04.11 19:00  
i cant get it why you show me wrong code? i'll try to help, just show code which need to correct
/ /123
To add comments, please log in or register