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

 

I will duplicate my question in this thread - no luck in the other thread :(

Please advise me:

1. How does the EA work if there was a connection interruption?

2. It will start again the init() function?

3. How can i use "old tick" event in EA log?

 

1. Depends on the EA, if the logic provides for its stopping, it will stop working, otherwise it will be chugging for a while... check it yourself on Monday, start the EA and pull the power cord and you will see...

2. no, the init will not work, everything will start from the start, so plan for a connection interruption - save the time of the last start of the EA, and if there was a time lag between the two starts, make a call to the init

3. write a function that reads the last lines from the log for this event

 
SergNF >>:


Вы заполняете массив, а потом на него натравливаете "стандартный индикатор" (RSIOnArray, CCIOnArray и т.п. - около 7 штук).

Крайнее упоминание на форуме , а вообще F1, учебник и т.п.


//+------------------------------------------------------------------+
//|                                                    onArrayBB.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 SeaGreen
#property indicator_color2 SeaGreen
#property indicator_color3 SeaGreen
#property indicator_color4 SeaGreen

extern int maper = 14;
extern int bbper = 14;

double Buf_0[],Buf_1[],Buf_2[],Buf_3[];
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexBuffer(0,Buf_0);
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buf_1);
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(2,Buf_2);
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(3,Buf_3);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   int i,Counted_bars;
   Counted_bars=IndicatorCounted();
   i=Bars-Counted_bars-1;
   while(i>=0)
   {
      Buf_3[i]=iMA(Symbol(),0,maper,0,MODE_SMA,PRICE_CLOSE,i);
      Buf_0[i]=iBandsOnArray(Buf_3[i],0,bbper,2,0,0,i);
      Buf_1[i]=iBandsOnArray(Buf_3[i],0,bbper,2,0,1,i);
      Buf_2[i]=iBandsOnArray(Buf_3[i],0,bbper,2,0,2,i);
      Print(Buf_0[0]);
      i--;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+


Right?, So only the middle line is drawn, but the top and bottom lines are not drawn.

 
keekkenen >>:


3. напишите функцию, которая бы читала из лога последние строки на предмет этого события


OK

more about the 3rd point please, the first two I have no questions about

thanks

 
trader_fx >>:

Правильно?, Так только средняя отрисовывается, а верхняя и нижняя линии не отрисовываются.

Put the filling of buffer Buf_3 into a separate loop.
 
IgorM >>:


OK

про 3-й пункт плз подробнее, первые два у меня вопросов не возникает

спс

I haven't done it, but the solution shouldn't be too complicated, as you can't get the logs in your own language, you have to get the file and read it using WinAPI,

maybe there's a simpler solution...

 
keekkenen >>:

..решение не должно быть сложным, т.к. родным языком логи не достать..


it's strange that mql capabilities don't allow to read terminal logs

There seems to be no problem with connectivity, there is a function on which we will have to build a checking block.

bool IsConnected(

)

 

Good afternoon. I'm trying to understand how to write an EA in mql4. For starters, I've taken the suggested example from the tutorial: Simple Expert Advisor. Here is the link to it: https://c.mql4.com/book/mq4/experts/tradingexpert.mq4

When I tried to test it on RTS futures (Broco platform) through Strategy Tester, I got an interesting result - positive trades are considered as "negative" - what is the reason?

I did not change anything in the code, I just set SP and TP in OrderSend to be "0" to make a pure reversal without taking profit at stop and take.


 
I'm not a futures expert, but I have a question: have you taken the spread into account?
 

I don't know much about forex. In fact, stocks and futures have no spread in the quote deck, but I don't know how it works in MetaTrader (I just looked in the symbol properties in MT, spread = 0). Didn't change anything in the algorithm, except SP = TP = 0, how is the spread accounted for?

Reason: