Been at it for hours...Definitely something simple!!! AHHHHH
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 > Swing(swings).SwingHigh);
else if (Low >= EMA(keltner) + Spread * TickSize);
PlotColors = sMAUp;
if (Low < Swing(swings).SwingLow);
else if (High <= EMA(keltner) - Spread * TickSize);
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:
Last edited by gregid; March 31st, 2015 at 07:56 AM.
Reason: Lost one brace
The following user says Thank You to gregid for this post:
After separating with brackets like you said I am actually making progress.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
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.