0

I'm making my first strategy in pinescript so im learning how to code. Theres a step in my strategy that the moving average need to be pointing upwards. I was thinking that i could put that the value of the third previous ma candle was below the current value. The problem is that I don´t know how to do it. Can someone help with this?

The problem is that I don´t know how to do it. Can someone help with this?

1 Answers1

1

You can use the ta.rising() function to check how many bars your moving average has been rising for.

ta.rising(source, length) → series bool

RETURNS
true if current source is greater than any previous source for length bars back, false otherwise.
ARGUMENTS
source (series int/float) Series of values to process.
length (series int) Number of bars (length).

vitruvius
  • 15,740
  • 3
  • 16
  • 26