Hi,
I'm trying to see if the tick value is higher than a certain trigger size, but think I have an error trying to compare different data types.
My variables are currently defined as:
double old_value
double diff
double tick
int trigger
...but SOMETIMES the if(tick > trigger) results as true when the two variables are the same value. I can print both values to the log and it says tick=1, trigger=1, tick>trigger = TRUE. I don't understand.
And if I make the tick variable an integer type rather than a double type, then it SOMETIMES doesn't pick up the right value, so I get diff=0.0001, tick = 0.
I'm not sure what to do now, so any help would be appreciated.
Thanks
Patrick
I'm trying to see if the tick value is higher than a certain trigger size, but think I have an error trying to compare different data types.
Inserted Code
int start()
{
//Make tick size from previous bid value
diff=(Bid-old_value);
//Get Absolute value
diff=MathAbs(diff);
//Make ticksize
tick=diff/Point;
//If tick size is > trigger value...
if(tick > trigger)
{
Do Something
}
//Set current Bid price as "old_value"
old_value = Bid;
return;
} My variables are currently defined as:
double old_value
double diff
double tick
int trigger
...but SOMETIMES the if(tick > trigger) results as true when the two variables are the same value. I can print both values to the log and it says tick=1, trigger=1, tick>trigger = TRUE. I don't understand.
And if I make the tick variable an integer type rather than a double type, then it SOMETIMES doesn't pick up the right value, so I get diff=0.0001, tick = 0.
I'm not sure what to do now, so any help would be appreciated.
Thanks
Patrick