[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 314

 
hoz:

I got the fucking error myself. In fact, there is no logic at all. To open a pending order according tohttps://book.mql4.com/ru/appendix/limits, the opening price should be either below Bid (for selling) or above Ask (for buying). I am doing as required.

From time to time I get 0 and 130 errors. Although 130 is an error of wrong stop, which can happen during modification, but not during order opening.

On the screenshot the situation and the print displayed by the pr function.

Please advise how to get rid of this bug. I am really sick and tired of this error. Logically, it is not on the subject at all.

Victor, apart from above-below compliance, you need to use preventive clearance, because while the order is being sent, the price is not standing still, so you get a step or a step into the restricted area! Insert as in modification and a bigger slippage, and you'll be fine! Working on Real with no mistakes! Good luck!
 
borilunad:
Victor, apart from above-below, you need to use a preventive gap, because while the order is being sent, the price is not standing still, so you get a step or a step into the forbidden zone! Insert as in modification and a bigger slippage, and you'll be fine! Working on Real with no mistakes! Good luck!


Boris, so the slippage is already worth 3, this, as I understand 3 points. How much more do you need?

You mean like this:

bool OpenBuy()
{
   int ticket = -1;
   double OOP = High[1] + i_thresholdToUp * pt;
   pr ("ND(OOP) = " + ND(OOP) + " ; Ask = " + Ask);
   pr ("g_stopLevel = " + g_stopLevel);

   if ((ND(OOP) - g_stopLevel)> Ask)
       ticket = OrderSend(Symbol(), OP_BUYSTOP, 0.1, ND(OOP), 3, 0, 0, NULL, i_magic, 0, CLR_NONE);
   else pr ("Ордер послать не удалось " + GetLastError());
   
   if (ticket > 0)
   {
 //      lastBarTime = Time[0];               // На текущем баре все необходимые действия..
                                            // .. успешно выполнены
       return (true);
   }
}

I'm wondering how to implement it in a better way, so as not to put extra functions in here.

 

hoz, at I was wondering how to shorten the if even further.See: if we put a variable

bool _if=((2*trend-1)*Δ≥const);//аналогично _if=(±Δ≥const)

we have cnt=cnt+step, where

if(_if) step=1;
}else{ step=-cnt;
}

But 1=cnt/cnt, a -cnt=cnt/(-1), the only difference is the denominator. Now recall that x^0=1, x^1=x, i.e. we can put our Boolean variable _if in the exponent, i.e.step=cnt/a*(cnt^_if); where

if(_if) a=1;
}else{ a=-1;
}

But ±a is supposedly 2*_if-1, i.e.

bool _if=((2*trend-1)*Δ≥const);//аналогично _if=(±Δ≥const)
int step=cnt/(2*_if-1)*(cnt^_if);//принимает два значения: 1 и -cnt
cnt=cnt+step;

Or we simplify

bool _if=((2*trend-1)*Δ≥const); cnt=cnt+cnt/((2*_if-1)*(cnt^_if));
 
hoz:


Boris, so slippage is already 3, that's what I understand by 3 points. How much more do you need?

You mean like this:

I'm wondering how to implement this more intelligently so as not to put extra functions in here.

I hope slippage is 3 for 4 digits if you need 30 for 5!
 

Guys, please advise a script that gives a message that the market is open and that the market is closed.

I.e. when monday comes 0.00.01 it gives a message that the market opens, then the message that "the market is open," similarly, that the market has closed.

I've written a script but it doesn't work (( Help me figure it out.

// определяем начало и конец торгов.
      // начало торгов в понедельник в 0.00.01
      
      if(DayOfWeek()==1 && Hour()== 0 && Minute()== 0 && Seconds()==01)
      {
         Alert("Рынок открылся.");
      }
      // конец торгов в Пятницу в 23.59.59
      if(DayOfWeek()==5 && Hour()== 23 && Minute()== 59 && Seconds()==59)
      {
         Alert("Пятница, Рынок закрылся.");
      }

 

Is there any robot capable of placing pending orders BAY STOP and SELL STOP At a certain point in time , with a minimum step of triggering from the price at that time. In short, under the news. I do not have time with my hands.
 
hoz:

I got the fucking error myself. In fact, there is no logic at all. To open a pending order according tohttps://book.mql4.com/ru/appendix/limits, the opening price should be either below Bid (for selling) or above Ask (for buying). I am doing as required.

From time to time I get 0 and 130 errors. Although 130 is an error of wrong stop, which can happen during modification, but not during order opening.

On the screenshot the situation and the print displayed by the pr function.

Please advise how to get rid of this bug. I am really sick and tired of this error. Logically, it is not on the subject at all.

The 130th error is not necessarily a stop order. It is also a distance from placing pending orders at least int MarketInfo(Symbol(), MODE_STOPLEVEL)
 
borilunad:
I hope slippage 3 for 4 digits, if you need 30 for 5!

So there's no slippage at all in the tester, for that matter... Corrected to 30.

artmedia70:
130th error is not necessarily stop orders. It is also a distance of pending orders at least equal to int MarketInfo(Symbol(), MODE_STOPLEVEL)

Here it is:

//+-------------------------------------------------------------------------------------+
//| Открытие длинной позиции                                                            |
//+-------------------------------------------------------------------------------------+
bool OpenBuy()
{
   int ticket = -1;
   double OOP = High[1] + i_thresholdToUp * pt;
   pr ("ND(OOP) = " + ND(OOP) + " ; Ask = " + Ask);
   pr ("g_stopLevel = " + g_stopLevel);

   if (ND(OOP)> (Ask + g_stopLevel))
       ticket = OrderSend(Symbol(), OP_BUYSTOP, 0.1, ND(OOP), 30, 0, 0, NULL, i_magic, 0, CLR_NONE);
   else pr ("Ордер послать не удалось " + GetLastError());
   
   if (ticket > 0)
   {
 //      lastBarTime = Time[0];               // На текущем баре все необходимые действия..
                                            // .. успешно выполнены
       return (true);
   }
}

Where:

g_stopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL) * pt;

It's written in the same way as yours Artem. It was the same yesterday by logic. But the errors are piling up. There is no sense in adding extra points to make it work in the tester, where there are no requotes or slippages at all.

What should I do in a more universal way to avoid getting into the same mistakes? I've seen so many Expert Advisors that have never added 2-3 extra points except for slippage. After all, in this case there will be a 6-pp deviation from the required price. And this is not right. The Expert Advisors are written for both ticks and minutes. And it seems that there may be accuracy in trading. So, I want it to be accurate, not to have huge indents...

 

Friends!

A global question has arisen

Is it possible to get the tick stream in the terminal on weekends, so that I could write and debug EAs quietly?

I've already got a few tips on how to use it in my trading robot.

i can't use one tick triggering the EA, i need a flow of ticks in a certain range

is there such a thing in nature?

mt4 servers that emulate streaming quotes on weekends ?

 
pasha5282:

Guys, please advise a script that gives a message that the market is open and that the market is closed.

i.e., when Monday 0.00.01 gives the message that the market opens, then the message that "the market is open", similarly, that the market has closed.

wrote a script but for some reason it does not work (( help me figure it out.


If it is a script and it is located in the scpirts folder, then it has worked once and has been removed from the chart. In order to keep it permanently, write your code inside this


int start()
{
   while(!IsStopped())
   {
      // вот сюда

      Sleep(500);
   }
}