[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 167

 
I'm also running Vista...when copying and text in the editor it crashes with an error...has anyone encountered this problem?
 
Please advise how to create and append information to the end of the file.
 
zfs писал(а) >>
Please advise how to create and append information to the end of the file.

See the 'Problem with the CSV' code example

 
A rollover advisor. I want to make it so that when one order is opened, the previous order is closed. How do I get the Ticket of the previous order?
 
And if you can limit the number of open orders =)
 
MetalWorker писал(а) >>

Code for my first EA, works on RCAI and Dem. The problem is that it won't move orders i.e. stops... it always swears for wrong stops... I even found other codes to move stops ... still the same error.

Thanks in advance.

1.You have the wrong loop, (removing else with both brackets), so only SELL works.

2. On Sell, you should count from Asc.

3) Maybe 10 pips is not enough for trailing?

 
here's a question... how to make an advisor to make no more than 2 trades in different directions,... that is, if a trade opened on a sell signal... and the order hasn't closed yet... and a buy signal appears at that moment, the trade is opened for buy, .... ! Help!
 
Infinity >> :
such a question,... how to make an advisor to make no more than 2 trades in different directions,... that is, if a trade was opened by a sell signal,... and the order has not yet closed,... and a buy signal appears at that moment, the trade is opened for buy, .... ! Help!

Function

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru/                  |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.02.2008                                                     |
//|  Описание : Возвращает количество позиций.                                 |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
int NumberOfPositions(string sy="", int op=-1, int mn=-1) {
  int i, k=OrdersTotal(), kp=0;

  if ( sy=="0") sy=Symbol();
  for ( i=0; i< k; i++)                                    {
    if (OrderSelect( i, SELECT_BY_POS, MODE_TRADES))      {
      if (OrderSymbol()== sy || sy=="")                   {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if ( op<0 || OrderType()== op)                   {
            if ( mn<0 || OrderMagicNumber()== mn) kp++;
          }}}}}  return( kp);}
With its help you can easily make up the opening conditions you want.



 
RocketTrend >> :
And also if you can limit the number of open orders =)

See post above (for example):

if ( NumberOfOrders(NULL,OP_BUY,Magic)<5) {  //если число открытых позиций
//бай  меньше пяти
 

Another question for the programming wizards ! How do I calculate support and resistance of the previous day in my EA? That is, at the beginning of a new day, the Expert Advisor should calculate the levels of the previous day, and draw them only in the range of a new day. When a new day appears, it should delete the old levels and draw the new ones ...!

Obviously, we need to define the border of the previous day, and in this diapason to find iHighest and iLowest on the current timeframe, write values in 2 arrays, ... then check for the new day in its diapason and draw ObjectCreate("name",OBJ_HLINE,0, 00:00, iHighest[i], 23:59, iHighest[i]);

what's the right way to do it?

Reason: