I have a question in regards to the understanding ternary operator
double true_range = (High==Low)?0:(Close-Open)/(High-Low);
The above entry is equivalent to the following:
double true_range;
if(High==Low)true_range=0;
else true_range=(Close-Open)/(High-Low);
but if I removed the variable "true_range " and use the “Alert” function as follows:
Alert ((High==Low)?0:(Close-Open)/(High-Low)); it still works but when I do the same using " if" it does not work
Can someone clarify the reason?
Thanks in advance