Search found 2 matches

Go to advanced search

by stakeprophet
Tue Apr 13, 2021 9:44 am
Forum: Pine Script Q&A
Topic: Check if condition first becomes true and holds within n bars?
Replies: 2
Views: 1243
 
Jump to post

Re: Check if condition first becomes true and holds within n bars?

I think it should work for that though I thought it should work for any function. In the example you suggested the function should only return true for the last 4 bars if all 4 bars were below sma 50 AND bar[5] was > 50. I am trying to check if the condition *starts* being true within the last n bar...
by stakeprophet
Mon Apr 12, 2021 11:42 pm
Forum: Pine Script Q&A
Topic: Check if condition first becomes true and holds within n bars?
Replies: 2
Views: 1243
 
Jump to post

Check if condition first becomes true and holds within n bars?

I want to create a function to check if a condition first becomes true anywhere within a history of n bars, and if it does return true for the first bar and return true for every subsequent bar within the range where the condition held true without breaking the series of trues since the first. I und...

Go to advanced search