Bardate() does to be missed in if statement



I am writing a script and testing the bardate() function, but it does not seem to be picking up the date correctly.


v2 = if( bardate() = 32875, 700,0);

plot0 = v2;


If you look at the below screenshot, I would only expect a single line plotted on 2 Jan 1990, however, it seems to ignore the date criteria bardate() = 32875, and plots 700 sporadically, have I set the parameters correctly? I would expect it to plot 0, for all dates except the date = 32875 (2 Jan 1990).


Thanks in advance.






Hi Mario,

Remember that when you are comparing something, you need to use the double equals (==). When you use one you are trying to assign 32875 to bardate() which can not be done.

make it v2 = if( bardate() == 32875, 700,0);

All the best



Thanks Matthew! Will update my code :)