
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am coding an indicator based on moving averages I have
extern int PERIOD = 5;
if i run my indicator twice on the same chart and change the external input of one of them to 10 everything appears fine at first, it correctly positions 2 separate lines on the chart but as new bars appear the lines converge and run almost on top of each other as if they are both set to 5 periods.
If i remove the 10 periods indicator and reopen it at 10 periods again, the last part of the chart where the lines were almost on top of each other is now drawn correctly but the same thing happens again when new bars appear they converge again at the first new bar and stay almost on top of each other again.
Its like it recognises the first indicator is 5 periods and the second instance is 10 periods when drawing old bars, but when drawing current bars it is doing it wrong, I dont understand this as the indicator doesnt have different code for drawing the current bar it should be drawing the current bar MA by the same code as all the rest
Anyone have any idea what might be causing this to happen ?
Here is the code as you can see it is not finished, it is experimental, the reason for all the multiple instances of each variable/3 is because I was going to experiment by mixing the result from the other lines calculations into them, as the code is right now those parts look suplufluous because they are all still set to the same line.