Scan for Bollinger band and average daily range


Category:
0
0

Hello Pete,thank you for all you do!

Please I was wondering if you can help create a TOS code with these thoughts for a scan and trigger signal plot on chart.

Below are the criteria:

  1. Price close more than 50% of the candle body outside the lower band
  2. Average daily volume must be 3,000,000
  3. Stock price must be $15 min and $100 max
  4. Average daily range must be $1.50 or more (the range the stock moves from high to low in a single day)

Thank you greatly,

God  bless!

Marked as spam
Posted by (Questions: 2, Answers: 2)
Asked on July 14, 2020 3:57 am
175 views
0
Private answer

Since you are requesting a scan and NOT a chart strategy I have moved this post into the "Stock Scanners" topic. The topic you selected "Strategy Guide" is meant for chart strategies used to backtest trade setups.

I have also updated the title of your question because, once again, you are not asking for a chart strategy. So your original question title of "BOLLINGER BAND REVERSAL STRATEGY" did not describe you request at all. And FYI, there is never a need to use all caps in any question title.

Now that we have those corrections out of the way let's look at your specifications:

  1. The "body" of the candle consists of ONLY the open and close. So the close is always going to close at either 0% or 100% of the candle body. Perhaps you intended to state this differently? I am thinking you actually meant to say the close is more 50% of the High to Low range of the candle. That is possible. But you really need to explain this more clearly. "more than 50%" Does that mean the top 50% of the high to low range or the bottom 50% of the high to low range?
  2. This is already available as a built in filter for any scan.
  3. Same as item 2
  4. No are you speaking here of the built-in study named ATR? (Average True Range). Or did you truly intended to request a custom version that only measures the average range of each bar's high to low?

Final question. For the Bollinger band component, is that taking place on the daily time frame? Everything else seems to imply you want everything measured in same (daily) time frame. But we need to understand this before we can proceed.

After having to clarify all of this I am now left with 5 min to come up with a solution.

So in that time this is all I can offer. The following statement computes the percent of the close within the range of the high to low:

def percentOfRange = (close - low) / (high - low);

The output is a decimal value. A close at the very low of the candle will output a value of 0% and a close at the very high of the candle will out a value of 100%.

Ok, that's about all I have time for on this request. Sorry, out of time.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on July 14, 2020 7:58 am
0
thank you again, I don't know if adding this comment is allowed, please bear with me. 1. 50% of the total candle's range closing outside the lower bollinger band 2. Time frame is daily. 3. Average True range is $1.50 or more ( that is the range the stock moves from market open to close, on the average) thank you!
( at July 14, 2020 8:10 am)
0
Yes, totally allowed. In fact comments are encouraged. However you still have not provided the detail about the 50% level. Is that above the 50% of the candle range or below the 50% of the candle range? For the scan you simply add the following to the line of code in my answer: plot scan = percentOfRange > 0.5; That is for a close in the top 50% of range. Reverse the grater than to less than if you need close in the bottom 50% of range. The other items can be constructed using the Condition Wizard and do not require any custom code. Use the ATR study for your average daily range above 1.5. Sorry, that is all I have time for on this solution.
( at July 14, 2020 10:21 am)
0
I appreciate your response friend, please forgive me I know nothing about codes and all, I'm a sales man, lol! Check this out, I found this statement which explains what I'm trying to explain, but I can't get it to work on think or swim, Please help me define this! 15 1.5 AND ABS((H + L) /2 - AVGC20) > 2 * STDDEV20 Lastly how do I scan for oversold on bollinger band using the study condition. Sorry for all the troubles man!
( at July 14, 2020 2:16 pm)