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
ok thanks, I'll be interested to know if you attach it to a chart does the Alerts give you that same 2147483647 value for lma (buffer 5) as I was getting.
ok but have a look at this I just made another indicator to test and identify the problem there are two versions the first version does the same thing as I did previously in my indicator without the calculation for the buffers 6 and 7 then output three ways of getting the value.
first from iMA second from a double like I did in my indicator and third directly from the buffer, this works fine all three match like they should
then i added the calculation to create buffers 6 and 7 from the values of buffers 4 and 5, this replicated the error !! now the values directly from iMA are fine, the values directly from the buffer[0] are fine. BUT the values taken from the doubles created from the buffers are returning 2147483647
this must mean that to create a buffer value from another buffer value will cause some kind of error so you were right in your first diagnosis when you said you thought my code for calculating buffer 6 and 7 was the culprit here is the test indicator with the error causing code commented out:
run that as it is it works, include the code that is commented out and the alerts will return 214783647 intermittently but only on the alert from the doubles ma_0a etc
anyways thanks for all your help with this cameofx, I know now to be careful when initializing doubles to be used with indicator buffers and/or performing calculations on indicator buffer values
First thing I did this moring is I modifed my code as you prescribed in the earlier post and it works perfectly except for I didnt change this code:
to this
because i believe if i had done that, i would be calculating the current value of buffers 6 and 7 from bar [+1] of buffers 4 and 5 instead of the current one. The current values of buffers 4 and 5 are already shifted by 1 so calculated from the previous bar, so I want to use those current value for the values of 6 and 7anyways thanks for all your help with this cameofx, I know now to be careful when initializing doubles to be used with indicator buffers and/or performing calculations on indicator buffer values
First thing I did this moring is I modifed my code as you prescribed in the earlier post and it works perfectly except for I didnt change this code:
to this
because i believe if i had done that, i would be calculating the current value of buffers 6 and 7 from bar [+1] of buffers 4 and 5 instead of the current one. The current values of buffers 4 and 5 are already shifted by 1 so calculated from the previous bar, so I want to use those current value for the values of 6 and 7Hi SDC,
I read this tread but I'm not exactly sure I understand what you are trying to do, but here is a suggestion to try.
Here is your main code section for the MA's:
The MA code is set up to read the PAST bar - for example - (...PRICE_LOW,1)
Try changing the past bar to the CURRENT bar - (...PRICE_LOW,0)
This may place the arrows on the current bar?
Hope this helps,
Robert
Hi SDC,
I read this tread but I'm not exactly sure I understand what you are trying to do, but here is a suggestion to try.
Here is your main code section for the MA's:
The MA code is set up to read the PAST bar - for example - (...PRICE_LOW,1)
Try changing the past bar to the CURRENT bar - (...PRICE_LOW,0)
This may place the arrows on the current bar?
Hope this helps,
Robert
I needed the MA (...PRICE_LOW,1) because i wanted the line to be created from the previous bar data so the line wouldnt reposition during formation of current bar
The problem did not turn out to be the shift, that was fine it turned out to be the varible which I had initialized with indicator line data that I was using as a reference for the position of the arrows was returning empty value, as cameofx pointed out, I had initialized variables with the drawing buffer data before the buffer was filled, like this:
var0=Buf_0[0]; var1=Buf_1[0] etc.
This caused an intermittent error when those variables were used as a reference point for the arrows and other things too, i was expecting those variables to contain the same data as buffer[0], but one of them ended up intermittently returning the data as EMPTY_VALUE which is a value of 2147483647
I changed the code to initialize the variables to nothing, then assign them to hold the buffer[0] data after the buffers were filled and the error ceased to occur. I still dont really understand why this error was intermittent though.