Questions from Beginners MQL5 MT5 MetaTrader 5 - page 647

 
pako:
Global won't help?
Thought - creepy, somehow evenGlobalVariablesFlush doesn't always help during an emergency shutdown.
 
Vitaly Muzichenko:
I thought - it's not always easy, evenGlobalVariablesFlush helps in case of an emergency shutdown.

You still have to check every tick

because the spread also widens before the news

Or on a timer.

but you can miss the beginning of the widening by timer.

 
pako:
You have to check every tick anyway

Why can't the spread be recorded every XX:10 minutes, for example? At the beginning of the hour, the spread should not widen, or is there a catch?

 
Vitaly Muzichenko:

Why can't the spread be recorded every XX:10 minutes, for example? At the beginning of the hour, the spread should not widen, or is there a catch?

News that comes out of the blue

you can write an indicator of spread and use the indicator in your Expert Advisor

i.e., the calculation will be performed by the indicator and the Expert Advisor will ask whether you can or cannot trade

 
pako:
News that comes out of the blue

OK, then how do I implement on each tick, how do I know if the current spread is normal?

P.S. Here again I have a problem with the implementation: after the weekend the market opens with a big spread, how do I find out if the spread is big? Take Friday's data, but it may also be high if the recording was done before market close. Is it necessary to produce a whole code with different checks, or am I going in the wrong direction?

 
Vitaly Muzichenko:
Ok, then how do I implement on each tick, how do I then know that the current spread is normal?

Compare the past tick with the current tick

If it is more than 4, trade is prohibited.

was 2 became 8 coefficient 4

or when starting for the first time, calculate the average spread for 1000 ticks, write it into the global

when starting, poll global, write it in the variable as a pattern and check spreads against the pattern

 
Vitaly Muzichenko:

OK, then how do I implement on each tick, how do I know if the current spread is normal?

P.S. Here again I have a problem with the implementation: after the weekend the market opens with a big spread, how do I find out if the spread is big? Take Friday's data, but it may also be high if the recording was done before market close. Is it necessary to produce a whole code with different checks, or am I going in the wrong direction?

How can you do without checks? 30-40% of the code checks

preferably do as "nix" forbids everything that's not allowed

 
pako:

Well, how can you do without checks? 30-40% code checks

Preferably do as "nix" forbids everything that's not allowed.

Reconciliation should probably be done withTimeGMT to take time zones into account? Write into array of last 1000 ticks, then write into global variable and do the same at every new clock?

It's something complicated, or I haven't slept enough).

Please describe in more detail.

 
Vitaly Muzichenko:

Reconciliation should probably be done withTimeGMT to take time zones into account? Write to an array of the last 1000 ticks, then write to a global variable, and so on every new clock?

It all seems rather complicated, or I haven't slept enough).

Please describe in more detail.

MqlTick, write to the structure, check the number of ticks, calculate the average spread, write to global

before you trade check the ratio of the global value and the real spread

 
pako:

MqlTick, write to the structure, check the number of ticks, count the average spread, write to the global

And before you trade check the ratio of the global value and the actual spread

Okay, no problem with that.

When to check it, in order not to get into a misfortune and not to start writing more and more spread every time, and as a result to reach 20 points.

The situation may be that we start to write a small, as a result, it is rounded and the current spread is checked for the maximum, then the spread gradually increases and we write a higher, because the test, it has passed with the written, and as a result we come to the maximum.)

Reason: