..@@ need help in opening orders codes and in selectorder codes @@..

 

hi all


i'm just a beginner in mql4 and need help in this  EA codes


my expert opens trades according to external variables and global variables as the condition below

 

  if (can>=stepdeviation && Close[0] ==(buypoint-9*Point))

        {              
          if ( OrdersTotal()==0)
          OrderSend(Symbol(),OP_BUY,lotsize,Ask,3,0,0,"",magicn,0,Green);

        }

this code only open one trade and one trade only .........

the problem is that i want to open orders every time the condition is true but not at the same price ..... i mean if the condition is true and the order is opened

don't open any other orders at the same time only one order and  after the price moves to the next candle it's okay to open only one order too if the condition  is true again

this is my first problem

====================================================================================================================


the second problem is


how to select specific orders from many opened orders.for example 10 sell orders and 10 buy  all  already opened how to choose specific order form all these 20 orders to modify or close or what ever i want to .and all orders have the same magic number and the same currency pair and opened by the same EA .



so can any one help me in this  problem


thank you ,




 
batttot:

i'm just a beginner in mql4 and need help in this  EA codes

if ( OrdersTotal()==0)    //Check out what this means

this code only open one trade and one trade only .........

this is my first problem

====================================================================================================================


the second problem is

how to select specific orders from many opened orders.for example 10 sell orders and 10 buy  all  already opened how to choose specific order form all these 20 orders to modify or close or what ever i want to .and all orders have the same magic number and the same currency pair and opened by the same EA .


Do an OrderSelect using a loop to check all open trades and see if OrderSymbol , OrderMagicNumber and OrderType match with the trade with the specific order you want to select
 

if i use OrderSelect all the opened orders will be  selected because all have the same  OrderSymbol , OrderMagicNumber and OrderType so i want to select only one order for example select only one sell order from all opened sell orders ...............do you get the point...??


the code you mentioned

if ( OrdersTotal()==0)    //Check out what this means ==========>this only open order if there is no open orders. 

thank you ,

 
batttot:

if i use OrderSelect all the opened orders will be  selected because all have the same  OrderSymbol , OrderMagicNumber and OrderType so i want to select only one order for example select only one sell order from all opened sell orders ...............do you get the point...??

NO, Do an OrderSelect using a loop to check all open trades  one by one

Find out how a loop is working and you can take advantage of it.. 

you can't select same time all open trades....  but you can check them all 

if the loop is correct working you find the trades you want to manage

count the trades your EA has opened

when it has opened trades

and at what price.... 

try to do an attempt