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

 

I can't figure out what's going on here, the spread should be roughly speaking, why is there such a big value on the yen?

void OnStart()
  {
   Test();
   Test2();
  }
//+------------------------------------------------------------------+
void Test()
  {
   double _bid=SymbolInfoDouble("GBPUSD",SYMBOL_BID);
   double _ask=SymbolInfoDouble("GBPUSD",SYMBOL_ASK);
   int abc=MathAbs(_bid-_ask)/_Point;
   double abc2=MathAbs(_ask-_bid)/_Point;
   Print("...............___________..............."+
         "\n"+"abc: ",abc,
         "\n"+"abc2: ",abc2);
  }
//+------------------------------------------------------------------+
void Test2()
  {
   double _bid=SymbolInfoDouble("USDJPY",SYMBOL_BID);
   double _ask=SymbolInfoDouble("USDJPY",SYMBOL_ASK);
   int abc=MathAbs(_bid-_ask)/_Point;
   double abc2=MathAbs(_ask-_bid)/_Point;
   Print("...............___________..............."+
         "\n"+"abc3: ",abc,
         "\n"+"abc4: ",abc2);
  }
//+------------------------------------------------------------------+

Result

abc: 11

abc2: 11.9999999999998979

abc3: 400

abc4: 400.0000000004888

 
Fast235:

I can't figure out what's going on here, the spread should be roughly speaking, why is there such a big value on the yen?

Result

abc: 11

abc2: 11.9999999999998979

abc3: 400

abc4: 400.0000000004888

Point is probably wrong. I print all data in the test, both result and calculated. It often helps to save time).

 
Valeriy Yastremskiy:

The point is probably the wrong one. I print out all the data in the test, both the result and the calculation. It often helps to save time).

Exactly, I used F5 from the editor, but how do I get "that" on the multi-currency? I need to get the distance in pips, multiply the points or something

 
Fast235:

Exactly, I used F5 from the editor, but how do I do "that" on the multi-currency? I need to get the distance in pips, multiply the points or something

What points do you get? From the pair on which the script is based?
 
Vladislav Andruschenko:
What points do you get? From the pair on which the script is based?

through F5 from the editor, started the debugger without the point-stop, there is a 5-digit value in it, in the script everything is already working on its own pairs, but how in a multisymbol EA, a simple way to get the correct pins?

it looks like through

SYMBOL_DIGITS или SYMBOL_POINT


 
Fast235:

through F5 from the editor, started the debugger without the point-stop, there is a 5-digit value in it, in the script everything already works on its own pairs, but how in a multisymbol EA, the simple way to get the correct points?

it looks like through

SymbolInfoDouble("",SYMBOL_POINT);
 
Good day. Can you please advise if i have a module formql5 wizardto open 2 orders simultaneously in one direction (2 orders for hedging or 1 order with partial closing for netting) with a stop loss on these two positions and transfer to lossless on Take Profit triggered by the first order and trailing 2 orders. Thank you in advance.
Мастер MQL5: Создание эксперта без программирования
Мастер MQL5: Создание эксперта без программирования
  • www.mql5.com
При создании автоматических торговых систем возникает необходимость написания алгоритмов анализа рыночной ситуации и генерации торговых сигналов, алгоритмов сопровождения открытых позиций, систем управления капиталом и контроля риска торговли. После того как код модулей написан самой сложной задачей является компоновка всех частей и отладка...
 

Poke your nose into a simple code that calculates the angle of price movement. The picture below shows it.


 
If you write the calculated values in a log or file, how does that help?
 
Valeriy Yastremskiy:

Write calculated values to the log or file, maybe it is taking old values from previous trades, it is not updating correctly, there may be many reasons.

If you write calculated values to the log or file, how would that help?