When posting code, please wrap it between a pair of
CODE tags. Thanks. The CODE button is right above the message text box: Bold, Italic, ... CODE, IMG. I've made the change for you.
Regarding your question.
1. You could use the "Price is <(>) X% above(below) Indicator" rule.
2. Or, the MA in this snippet:
CODE:
Please log in to see this code.
could be modified, for instance, like this:
CODE:
Please log in to see this code.
To make the percentage choice interactive for rule-/code-based strategies, see the User Guide on exposing Strategy parameters and the Programming Guide on
Programming Trading Strategies > Strategy Parameters, respectively.