Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
And the winner is................
bukkan.
I only wish I understood why ! lol
I've changed it to a CrossAbove and CrossBelow statement:
I've coloured the bars ok for CrossAbove +5 and CrossBelow -5, without the "else" statement.(which should colour all bars between +5 and -5 as gray)
But when I add the else statement I get the magenta bars ok but all other bars are gray:
It's working as per your post, all be it with 2 x } at the end so many thanks.
I'm at a loss as to the reasons for differences in how to group things within the curly brackets, or
as and when they are needed.
I spend hours only to find out my mistake is down to one single bracket or a semi colon etc..
Any suggestion as to what material/video/link (anything) that would help me learn this stuff
would be great, if you have time.
If you have two statements after an if() test you will need to enclose them ind curly brackets or else only the first one will execute according to the result of the test.
if (CrossAbove (+5,Value,1))
BarColor = Color.Blue;
Print("We changed the bar color!");
Above code will only change the bar color if the CrossAbove test is passed but it will always execute the Print statement. To only Print when the bar color changes you would uses brackets to group them together.
if (CrossAbove (+5,Value,1))
{
BarColor = Color.Blue;
Print("We changed the bar color!");
}