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

 

Hello, could you please tell me how to get the ask,bid tick values?

I have a crypto exchange integrated in my system.

The problem is that in the market overview and on the chart itself the quotes are displayed correctly, but when requested through the :

   MqlTick last_tick;
   SymbolInfoTick(Symbol(),last_tick);
   ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
   bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);
   Comment(": Bid = ",bid," Ask = ",ask," tick Time ",TimeToString(last_tick.time,TIME_SECONDS),
           "\n"," Ls_bid ",last_tick.bid," Ls_ask ",last_tick.ask);

Quotes stop reflecting correctly. general bummer!!!!!!!!!!


What other ways can I get values?

I'm asking analysts, please don't pass by! A third of my life developing a robot, the finish line is looming on the horizon, and here is the tin!!!

 
Mikhail, the market review has one time, the magazine has another. Is it supposed to be like that? I don't get it...
 
Aleksei Stepanenko:
Mikhail, the market review has one time, the logbook has another. Is it supposed to be like that? I don't get it...

I don't understand why that is!

Is it possible to ask for quotes differently?

 
pribludilsa:
(MQL5) Hi. Can you please help me to collect information about open positions in a loop. I can't seem to map the open position index to the array element number. I can't put together the code properly. Here I need to get type, volume, and price, let's assume I create arrays beforehand. I make a loop, I choose a position by ticket in it, and then how? And one more request, I'm still learning without OOP, can you give me an example without OOP?

And the OOP is of no help in this matter. There is not enough information for a complete answer. Positions on different tools? Do you need to choose only one of them? Make an additional counter and if the position is "our" then increase the size of the array, write in the last element of the array and increase the counter to the next "our" position.

 
Good afternoon, can you tell me if it's possible to call a function if I only have a string name and arguments. In general, is it possible to call a function by name?
 
Евгений Косухин:
Good afternoon, can you tell me if it's possible to call a function if I only have a string name and arguments. In general, is it possible to call a function by name?
Uh, I haven't found the answer yet, but temporarily I will probably just write if (name == 'iMA') { iMA(...) }
And so on, it works
 
Hi, could you please tell me why there is an (int) before ChartGetInteger in parentheses?
int bars=(int)ChartGetInteger(0,CHART_VISIBLE_BARS);
 
Dzmitry Zaitsau:
Hello, could you please tell me why ChartGetInteger is preceded by (int) in parentheses?
int bars=(int)ChartGetInteger(0,CHART_VISIBLE_BARS);

To explicitly convert the value to the correct type.

long  ChartGetInteger(
   long  chart_id,          // идентификатор графика
   int   prop_id,           // идентификатор свойства
   int   sub_window=0       // номер подокна, если требуется
   );
The function returns the long type, and I need the int type.
 
Евгений Косухин:
Uh, I haven't found the answer yet, but temporarily I guess I'll just write if (name == 'iMA') { iMA(...) }
And so on, it works

what prevents you from calling the MA straight away, without the name "MA"?

 
Alexey Viktorov:

And the OOP is of no help in this matter. There is not enough information for a complete answer. Positions on different tools? Do you need to choose only one of them? Make an additional counter and if the position is "our" then increase the size of the array, write in the last element of the array and increase the counter to the next "our" position.

Thank you.