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

 
Valeriy Yastremskiy:

It's a habit from BASIC. It's easier with it) You can do it without it.) And if the condition is inserted in several places, the entry is shorter.

Thank you
 
ANDREY:

Below is my original code without your additions

Below is the code with your latest improvements



Maybe, if(TimeSeconds(TimeCurrent())==0) should be applied only to those sections where no orders are opened, and where the next low is searched for?

If I am not mistaken, your function has started to execute my code only at the beginning of each minute candle.


Thanks for the help.

Well, you have come to the problem yourself...

ANDREY:

I would have been happy if my timer was flailing. But as it turns out, the timer doesn't work in the MT4 tester.

What's the difference?

  • The code is executed in OnTick() every minute.
  • The code is executed in OnTimer() every minute.
Hint: In OnTimer() time is not linked to bar time.
 
Alexey Viktorov:

Well, you've come to the trouble yourself...

What's the difference?

  • The code is executed in OnTick() every minute
  • The code is executed in OnTimer() every minute.
Hint: In OnTimer() the time is not related to the bar time.

Thanks for the valuable information.

What is the time in OnTimer() linked to ?
 
ANDREY:

Thanks for the valuable information

What is time bound to in OnTimer()?

Never mind...

The code is executed in OnTick() every minute, after you write if(Minute()!= x), but checks the Minute() value on every tick.

OnTimer() is bound to the initialization time of EventSetTimer()



 
MakarFX:

Never mind...

The code is executed in OnTick() every minute, after you write if(Minute()!= x), but it checks Minute() value on every tick.

OnTimer() is bound to the initialization time of EventSetTimer()



Got it. Thanks. No more questions left..... it seems to me.

 
MakarFX:

Never mind...

The code is executed in OnTick() every minute, after you write if(Minute()!= x), but it checks Minute() value on every tick.

OnTimer() is bound to the initialization time of EventSetTimer()


Makar, don't be rude. When I told you not to mess with the man's head, I suspected exactly that (among other things)... It was not matching the given distance in points because of the time delay. And you've only come to that now.
 
Alexey Viktorov:
Makar, don't be rude. When I told you not to mess with people's heads, I suspected exactly that (among other things)... It was a discrepancy with the distance you had set in pips because of the time lag. And you've only come to that now.

Alexey, I'm not being snarky, it's just that a person is just getting into MQL and your phrase "The code is executed in OnTick() every minute" is misleading.

You're a smart coder and have helped me many times, but sometimes your posts are late and misleading again.

I wouldn't even dream of being snide)

 
MakarFX:

Alexey, I'm not being snarky, it's just that a person is just getting into MQL and your phrase "The code is executed in OnTick() every minute" is misleading.

You're a smart coder and have helped me many times, but sometimes your posts are late and misleading again.

I wouldn't presume to be slanderous).

Then how do you understand this phrase

every tick .

OnTimer() is bound to the initialization time of EventSetTimer()

And my messages are delayed because I either have no companion at all or am away on business... Which is pretty much the same thing - I either did some housework or went away on housework...

Regarding my phrase "The code is executed in OnTick() every minute" you just need to combine this phrase with the quoted message and the highlighted phrase in it. And then everything will come together.

OK, peace and friendship and bubblegum.
 
Alexey Viktorov:

Then how do you understand this phrase

And my messages are delayed because I either have no companion at all or am away on business... Which is, in general, one and the same, or did household chores, or went away on household chores...

Regarding my phrase "The code is executed in OnTick() every minute" you just need to combine this phrase with the quoted message and the highlighted phrase in it. And then everything will come together.

Okay, peace and friendship and bubblegum.
 

I tried to search the forum, but I couldn't find the correct option for this task:

I need to calculate profit/loss in pips (yes, for strategy tester) for any instrument, any amount in deposit currency and any contract size.

For example: for XAGUSD, for a lot of 0.05, and for the amount of 15000 rubles (ruble deposit) to know how much it is in pips?

Maybe someone has got the hang of it and has already written this bicycle?

Reason: