Questions from Beginners MQL5 MT5 MetaTrader 5 - page 771

 
Aybulat:
Is it possible to remove all orders and close all positions in the betting market using the hotkeys? Or maybe there is an Expert Advisor for this?
For this purpose, you need to find a trading panel that supports this functionality, or write your own script or Expert Advisor to delete all orders when you press a certain key combination.
 

I have such a situation - I need to get indicator's value at bar opening - EA trades when a new tick appears, but the problem is, that indicator may have time to change its value.

Therefore, I want to catch the moment between the end of time period and the appearance of a new tick - how to implement this in the least resource consuming manner?

I heard that it is possible to use an event in a glass - they are more frequent ticks, but how to do it?

 
Aleksey Vyazmikin:

I have such a situation - I need to get indicator's value at bar opening - EA trades when a new tick appears, but the problem is, that indicator may have time to change its value.

Therefore, I want to catch the moment between the end of time period and the appearance of a new tick - how to implement this in the least resource consuming manner?

I've heard that it is possible to use an event in the market - they are more frequent ticks, but how to do it?

Opening of a new bar == appearance of a new tick. If no tick comes, no new bar will appear. A tick will come, a new bar will open, and how long it is depends on how long there hasn't been a tick. If there was no tick for longer than seconds in a bar, then this bar will be skipped and the next bar will open in time after the missed one.

In any case, catch the appearance of a new bar and read the value of the indicator.

 
Artyom Trishkin:

The opening of a new bar == the appearance of a new tick. If there is no tick, no new bar will appear. If a tick comes, a new bar will open, and how long it takes depends on how long there has been no tick. If a tick has not been present for longer than seconds in a bar, then this bar will be skipped and the next bar will open after the missed one.

In any case, you catch the appearance of a new bar and read the value of the indicator.


Presently it is so, but the tick may be "strong" and knock value of indicator to some points, that's why I think, how to get rid of it.

 
Aleksey Vyazmikin:

Now it is, but a tick can be "strong" and knock down the indicator value by a few points, so I'm thinking how to get rid of it.

Take the indicator value from the first bar, not from the current-zero bar.

 
Artyom Trishkin:

Take the indicator value from the first bar, not from the current-zero bar.


Clever - anyone can do that :)

That might be a solution though, thanks, I'll think about it again.

 

Is it possible to callMqlTick and get ask and bid, in the included class?

If not, what can be applied. I am making a switchable class where all orders and positions will be processed.

 
forexman77:

Is it possible to callMqlTick and get ask and bid, in the included class?

If not, what can be applied. I am making a switchable class where all orders and positions will be processed.

What is the question?

 
Alexey Viktorov:

What's the problem?


Trying to prescribe:

MqlTradeRequest   mrequest;   
MqlTradeResult    mresult;         
double ask=latest_price.ask;

the error comes out.

'=' - illegal assignment use    trade.mqh       39      14
 
forexman77:

Trying to prescribe:

the error comes out.

Placed inside the function, the error disappeared.
double ask=latest_price.ask;