Hi all,
So i am building an indicator which stores 2 values in an array which are to be used for the shift function in the High, Low and the standard rsi indicator.
However, i seem to be having an issue calculating the movement between the high and low and the rsi when using the shifts from each array. The movement calculation defined as (low-high)/high.
Below is the code i have tried:
Should the above criteria be met then a buffer is populated with a value. When running with the above, all indicator values are blank.
I have tried changing the if statement to something basic such as the below and the indicator values are populated
I know the division calculations are causing me an issue but unfortunately after numerous attempts i am unable to resolve.
Any help or pointers in the right direction would be a great help, thank you in advance
ok so managed to partially get this working, defining the High, Low and RSI values as double prior to the calculation before the buffer seems to have now fixed the issue, however still no luck on the division calculation in the IF statement - any ideas?
ok so managed to partially get this working, defining the High, Low and RSI values as double prior to the calculation before the buffer seems to have now fixed the issue, however still no luck on the division calculation in the IF statement - any ideas?
this is the code i have added so far, appreciate it needs to be tidied up but for simplicity i have gone the long way about it:
int currentPeak = shift; int currentTrough = GetPriceLastTrough(shift); double lowprice = Low[currentTrough], highprice = High[currentPeak]; double lowvol = rsi[currentTrough], highvol = rsi[currentPeak]; double pricemvmt = MathAbs((highprice-lowprice)/lowprice); double volmvmt = MathAbs((highvol-lowvol)/lowvol);
as above code stands, all values for the indicator go blank/empty, however if i comment out the row "double volmvmt....." the indicator values (buffers) are populated as expected.
When digging into the details i have pulled some data points for context:
highvol = 46.2062
lowvol = 39.4595
Any ideas???
- 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 all,
So i am building an indicator which stores 2 values in an array which are to be used for the shift function in the High, Low and the standard rsi indicator.
However, i seem to be having an issue calculating the movement between the high and low and the rsi when using the shifts from each array. The movement calculation defined as (low-high)/high.
Below is the code i have tried:
Should the above criteria be met then a buffer is populated with a value. When running with the above, all indicator values are blank.
I have tried changing the if statement to something basic such as the below and the indicator values are populated
I know the division calculations are causing me an issue but unfortunately after numerous attempts i am unable to resolve.
Any help or pointers in the right direction would be a great help, thank you in advance