- ago
Is there a simple way to code a decision based on the indicator rising or falling? I see options such as indicator.CrossesOver and CrossesUnder, but I don't see anything that says it's rising over a period.

0
154
5 Replies

Reply

Bookmark

Sort
- ago
#1
Yes, there are several ways. For example, in Blocks you can add "For N Consecutive Bars" or "N Times within N Bars" Qualifier.
0
Cone8
 ( 3.70% )
- ago
#2
Momentum and ROC indicators give you the rise or fall in points or percentage for the lookback period, respectfully.
0
- ago
#3
Robert, I forgot to mention: this topic is extracted as a general question raised in a different context: SuperTrend indicator.
0
- ago
#4
QUOTE:
a simple way to code a decision based on the indicator rising or falling?

Any momentum indicator will do that for you. I like the MACD myself, but you can use some other momentum indicator.

CODE:
momentumChange = MACD(someIndicator, ...);
And the sign of momentumChange will tell you if it's rising or falling.

Another approach would be to compute the velocity, then smooth that. Just understand that your choice of the smoother will determine the delay in the response. If the delay is a problem, I would choose a modern "adaptive" smoother like DSMA.
CODE:
velocity = Momentum.Series(someIndictor, 1); momentumChange = SMA.Series(velocity, 3); //simple smoother
0
Glitch8
 ( 8.31% )
- ago
#5
An indicator is RISING if it is greater than its value one bar ago. So you can use Indicator Compare to Indicator and set the How many Bars ago to 1.

Use the For N Consecutive Bars Qualifier next.

This example is true if the RSI is rising for three consecutive bars.

0

Reply

Bookmark

Sort