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

 
gyfto:
Can AccountNumber() be read from the dll and how? At least give me a hint where to dig. I mean without passing the function value to the dll, i.e. from the dynamic library itself.
From MT4 window header, but it can easily be substituted. I have to think how to trace the substitution.
 
pako:

I don't understand why it has to be so complicated.
Wouldn't that make it easier?

Eh... If only I could decide how to do it myself... If my client needs to recalculate take points of all positions (moreover, the next averaging positions may be opened with even larger lot and the total take is recalculated again) and close exactly by stop-orders, rather than by Expert Advisor, then that's what we should do.
 
Zhunko:
From the MT4 window header, but it can easily be tampered with. We need to think about how to trace the spoofing.

But one thing I'm pretty sure of: there's nowhere in Windows to see the last time the window buffer was accessed.
 
gyfto:
But one thing I'm pretty sure of: there's nowhere in Windows to see the last time the window buffer was accessed.
We have to intercept the messages.
 

I need help, I can't figure it out.

The idea is that the owl will use the trend fill, if the signal repeats. So the question is, how do I teach the fraction function to skip the first signal?

For example, there was a buy signal, the owl buys and at the next tick the function of scaling in is called (because there is an open order), the entry signal is still in force and the function successfully fills (which is wrong).

The function itself is called only if there is an open order.

I just need to skip the current bar. How to implement it in MQL?

 
MarkTrade:

I need help, I can't figure it out.

The idea is that the owl will use the trend fill, if the signal repeats. So the question is, how do I teach the fraction function to skip the first signal?

For example, there was a buy signal, the owl buys and at the next tick the function of scaling in is called (because there is an open order), the entry signal is still in force and the function successfully fills (which is wrong).

The function itself is called only if there is an open order.

I just need to skip the current bar. How to implement it in MQL?

What the hell are you smoking? What plantations do you pick cigarettes from? Owl went to the shop and bought some... And then some funk came along and fucked it all up.

Bummer...

 

Use the function which will return you the number of bars after the last position was opened:

//+----------------------------------------------------------------------------+
int BarsAfterOpenLastPos(int op, int mn) {
   datetime t=0;
   int      i, k=OrdersTotal();

   for (i=0; i<k; i++) {
      if (OrderSelect(i, SELECT_BY_POS)) {
         if (OrderSymbol()!=Symbol())  continue;
         if (OrderType()!=op)          continue;
         if (OrderMagicNumber()!=mn)   continue;
         if (t<OrderOpenTime()) t=OrderOpenTime();
         }
      }
   return((TimeCurrent()-t)/60/Period());
}
//+----------------------------------------------------------------------------+

How to check a Buy position with Magic

if (BarsAfterOpenLastPos(OP_BUY, Magic)>1) {// доливаем}
 
artmedia70:

Shit... what are you smoking? Where do you get your cigarettes from? Owl went to the shop and bought some... And then some funk came along and ruined everything.

Oh, that's too bad...



:) Anyway, that's the way it is

if (OrdersCount()==0)
{CheckBuy();
CheckSell();}
if (OrdersCount()==1) DolivkaBuy();
if (OrdersCount()==-1) DolivkaSell();

What should I write in Dolivka...() to make it skip the bar, on which the first trade was opened?

I don't have the source code, I am just remembering...

 
О! There's already an answer as I write. Thank you!
 
artmedia70:
Eh... If only I could decide how to do it myself... If the client needs to recalculate the take of all positions (especially since the next averaging positions may be opened with even larger lot and the total take is recalculated again) and close exactly by stop-orders, and not by Expert Advisor, then that's what I have to do.


Array the position data
Reason: