Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 966

 
PozitiF:

Thanks for the reply. I myself found (Googling knows almost everything) such a solution:

      int       timeframe;          // временной период графика
      double    or_op_time;         // время открытия последнего ордера
      int MaxBar = 3;               // через сколько свечей закрыть ордер
      or_op_time = Last_OrderOpTime(asset);
      
                          //  КРИТЕРИЙ ЗАКРЫТИЯ БАЙ
       
       if(!ClsB && OrderType()==OP_BUY && iBarShift( asset, timeframe, or_op_time) > MaxBar)    ClsB = true;

It seems to work clearly, but I'm not good with static variables yet.

And a related question - someone explain to a newbie the logic of the following fragment:

if(lastsignal==Signal)Signal=0; 
else                            
lastsignal=Signal;              

And while the local variable Signal is assigned values 1 or 2 by conditions, the global lastsignal is not assigned values anywhere.

And another thing - I don't understand how a variable with an as yet undefined value can be compared to anything?

   if(timeCheckSignal!=Time[0])        //МОЙ КОММЕНТ: если время открытия позиции (КОТОРОЕ ЕЩЕ НЕ ОПРЕДЕЛЕНО)...
                                       //...не равно времени открытия текущего бара, то...

Help me understand. Thank you.

ZS: But the most interesting, and for me not understandable at all, is the comment of the template developer to this fragment:

//+------------------------------------------------------------------+
// Если время торговли не истекло и мы не открывали позицию на этом баре: 
//+------------------------------------------------------------------+
 
I don't know how I can organise the bar comparison into a loop. It will be a loop within a loop.
int start()
  {

   int i,counted_bars=IndicatorCounted();
   int limit=Bars-1;
   if(limit>1) limit=Bars-N;
   if(limit==0) limit=counted_bars;
   if(IsTesting() || IsVisualMode()) limit=N+10;
   for(i=limit;i>=0;i--)
     {
     if(Close[i]>Open[i] && High[i]>High[i+1] && Low[i]>Low[i+1] && High[i+1]>High[i+2] && Low[i+1]>Low[i+2] && High[i+2]>High[i+3] && Low[i+2]>Low[i+3] && High[i+3]>High[i+4] && Low[i+3]>Low[i+4]) buybars++;
      //-------

     if(Open[i]>Close[i] && High[i]<High[i+1] && Low[i]<Low[i+1] && High[i+1]<High[i+2] && Low[i+1]<Low[i+2] && High[i+2]<High[i+3] && Low[i+2]<Low[i+3] && High[i+3]<High[i+4] && Low[i+3]<Low[i+4]) buybars--;

      //-------
      BuyBuffer[i]=buybars;
      }
   return(0);
  }
 
Please advise me, I am writing an Expert Advisor, compiling it, no errors, but it is nowhere to be found in the Navigator, there is only an mq4 file in MetaEditor. I tried it in different terminals, all the same, even though everything was fine before.
 
antonovff:
Please advise me, I am writing an Expert Advisor, compiling it, no errors, but it is nowhere to be found in the navigator, there is only an mq4 file in MetaEditor. I tried it in different terminals, but everything was OK before.
I lost my EA once too, after compilation, it turned out that I accidentally corrupted the directory when creating Eperts\MoySovetnik and it was placed in I do not remember where, in my opinion, the root folder.
 

Greetings

Does MT4 have a feature or function) Send internal terminal mail to or sms, (e.g. to receive server restart messages, etc.)?

 
PozitiF:
I also lost my EA after compilation, it turned out that I accidentally erased the directory when creating Eperts\MoySovetnik and it was placed in the root folder during compilation, I don't remember where.
I have already downloaded a new terminal and created an EA with one variable declared in its code. This EA appears only in MetaEditor navigator at the very bottom, after all directories, as a separate file like mq4 and that's all, it is nowhere else, I can't attach it to chart.
 
I have been testing my simplest non-syndicator EA for the last three months, since September of this year, and something is not good for me: can it be possible that with a fixed volume of 0.1 lot a profit for three months is 29 112 cents and not a single losing trade? What is the catch, does anyone know?
 
rapid_minus:
I have been testing my simplest non-syndicator EA for the last three months, since September of this year, and something is not good for me: can it be possible that with a fixed volume of 0.1 lot a profit for three months is 29 112 cents and not a single losing trade? What is the catch, does anyone know?
There are a lot of nuances in testing, starting with the number of bars in the history, quote archive, etc. Three months is not enough, at least a year. If you don't know much about it, there are good sources on YouTube.
 
antonovff:
I have already downloaded a new terminal, created an EA in the code of which one variable is declared, compilation does not give errors. This EA appears only in MetaEditor at the very bottom, after all directories, as a separate file like mq4 and that's all, it is not shown anywhere else and I cannot attach it to the chart.

This is why it appears at the bottom because you are erasing the directory name. Do not erase the word Experts\ when writing a new name.


 

Hello. There's a problem I've never encountered before. I have written a piece of a multi-currency Expert Advisor program. No errors detected on compilation, but when I try to test it I get a response:

2015.11.24 14:37:20.503 TestGenerator: no history data 'EURUSD1' from 2015.11.02 to 2015.11.03

The meaning is clear that there is no historical data, but in the board the currency is written as "EURUSD". Where did EURUSD1 come from and how to find the error.

Who knows the solution to this problem, please advise.