[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 416

 
vegetate писал(а) >>

Can you tell me how to pass one dimension from a two-dimensional array to a function?

I'm confused about something.

int testarray[5][2] = {1,2,3,4,5,6,7,8,9,10};// хоть так и можно записать, но в уме нужно держать что это ТАБЛИЦА

void testfunc(int &inarray[][]){ // массив нужно передавать "как есть", но обрабатывать можно выбранную часть
string out_str="Result: "+inarray[i,0];

for (int i=1;i<5;i++){// еще нужно учитывать, что счет в массивах начинается с НУЛЯ. "первый - нулевой"
out_str += (", "+inarray[i,0]); // здесь бы использовал строковую функцию конкатенации
}
Print(out_str);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
Print("Call first:");
testfunc(testarray);
Print("Call second:");
testfunc(testarray);
//----
return(0);
}
//+-----------

 

I have two copies of the same broker's platform. Each has its own demo account and a shared folder called experts.

If I open the first one, then close it, then open the second one, I need to enter the password again in the second one.

I close the second and open the first one - now I need password for the first one. Is it supposed to be like this?

Thank you!

 
Necron писал(а) >>

high=iHigh(NULL,60,1); Or is something wrong?

Everything is correct. But if you want to use multiple timeframes or symbols, you need to make corresponding logic in your EA.

 
Vinin >>:

Все правильно конечно. Но если нужно использовать несколько таймфреймов или инструментов, то нужно делать соотвествующую логику в советнике.

OK, I'll look into it. Thank you!

 

It's me again... Don't scold me too much... I have about two weeks of experience with EAs...

I have created my Expert Advisor based on fractals but it keeps showing OrderModify error 1 in my log during the test, although my moose is moving correctly based on fractals. I used Kim's FindNearFractal function. The code is as follows:

   for( cnt=0; cnt< total; cnt++)
     {
      OrderSelect( cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
           // check for trailing stop
            if( TrailFractal)
              {
               OrderModify(OrderTicket(),OrderOpenPrice(), FindNearFractal(NULL,0,MODE_LOWER),0,0,Green);
                     return(0);
                            }
           }
         else // go to short position
           {
            // check for trailing stop
            if( TrailFractal)
              {              
                     OrderModify(OrderTicket(),OrderOpenPrice(), FindNearFractal(NULL,0,MODE_UPPER),0,0,Red);
                     return(0);
               
              }
           }
        }
And on additions another question. The code is as follows:
     for(int i = 0; i < OrdersTotal(); i++)
   {
      // выбор ордера
      if(OrderSelect( i, SELECT_BY_POS) == false) continue;
      // not current symbol
      if(OrderSymbol() != Symbol()) continue;
  }
if(OrderType() == OP_SELL)
{
//при профите >20 pips добавится или докупится ...
 if(OrderProfit()>20)//////если поставить другое условие открывает много позиций
 OrderSend(Symbol(),OP_SELL, Lots,Bid,3, sl_sell,0,"Ma+Fr",16384,0,Red);
  PeriodForSleep=((Time[0]-Time[1])-(TimeCurrent()-Time[0]))*1000; 
Sleep( PeriodForSleep);
}
if(OrderType() == OP_BUY)
{
//при профите >20 pips добавится или докупится ...
 if(OrderProfit()>20)//////если поставить другое условие открывает много позиций
 OrderSend(Symbol(),OP_BUY, Lots,Ask,3, sl_buy,0,"Ma+Fr",16384,0,Lime);
   Sleep( PeriodForSleep);
}
If I set a fractal breakthrough (or any other signal) instead of OrderProfit()>20 in the add condition, it opens many positions. I tried to add Sleep()-it does not help. What is the problem here?
 

OrderModify error 1 usually happens when the new parameters exactly match those in the order...

 
keekkenen >>:

обычно OrderModify error 1 бывает, когда новые параметры точно соответствуют тем, что в ордере..

Thank you, keekkenen! The parameters are different. The answer is found here. The advice (in the thread) is to nail this error...NormalizeDouble doesn't help either.

And what can you say about the second error (on additions)?

 
how do EAs know how much paper profit, i.e. profit on unclosed positions, is there at the moment?
 
dmmikl86 писал(а) >>
how do you find out how much paper profit, i.e. profit on unclosed positions, is currently in the EA?

KimIV has the GetProfitOpenPosInPoint() function.

 
khorosh >>:

У KimIV есть функция GetProfitOpenPosInPoint().

can I do it this way, and will it work?

extern double Level_Profit = 200;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   double paper_money = AccountEquity()-AccountBalance();
   if ( paper_money > Level_Profit)
      {
       #include "scripts\s_close_all.mq4"
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

or would it be better to insert the script code into the EA?