[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 593

 
Dimka-novitsek:
I'm sorry, what delimiters?


a full stop and a comma. Well, the list delimiters are different, comma and semicolon.

Try importing with the correct delimiters. Or redo the regional settings with the right delimiters. Good luck

 
Thanks!!!! Yeah, there's a dot there. And how do you change the regional settings to the right delimiters ?
 
In which order should you install the Ganzilla software? Or should I post in the appropriate thread?
 
Dimka-novitsek:
Thanks!!!! Yeah, there's a dot there. And how do you change the regional settings to the correct delimiters ?
Why touch the regional settings? That's why they're regional, because they're only set up once. The settings are in EXCEL. You can also check FAC. There's one of the last posts about these separators.
 

Thanks !!!

Sorry, can you give me a link to one of the last posts about these delimiters !

Googled, Yandexed - tried to apply numeric format via Home-number-number format, nothing happened. Do not manually overwrite four hundred dots in zapatye! Powerful and clever that excel, but dumb!

Ugh, I mined it!

 
Dimka-novitsek:

Thanks !!!

Sorry, can you give me a link to one of the last posts about these dividers !

https://www.mql5.com/ru/forum/131853/page5
 
Thank you!!!
 

i have a simple question, but i still do not understand the essence of closing multiple orders)

Please explain me why the first variant of the code works the same way as the second (in the first variant via select_by_pos all 4 open trades were closed via 0th index, but in the second, 1stand 2nd 3rd and 4th)

i need some useful manual or something to see how people close orders so they don't miss them, or a manual on how to close them correctly and how select_by_pos works) because i can see some truncated examples everywhere and no examples with its use in help)

I can give you a good video tutorial on programming in MQL4.)

OPTION 1 (in this variant all 4 open orders were closed during the test, though all 4 orders were selected with index 0 when they were closed):

OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);
OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);
OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);

OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);

}

2nd OPTION (all 4 trades were closed here too, but Indexes 1,2,3 and 4):

OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);
OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);
OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);

OrderSend(Symbol(),OP_BUY,1,Bid,5,NULL,NULL);

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);
}
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
OrderClose(OrderTicket(),OrderLots(),Bid,5);

}


 

Good evening, I'm asking for help with a multicurrency MACD Expert Advisor. The EA follows the position opening criteria correctly, but closing "on condition" does not work. I have certainly started to use a trailing stop, but the correct close does not give me a break.

//+------------------------------------------------------------------+
string lSymbol;
int init ()
{ 
 lSymbol = Symbol();
 return (0);
}
int deinit()
{return(0);}
int start()
  {
   double MacdCurrent, MacdPrevious, SignalCurrent;
   double SignalPrevious, MaCurrent, MaPrevious;
   double bid, ask, point, digits;
   int cnt, ticket, total;
   
  total = SymbolOrdersTotal (lSymbol);
  
  if (total<1);
  {
    bid   = MarketInfo(lSymbol,MODE_BID);
    ask   = MarketInfo(lSymbol,MODE_ASK);
    point = MarketInfo(lSymbol,MODE_POINT);
    digits= MarketInfo(lSymbol,MODE_DIGITS);

This is what the main part looks like

 for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==lSymbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
            // should it be closed?
            if(MacdCurrent>0 && MacdCurrent<SignalCurrent && MacdPrevious>SignalPrevious &&
               MacdCurrent>(MACDCloseLevel*point))
                {
                 OrderClose(OrderTicket(),OrderLots(),bid,3,Violet); // close position
                 return(0); // exit
                }
            // check for trailing stop
            if(TrailingStop>0)  
              {                 
               if(bid-OrderOpenPrice()>point*TrailingStop)
                 {
                  if(OrderStopLoss()<bid-point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),bid-point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
         else // go to short position
           {
            // should it be closed?
            if(MacdCurrent<0 && MacdCurrent>SignalCurrent &&
               MacdPrevious<SignalPrevious && MathAbs(MacdCurrent)>(MACDCloseLevel*point))
              {
               OrderClose(OrderTicket(),OrderLots(),ask,3,Violet); // close position
               return(0); // exit
              }
            // check for trailing stop
            if(TrailingStop>0)  
              {                 
               if((OrderOpenPrice()-ask)>(point*TrailingStop))
                 {
                  if((OrderStopLoss()>(ask+point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),ask+point*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                }
              }
           }
        }
     }
   return(0);
  }
  
   
  int SymbolOrdersTotal(string lSymbol)
{
   int Res=0;
   int total=OrdersTotal();
   for (int i=0;i<total;i++) 
   {
      if (OrderSelect(i, SELECT_BY_POS))
      {
         if (OrderSymbol()==lSymbol)
         {
            Res++;
         }
      }
   }
   return(Res);
}
// the end.

And this is the closing block. Please help me to find the error!

 
Vinin:

Does the directory exist?


Yes, both in the Expert folder... and in the tester folder.

but the screenshot still doesn't work.