Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1024

 
WinZip:
Can you advise me on this problem? I am making a trading Expert Advisor, for convenience I made a copy of the Expert Advisor as a new one, and I am experimenting there. But an hour ago Expert Advisor for experiments started to return error "Trading for Expert Advisor is prohibited". I have two almost identical Expert Advisors, one is trading and another one is not. I have missed the moment when my Expert Advisor stopped trading. How do I calculate what is forbidden to trade? I tried to make function to close trades, but when I delete all that I added, it still does not trade.

In his settings, check the box to allow him to trade.

 
Logs and test results at 0 filled drive C, is there any way to change the other drive for logs in the settings?
 

I apologise for the stupid question, which has probably been discussed a million times...

How come I don't get notifications of replies or even deletions to threads... Not in the mail or in the local messages... ?

And how do I fix it? I think it's checked but it's not working...

 
//+------------------------------------------------------------------+
int OnInit()
  {
  datetime open_bars_time = iTime(NULL,0,0); 
  Alert("старт ",open_bars_time);
  int i=0;
  while(iTime(NULL,0,0)==open_bars_time && !IsStopped()) 
  {Comment(iTime(NULL,0,0));}
  Alert("Цикл закончен",open_bars_time);
//--- create timer
   EventSetTimer(Period()*60);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+

требуется запускать прогу в начале бара. Почему значение возвращаемое iTime(NULL,0,0) не изменяется?
 
Sergey Guliaev:

You need to add Sleep() and RefreshRates() to the loop, otherwise nothing moves.

And in general, the idea is fundamentally wrong. You cannot do this in OnInit.

If you have to wait for bar opening - you have to wait in OnTick. If you want to change hour - wait for it in OnTimer.

 
Maxim Kuznetsov:

You have to add Sleep() and RefreshRates() to the loop, otherwise nothing will move.

and the idea is fundamentally wrong. You can't do this in OnInit

If it is necessary to wait for bar opening - it should be done in OnTick. If you have to wait for the hour change, you have to wait on OnTimer.

Thank you. The task is to ensure that the first tick has +/- a couple of seconds at the beginning of the bar. According to my observations, the ticks are not synchronized with the start of the bar.

 
Sergey Guliaev:

Thank you. The goal is for the first tick to be +/- a couple of seconds at the start of the bar. According to my observations the ticks are not synchronised with the start of the bar.

Your observations are strange. You have confused cause and effect. Not ticks depend on bars, but the opening of a new bar depends on the arrival of a new tick. If there is no tick, there is no bar. This happens frequently on the minutes.

 

Good afternoon colleagues!

I can't understand the reason, I have the volume (LotSize) calculated based on the risk. When I take out the lot size with Alert(LotSize) message, it shows 0.12 for example, but OrderSend function complains about the size. When I write LotSixe=0.12 in the code; OrderSend works fine.

What may be the reason?

 
Sandjar Ikramov:

Good afternoon colleagues!

I can't understand the reason, I have the volume (LotSize) calculated based on the risk. When I take out the lot size with Alert(LotSize) message, it shows 0.12 for example, but OrderSend function complains about the size. When I write LotSixe=0.12 in the code; OrderSend works fine.

What may be the reason?

In such cases they always ask for code... ...who knows what's written there and how it's written...

 
Sandjar Ikramov:

Good afternoon colleagues!

I can't understand the reason, I have the volume (LotSize) calculated based on the risk. When I take out the lot size with Alert(LotSize) message, it shows 0.12 for example, but OrderSend function complains about the size. When I write LotSixe=0.12 in the code; OrderSend works fine.

What may be the reason?

Well... probably because they are different variables... And 0.12 (comma) does not equal 0.12(full stop) at all