Scan for inside bars


Category:
0
0

Hi Pete.  I am looking for a code that simply scans for stocks in which the previous bar was and inside bar.  I came across the code below you provided in a previous post but it doesn’t seem to identify stocks when I run an intra day scan.

def count = 2;
def range = high – low;
#def priorrange = high[1] – low[1];
def priorrange = range[1];
def nibsize = absvalue(((open – close) / (open[1] – close[1])-1));
def sizeConstraint = absvalue((range / priorrange)-1) >= .5 and nibsize >= .5;
def hiLowContraint = high <=high[1] and low >= low[1];
def inside_bar = sizeConstraint and hiLowContraint;
#plot s = inside_bar && lowest(range,count);
plot scan = inside_bar[0];
AssignPriceColor(if inside_bar then Color.WHITE else Color.CURRENT);

Marked as spam
Posted by (Questions: 19, Answers: 18)
Asked on August 4, 2019 11:14 am
1729 views
0
Please provide a link to that previous post. There is nearly a thousand posts on the Q&A forum. The code does not have the characteristics of something I would write. So it must have been provided by the author of the previous post. I need to know the context before I can offer a reason why it's not working for intraday. What time frame are you using for intraday scan?
( at August 4, 2019 12:26 pm)
0
Private answer

The original post referred to by Corey:

https://www.hahn-tech.com/ans/inside-days-entry-prices-on-chart/

Always be sure to include the url of any sources that you reference in your question. Context is key, and without being able to view the original post the audience is lost.

I tested the scan on 5 min, 15 min, and 1 hour time frames. It worked on all of them. You will need to provide more details or I am not able to provide any assistance.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 4, 2019 4:16 pm
0
Hi Pete. Thank you for your response. I'll be sure to include links when referencing another post going forward. When I stated the scan and charting code wasn't working I was not accurate. The code works exactly how the other individual requested. The code is searching for inside bars that is 50% less than the mother bar. Can you help with modifying the code so that it scans for all inside bars without the 50% qualifier? I love the fact that the code allows me to search for current or previous bars, I would just like to remove the 50% qualifier. Thank you for all of your help! https://www.hahn-tech.com/ans/inside-days-entry-prices-on-chart/
( at August 14, 2019 3:43 pm)
0

Sure thing. Remove this "sizeConstraint and" from this line of code:

def inside_bar = sizeConstraint and hiLowContraint;

( at August 14, 2019 4:25 pm)
0
Thank you Sir.
( at August 14, 2019 6:18 pm)