Download MetaTrader 5
To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
alexander
13
alexander 2015.04.08 16:39 

Hello everyone,

I am writing the expert, which is used ChartTimePriceToXY. When I tested it, this function work incorrect. Every time it returns 2147483647. I realise that it is 2^31 - 1, which is mean EMPTY_VALUE in this system, but I absolutely dont know why it happens. 

Part of my code:

double lips = iAlligator(Symbol(), Period(), 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, i);

double teeth = iAlligator(Symbol(), Period(), 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, i);

double jaw = iAlligator(Symbol(), Period(), 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, i);

double alligatorPoint = (lips + teeth + jaw) / 3; 

double barPoint = (Low[i] + High[i]) / 2; 

int alligatorX, alligatorY; 

ChartTimePriceToXY(0, 0, Time[i], alligatorPoint, alligatorX, alligatorY); 

 

And the most weard thing is, that if I try to run this code in the indicator, everything is good (function return valid values).

Guys, I need your help. Thank you.

whroeder1
13596
whroeder1 2015.04.08 16:54  
Alankras: Every time it returns 2147483647.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. ChartTimePriceToXY - MQL4 Documentation returns a bool. it can't return EMPTY_VALUE

alexander
13
alexander 2015.04.08 17:25  
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. ChartTimePriceToXY - MQL4 Documentation returns a bool. it can't return EMPTY_VALUE



You are right, but I meant that the value of alligatorX, alligatorY are not valid after.

whroeder1
13596
whroeder1 2015.04.08 18:03  
alexander
13
alexander 2015.04.08 18:31  

I already did that. For example, GetLastError() return 0 everytime, ChartTimePriceToXY return true. 

Anyway, thank you for your help.

alexander
13
alexander 2015.04.19 02:13  

I find solution. In the expert tester, some function doesnt work, e.g. graphical fucntion, that is why ChartTimePriceToXY  return bad values. To avoid this, I use tester with visualization and everything is fine.

Hope it helps anyone.

Cristiano Konrad
247
Cristiano Konrad 2015.05.12 19:25  
.
/
To add comments, please log in or register