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)
I literally have been at this for hours. I have managed to get the line to be 2 solid colors no matter what I try and the fact that I know its something simple is killing me.
I trying to get the average to change colors when one of two conditions are met, then change if the opposite first or second condition is met.
Please help if its something simple, if its not let me know and ill keep trying. Maybe just some insight to get me in the right direction.
on a side note, I didn't know how to get the code on my post in the little code window that I see all over the forum. How do you do that?
{
if (High[0] > Swing(swings).SwingHigh[0]);
else if (Low[0] >= EMA(keltner)[0] + Spread * TickSize);
{
PlotColors[0][0] = sMAUp;
}
}
{
if (Low[0] < Swing(swings).SwingLow[0]);
else if (High[0] <= EMA(keltner)[0] - Spread * TickSize);
{
PlotColors[0][0] = sMADn;
}
}
Can you help answer these questions from other members on NexusFi?
To fix your code remove the semicolon ";" from your if/else if lines:
to put the code in the code box - there is a hash "#" button in the toolbar (that's where you change the fonts) - this will give you the right tags for code.
If you are rather new to programming then I would also recommend to ALWAYS use curly braces with conditions ie: never leave the if, else if and else without accompanying curly braces. So that after closing bracket there are always curly braces (even if empty!):
This will help you to avoid many problems at the start.
It is not clear from your code but it seems to me that this is what you were trying to achieve:
Also, you have some superfluous braces used for separation of the code (eg. before your if statement) - this is not a good practice either for a beginner - use the braces after a condition/method etc. not before:
After separating with brackets like you said I am actually making progress.
It initially changes to magenta and should stay until one of the"up" conditions are met. Is there something that i am missing that would keep the 2 sets of conditions separate? And you guessed it, I am new to programming. Just starting to get my feet wet.