Custom Scan for the 3 Bar Pattern Play


0
0

Hey Pete, Love your site and it has been so helpful in creating some custom stuff for TOS.

I had a question about creating a scan for a certain type of candlestick pattern. How would I go about making a scan where I can search for a stock where it has a one larger than average candlestick and then one smaller candlestick then another larger than average candlestick.  I have attached a picture of what I am looking for. Is this possible?

 

Thanks

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on July 11, 2019 12:08 am
26 views

This needs to be clarified: "...larger than average candlestick..." How exactly should the computer measure what is an average candlestick?

Also, there is a very large library of candlestick patterns on Thinkorswim. They can be added to a chart or a scan. Have you taken the time to see if any of them match this pattern you have described?

( at July 11, 2019 1:23 pm)
I would look at the previous 10-15 bars to compare against and use that to get a larger than average candlestick. I think the closest I can use is the engulfing and harami candlestick patterns. But I'm not sure how to put it all together. Im not sure if I make myself more clear or not. length trend setup body factor
( at July 11, 2019 5:11 pm)
0
Private answer

Ok, that screenshot you provided shows a pattern that is far more complex than your stated goal. So I am only going to provide the code that matches what you requested. You can work with the code to include the other elements from your screenshot that you did not include in your request.

This code will only do the bullish pattern:

input maLength = 10;
input maType = AverageType.SIMPLE;
def range = high - low;
def averageRange = MovingAverage(maType, range, maLength);
def wideCandleOne = close > open and range > averageRange;
def shortCandleTwo = close < open and range < range[1] and high <= high[1]; def wideCandleTwo = close > open and range > averageRange;
plot scan = wideCandleOne[2] and shortCandleTwo[1] and wideCandleTwo;

Marked as spam
Posted by (Questions: 36, Answers: 1868)
Answered on July 12, 2019 2:19 pm
Thank you I will try this code out and then modify it as needed. I will update anyone reading with my progress
( at July 12, 2019 5:51 pm)