PRC_step one more average | indicator
I love this indicator! It would be great to incorporate it in an automatic trading strategy. However, being a novice to coding I use the “Simplified creation” option and I can find no way to have this indicator’s “steps” over the price recognized in the strategy. Is there a way to overcome this so that the steps are noted in the strategy? Any help appreciated and a HUGE thank you to Nicolas for all that you have created and shared here!!
The only way to include the indicator in a strategy is via hard coding it in.
This is not that difficult though. Just copy the indicator code into your strategy beneath any defparam instructions and then remove the RETURN line. You may want to then remove the // before the variable settings at the start of the code or add them as optimised variables. You will also need to delete the lines that refer to color. You should then have a value in your strategy called ‘Result’ which is the value of the average so you can check the following;
if close > result then
if close < result then
Actually there is another way you can CALL the indicator.
CALL
Add the following to your strategy and then your strategy will have ‘Result’ as the step average value (not tested):
Length = 25
Speed = 3.0
Adaptive = true
Sensitivity = 0.5 // Sensivity Factor
StepSize = 50 // Step Size period
result = CALL "prc_step-one-more-average"[length,speed,adaptive,sensitivity,stepsize]