Hi there,
Im expiriencing a strange issue will copying data from an indicator buffer - the values of the buffer are never changes, so everytime the print function is called, the output is the same.
What im doing wrong ?
...- Please use SRC button when you post code.
- You have to ckeck the validity of your handle
if(rsiHandle == INVALID_HANDLE) { ... }
- Your loop must be
for (int i=0;i<5;i++)
- It works for me
2013.06.05 09:16:19 testEA (AUDUSD,H1) 4=43.4792787206956
2013.06.05 09:16:19 testEA (AUDUSD,H1) 3=45.48713216655199
2013.06.05 09:16:19 testEA (AUDUSD,H1) 2=44.60944394777444
2013.06.05 09:16:19 testEA (AUDUSD,H1) 1=33.16264136016277
2013.06.05 09:16:19 testEA (AUDUSD,H1) 0=25.03978758795103
Just added the handle check and edited the loop, but nothing changed.
The thing is, onInit i create the handle, and then i copy the buffer again and again. (onTick)
- so its logical for me that the buffer would change every time cause the rsi changes, am i right ? (In fact this input should go through my MLP Neural Network and when the inputs are always the same, the output would always the same to, and thats not the target.)
Looking forward to your answers, thanks so far for the reply :)
So here is a screenshot of mine:
Just added the handle check and edited the loop, but nothing changed.
The thing is, onInit i create the handle, and then i copy the buffer again and again. (onTick)
- so its logical for me that the buffer would change every time cause the rsi changes, am i right ? (In fact this input should go through my MLP Neural Network and when the inputs are always the same, the output would always the same to, and thats not the target.)
Looking forward to your answers, thanks so far for the reply :)
So here is a screenshot of mine:
Ok you mean that on each tick you have to same values for one index, I thought you have same value for each index.
There is no problem, you are copying 5 values starting from 1, so you get RSI values for candles 1 to 5, they don't change (RSI don't repaint) until you have a new candle and all the array is shifted by one. Current candle is the only one changing but you don't use it. You also have to check value returned by CopyBuffer(...), I forgot that in my previous post.
if (CopyBuffer(rsiHandle,0,1,5,buffer)<5) return;
if (CopyBuffer(rsiHandle,0,1,5,buffer) == 5) for (int i=0;i<5;i++) Print(i,"=",buffer[i]);
But nothing changes, it acts like before and prints the 4 same values every tick.
(I update my neural network every tick and so id like to actualize the input layer)
Many thanks for your help - i hope i dont get on your nerves.
Greetings
here is my updated code, as you wrote:
if (CopyBuffer(rsiHandle,0,1,5,buffer) == 5) for (int i=0;i<5;i++) Print(i,"=",buffer[i]);
But nothing changes, it acts like before and prints the 4 same values every tick.
(I update my neural network every tick and so id like to actualize the input layer)
Many thanks for your help - i hope i dont get on your nerves.
Greetings
Obviously, do you read my previous post ? The main thing I said there is :
...you are copying 5 values starting from 1, so you get RSI values for candles 1 to 5, they don't change (RSI don't repaint) until you have a new candle and all the array is shifted by one. Current candle is the only one changing but you don't use it.
Current candle is 0, this is the only one where RSI value changes. You are copying value for candle 1 to 5, they don't change and will not change any more.
Oops, think i got it - interupt me if im wrong.
If the selected PERIOD is, lets say 1 Minute, one new candle appears every minute and then the values are expanded by one additional candle.
so now the buffer looks like this :
ValForMinute1
ValForMinute2
ValForMinute3
ValForMinute4
ValForMinute5
after one minute he will look like this
ValForMinute2
ValForMinute3
ValForMinute4
ValForMinute5
ValForMinute6
Am i right ?
Oops, think i got it - interupt me if im wrong.
If the selected PERIOD is, lets say 1 Minute, one new candle appears every minute and then the values are expanded by one additional candle.
so now the buffer looks like this :
ValForMinute1
ValForMinute2
ValForMinute3
ValForMinute4
ValForMinute5
after one minute he will look like this
ValForMinute2
ValForMinute3
ValForMinute4
ValForMinute5
ValForMinute6
Am i right ?
Thank you very much for helping me !
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
Im expiriencing a strange issue will copying data from an indicator buffer - the values of the buffer are never changes, so everytime the print function is called, the output is the same.
What im doing wrong ?
Here is the code: