if (Close[i] < Close[i+1]) { SMAdn[i+1] = Close[i+1]; SMAdn[i] = Close[i]; } if (Close[i] >= Close[i+1]) { SMAup[i+1] = Close[i+1]; SMAup[i] = Close[i]; }
DRAW_LINE,STYLE_SOLID can only appear between two bars if the two bars have a value
instead of draw_line you can do also draw_arrow and make width bigger
in that case you can the code be like you did
if (Close[i] < Close[i+1]) SMAdn[i] = Close[i]; if (Close[i] >= Close[i+1]) SMAup[i] = Close[i];
A little bit too early... I used your first code and the result is this:
Do you see the last up move? There is no green line although we had some up closes... Do you have an idea how to correct it?It seems to me that the indicator causes problems when there are alternating up- and downcloses. It only works when there are at least two up- or two downcloses.
But I have no idea why.... ?!
Nobody has an idea? :-(
if (Close[i] < Close[i+1]) { SMAdn[i+1] = Close[i+1]; SMAdn[i] = Close[i]; SMAup[i] = EMPTY_VALUE; } if (Close[i] >= Close[i+1]) { SMAup[i+1] = Close[i+1]; SMAup[i] = Close[i]; SMAdn[i] = EMPTY_VALUE; }
On a live chart the price may be above or below the previous close at any one time and so a value would be set for both buffers
Not sure if the above would be useful or not
Nobody has an idea? :-(
Why do you think i suggested to do it with DRAW_ARROW instead of using DRAW_LINE ??
See how your buffers are filled and then look to your line
A line needs two points to get from BarX to BarY
if you go up down up down up .......
then both buffers will have no empty value but you see the last buffer colored
I did not know that DRAW_LINE causes such problems.
I think we can use DRAW_COLOR_LINE for this type of indicator. Having said that assigning the colors to it seems kinda complicated I havent tried it yet.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey guys,
can somebody tell me where the error is?
Here is the code: