Search found 1 match

Go to advanced search

by leopjy
Tue Jun 22, 2021 2:33 pm
Forum: Pine Script Q&A
Topic: I want to write a code for a buy condition: closing price has been rising for the last 5 bars
Replies: 1
Views: 611
 
Jump to post

I want to write a code for a buy condition: closing price has been rising for the last 5 bars

Let's say my strategy is to buy a stock that has been rising for the past 5 bars. I would write something like this: longCondition = (close > close[1]) and (close[1] > close[2]) and (close[2] > close[3]) and (close[3] > close[4]) and (close[4] > close[5]) However, I have a feeling that there's a sim...

Go to advanced search