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

 
Alexey Viktorov #:

Andrei, pay attention to these words in the documentation

it's also written in the mql5 documentation. Consequently, the .dll should be in the Libraries folder. Isn't it?

I moved and specified #import "TestLib.dll", the error is the same. The dll file itself is found without it.

 
Vladimir Simakov #:

Let's start at the beginning. What are you creating the library for? It should be under .Net, which is listed in the docs, by the way, and it works exactly under it. You can try it under .Core and UWP, I'm too lazy to try it myself, tell me later.


Yes, under .Net

 
Andrey Sokolov #:

Yes, under .Net.

Is the method static?

 

happy new year everyone!

Thanks to everyone who helped me this year with advice and code)

Now i'm looking for a function to set the time interval in the robot's work.

The problem is this:

robot with a martin trades a Buy/Sell trade (close take/stop)

if the lot size exceeds the one specified in the Expert Advisor's parameters, then the opening of the next trade should be postponed for n hours/days.

what functions are used to solve this problem?

where to start?

maybe someone has a ready-made example?

 
законопослушный гражданин #:

Now I'm looking for a function to set the time interval in the robot's work.

Happy New Year to you too. What have you done yourself that is not working?

 
Vladimir Simakov #:

Is the method static?

Yes. Here I made it as simple as possible, plugged it into the application, it works there.

 
Andrey Sokolov #:

Happy New Year to you too. What have you done yourself that is not working?

I have a tipster assembled and working.

The question is whether to stop or suspend it. I just started digging in this direction.

My understanding is as follows:

int OnInit()
  {
Start          = TimeCurrent();
MaxMartinLot   = Lot*MathPow(1.4,OrdersClose);
MaxMartinLot2  = Lot*MathPow(K_Martin2,OrdersClose2);

the Expert Advisor starts at any given time.

further:

void OnTick()
  {
// Получим значение индикатора
   dMA = iMA(Symbol(), 0,PeriodMA, MovingShift, MODE_SMA, PRICE_CLOSE, 0); // MODE_SMA - простое усреднение , значение 0. PRICE_CLOSE- цена закрытия, значение 0.

// Если нет открытых ордеров, то входим в условие
      if(CountOrders()==0)
     {
// Если появился сигнал на покупку, то откроем ордер на покупку
      if(bSignalBuy() == true)
         vOrderOpenBuy();

// Если появился сигнал на продажу, то откроем ордер на продажу
      if(bSignalSell() == true)
         vOrderOpenSell();
     }

it turns out, as soon asCountOrders()==0&& (OrderLots()>=Lotcontrol)- "the set lot has been reached".

I need to stop /stop sending the signalbSignalBuy/bSignalSellfor N-hours/days

it turns out that I need to compareTimeCurrent() with some parameter, like TimeControl (name does not matter)

and if TimeCurrent()>=TimeControl- then bSignalBuy/bSignalSell signal goes again.

I already asked about (Sleep) I was told that it's not recommended to stop the process.

The question is not that I can't do it, but am I thinking correctly and what function should I use to describe TimeControl?

 
законопослушный гражданин #:

I have a tipster assembled and working.


   input int HourPause  = 1;        // Пауза в часах
   datetime  Start      = 0;
//----------------------------------------------------
   // выключаем торговлю
   if (OrderLots()>=Lotcontrol)
     {
      Start=TimeCurrent()+(HourPause*60*60));
     }
// Если нет открытых ордеров, то входим в условие
      if(CountOrders()==0&&Start<=TimeCurrent())
 

Tretyakov Rostyslav #:

Thank you.

I started thinking like this:

If (TimeCurrent() >=(OrderCloseTime() + (Pause*60*60)))

is this wrong?

 
законопослушный гражданин #:

Thank you.

I started thinking like this:

If (TimeCurrent() >=(OrderCloseTime() + (Pause*60*60)))

is this wrong?

You can do that, too.
Reason: