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

 
tabacmaker:

I need your advice!


I am trying to test a multi-currency EA but the results are not accurate because the void OnTick(); function is called in case of a tick in the selected chart and not in case of another currency in the EA. How can I replace void OnTick(); with another function so that the code is executed continuously?

   while(!IsStopped())
    {
     ...
     Sleep(100); 
    }
 
tabacmaker:

I need your advice!


I am trying to test a multi-currency EA but the results are not accurate because the void OnTick(); function is called in case of a tick in the selected chart and not in case of another currency in the EA. How can I replace void OnTick(); with another function so that the code is executed continuously?

solving with OnTimer(); with the timer value set to run, I think in the right direction?
 
tabacmaker:
solving with OnTimer(); with the timer value set to run, I think in the right direction?

Check it out, it's quick

 
Hello, I ran into a bug in the MT4 tester!
I ran the Expert Advisor, and threw the indicator analyzing candlesticks on the tester chart...
Question: Why is requesting Ask or Bid of the current price and getting the price from the real-time chart, and not from the tester - is it a bug?
Files:
77.png  119 kb
 
Maksim Mihajlov:
Hello, I ran into a bug in MT4 tester!
I launched an Expert Advisor, and threw a candlestick analyzing indicator on the tester chart...
Question: Why am I requesting the Ask or Bid of the current price and getting the price from the realtime chart, and not from the tester?

Try using SymbolInfoTick

 
Alexey Viktorov:

Try using SymbolInfoTick

I'll try, thanks, but the question is, is it normal that Ask and Bid get real prices in the tester instead of the generated prices, which hasn't happened before?

 
Maksim Mihajlov:

I'll try it, thanks, but the question is different - is it normal that Ask and Bid get real prices in the tester instead of the generated ones, which hasn't happened before?

Such glitches occurred before, but they were fixed later.
Maybe you do not have the latest version of the terminal. Check it.
 
Hi folks, could you please advise ... I have an indicator - Informer, which displays open orders and profit on them in the chart window. My EA opens a lot of multi-directional orders, so it turns out the situation where the sell order does not fit in the graph window. This is very inconvenient. I tried to remove open trades from the code, but after messing around with it the indicator just does not show up in the window (I'm not very good at this stuff yet =)) ... Can I add an adjustable parameter for setting the number of displayed deals, or do I make deals not show up at all? Thanks a lot!
Files:
 

Good afternoon. Can someone tell me how to search for open positions, you can write their tickets in an array, according to the order of opening.

If we are going to brute force the positions

int pos_total =PositionsTotal();
   for (int j=pos_total-1; j>=0; j--)
         if(myposition.SelectByIndex(j)) 

Will they be selected from the most recently opened to the earliest opened. Or just in random order? And then we need to add another definition by time of opening?


 
sllallom:

Good afternoon. Can someone tell me how to search for open positions, you can write their tickets in an array, according to the sequence of openings.

If we are going to brute force the positions

Will they be selected from the most recently opened to the very first opened. Or just in random order? And then we need to add another definition by time of opening?


You just have to check it. As a last resort, just sort the array and that's it.