Indicator sometimes does not display line

 

Hello,


i've noticed that if the value of an indicator has not changed, the line does not get displayed (there's gaps). How is it possible to fix this?


Also i've noticed that Int doesnt always get cast to double as with other languages, such as:

double foo = 100;

bar = 100/foo;

does not give the same result as

int foo = 100;

bar = 100/foo;
Given that bar is Double


Thank you in advance for the answers.

 

First problem solved, turns out i had the following line:

SetIndexEmptyValue(0, 0.0);


And basically wherever there was value 0.0, no line was displayed.


Still curious about how to calculate with int-double types.

 

Your code:

int start()
{
double foo = 100;

double bar = 100/foo;
Print ("bar1-",DoubleToStr(bar,8));
int foo1 = 100;

bar = 100/foo1;

Print ("bar2-",DoubleToStr(bar,8));
return (0);
}

and..

11:44:21 test GBPUSD,M5: initialized
11:44:22 test GBPUSD,M5: bar1-1.00000000
11:44:22 test GBPUSD,M5: bar2-1.00000000
11:44:28 test GBPUSD,M5: deinitialized
What difference?
 

Well, i had an Extern int PreviousBars


and when i did something like foo = someDouble/PreviousBars it returned 0.


I solved the situation with:


double d = PreviousBars

foo = somedouble/d;


Works now :) Well i'm new to the language so... maybe i just didnt see it right.