Download MetaTrader 5
To add comments, please log in or register
Track all payments in your profile. It is easy!
eugenio
57
eugenio 2014.02.15 20:36 

I mark bug on ObjectGet function....follow example with debug

I have on chart one label on corner 4

this is my function code

int calc_Yaxis( int corner )

{

int i;

int result;

int objectNumber;

int realObjectNumber;

int cornerDistance;

switch( corner )

{

case 1: cornerDistance = 15; break;

case 2: cornerDistance = 0; break;

case 3: cornerDistance = 0; break;

case 4: cornerDistance = 12; break;

}

Print("-----------------------");

Print("corner = ",corner);

Print("cornerDistance = ",cornerDistance);

objectNumber = ObjectsTotal();

Print("objectNumber = ",objectNumber);

for ( i = 0; i < objectNumber; i++ )

{

Print("------------------i = ",i);

Print("ObjectName(i) = ",ObjectName(i));

Print("ObjectGet( ObjectName(i), OBJPROP_CORNER ) = ",ObjectGet( ObjectName(i), OBJPROP_CORNER ));

Print("OBJPROP_CORNER = ",OBJPROP_CORNER );

if ( ObjectGet( ObjectName(i), OBJPROP_CORNER ) != corner )

continue;

Print("OBJ_LABEL = ",OBJ_LABEL);

Print("ObjectType( ObjectName(i) ) = ",ObjectType( ObjectName(i) ));

if ( ObjectType( ObjectName(i) ) != OBJ_LABEL )

continue;

realObjectNumber++;

}

result = cornerDistance + (15 * realObjectNumber) + 1;

Print("realObjectNumber = ",realObjectNumber);

Print("pixel result = ",result);

return( result );

}


and this is the debug result.........all label are set on corner 4 ( top left ) but the function return always 0


21:24:15 GAP_LAP_searcher EURUSD,H4: corner = 4

21:24:15 GAP_LAP_searcher EURUSD,H4: cornerDistance = 12

21:24:15 GAP_LAP_searcher EURUSD,H4: objectNumber = 5

21:24:15 GAP_LAP_searcher EURUSD,H4: ------------------i = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectName(i) = GAP_DOWN_0

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectGet( ObjectName(i), OBJPROP_CORNER ) = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: OBJPROP_CORNER = 101

21:24:15 GAP_LAP_searcher EURUSD,H4: ------------------i = 1

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectName(i) = GAP_LIST

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectGet( ObjectName(i), OBJPROP_CORNER ) = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: OBJPROP_CORNER = 101

21:24:15 GAP_LAP_searcher EURUSD,H4: ------------------i = 2

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectName(i) = GAP_UP_1

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectGet( ObjectName(i), OBJPROP_CORNER ) = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: OBJPROP_CORNER = 101

21:24:15 GAP_LAP_searcher EURUSD,H4: ------------------i = 3

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectName(i) = LAP_DOWN_0

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectGet( ObjectName(i), OBJPROP_CORNER ) = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: OBJPROP_CORNER = 101

21:24:15 GAP_LAP_searcher EURUSD,H4: ------------------i = 4

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectName(i) = LAP_LIST

21:24:15 GAP_LAP_searcher EURUSD,H4: ObjectGet( ObjectName(i), OBJPROP_CORNER ) = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: OBJPROP_CORNER = 101

21:24:15 GAP_LAP_searcher EURUSD,H4: realObjectNumber = 0

21:24:15 GAP_LAP_searcher EURUSD,H4: pixel result = 13

thanks

eugenio bravetti



Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.15 21:47  
e.bravetti:

I mark bug on ObjectGet function....follow example with debug

I have on chart one label on corner 4

this is my function code


<removed>

Please use the SRC button to post code . . .
Keith Watford
Moderator
7875
Keith Watford 2014.02.15 23:08  

"and this is the debug result.........all label are set on corner 4 ( top left ) but the function return always 0"

There is no such setting as corner 4, corners are numbered 0 to 3, 0 Is top left.

I believe that if you enter an incorrect number, such as 4, for setting the corner, it will default to 0.

Alain Verleyen
Moderator
28522
Alain Verleyen 2014.02.15 23:15  

e.bravetti:

...

eugenio bravetti



Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

Also note that current build is 610.

/
To add comments, please log in or register