Please help with some coding skill !

 

Hi dear everbody !

How to coding as bellow requirement ?

1.Everytime when the sigal comes ..... make EA just opening only one order .

2.After open an order,how to open another one when the signal comes again but not to close the first one .

any coding model or sample will be highly aprreciated .

void Openbuy()
{
                          
          double lowest=Low[iLowest(symbol1,PERIOD_M15,MODE_LOW,5,1)];     
          int have=0;
          for(int i=0;i<OrdersTotal();i++)
           {
            if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==false) break;   
            if(OrderSymbol()==symbol1&&OrderType()==OP_BUY)
            have++;
           }  

           if(have=0&&MarketInfo(symbol1,MODE_ASK)<=lowest)      
          {
           RefreshRates();              
              ticket1 =OrderSend(symbol1,OP_BUY,LotSize,MarketInfo(symbol1,MODE_ASK),Slippage,MarketInfo(symbol1,MODE_ASK)-SL,MarketInfo(symbol1,MODE_ASK)+TP,0,0,Magicnumber1,Blue);
           if (ticket1 <0 )
             {
               Print ("OrderSend failed with error #", GetLastError());
               return(0);
             }
           }

  }
 

Please search the forum (using the search facility and/or Google).

This sort of basic logic question gets asked (too) regularly.


CB

Reason: