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
Hello,
I'm trying to make an indicator that takes 4 entry values (Stochastic Oscillator, Stochastic Oscillator Slow, RSI(9) and RSI(14)), powers them to some set weights (w11 to w14) and then multiplies the result to store it in a variable (S1). Then, this variable is multiplied by another set weight (c1) and adds it to the same calculation (S2) but with different weights (w21 to w24 & c2). The result of the sum is stored in the variable ExtOutput[]. If I draw ExtOutput[], the indicator works fine but the range of the result is meant to be between 0 and 100 (similar to the Stochastic Oscillator) but because of the calculations, it varies between 0.2 and 1.4.
I've tried to normalize the results using a standard formula:
Buf_0[i] = (ExtOutput[] - ExtOutput[ArrayMinimum(ExtOutput,WHOLE_ARRAY,0)])*100/(ExtOutput[ArrayMaximum(ExtOutput,WHOLE_ARRAY,0)] - ExtOutput[ArrayMinimum(ExtOutput,WHOLE_ARRAY,0)]);
When I enter this code, the indicator stops working and it does not draw. Trying to figure out the error, I found out that the maximum value I get with ArrayMaximum() is 2147483647 (EMPTY_VALUE) so the normalization formula gives values close to 0 due to the high number in the denominator.
Does anyone know how to fix this issue?. I need the output of ExtOutput[] to be ranged from 0 to 100 so I can draw it in the chart. Code is down below, thanks in advance!