scanning for premarket highs and opening range breakouts


Category:
0
0

Hi,

I am new to coding in Think Script. I want to write following 2 scripts

a) gapped up and just moved over 5 minute opening range breakout

b) premarket active and moved over premarket highs

I will use above 2 scripts for intra day scanning

I have seen youtube videos by Pete and impressed on how we can mold a think script to custom scan

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on May 24, 2017 11:42 am
3082 views
0

For item a, please provide a screenshot of this pattern so I understand clearly what it is you are looking to find with the scan. But be sure to check out this post because you may find it does the job: https://www.hahn-tech.com/ans/gap-to-previous-day-close-scan/

For item b, please review this video and see if this provides a solution: https://www.hahn-tech.com/thinkorswim-overnight-range-scan-alert/

( at May 24, 2017 3:34 pm)
1
Private answer

I believe your solution, using the code that you provided in ORB.txt is to modify that code as follows:

REMOVE THESE LINES:

def closeByPeriod = close(period = “DAY”)[-1];
def newDay = if !IsNaN(closeByPeriod) then 0 else 1;
plot Scan = If(marketOpen and newDay and today and pastOpeningRange and IsmarketOpen and ShowORB, ORHigh, Double.NaN);

ADD THIS LINE:

plot scan = high > ORHigh;

That scan plot will pick up any stocks whose current high’s are greater than the opening range high. If you need to refine this logic please provide more details.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 30, 2017 4:19 pm
0

Thank you Pete. I will test drive this indicator and update you. Great to have this kind of support from you

( at May 30, 2017 6:11 pm)
0
Private answer

Hi Pete,

This is my second day with ThinkScript and having syntax problems. I reviewed your wonderful video on “custom scan stochastic macd”.

I am trying to create a watchlist from scan, similar to above video for ORB, which is bullet ‘a’ from above question (I need more time to get started on ‘b’).

15 minute ORB (long or breakup) I mean price broke up above 15 minute high and I want such stocks to show up in my scan. Below is a chart with red horizontal lines on the 15 minute level

Edit: The link has been removed because it no longer works

So, in above case I want the stock to show up in my scan twice because it broke up, pulled back and broke up again (note: it is 5 minute intraday)

I attached some sample code. In TOS -> Scan ->Add Stock Filter -> Custom, I add the code from attached file.

But I get the error “Secondary period not allowed in Day”, as you can see at http://jmp.sh/JXJOiDN

Will you please help me in resolving above error – thank you so much

 

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on May 29, 2017 12:14 am
0

Link to error got buried. Here it is

Edit: the link has been removed because it no longer works

( at May 29, 2017 12:18 am)
0

The line of code creating this error is : def closeByPeriod = close(period = “DAY”)[-1];

It is not possible to use this code as a custom filter criteria in a scan. It may be possible to re-write the code to get it working.

( at May 29, 2017 8:38 am)
0

Pete: Will you help me by fixing the code-I can contribute to your ”donate” jar

( at May 29, 2017 9:57 pm)
0

Delete the following lines of code from ORB.txt
def closeByPeriod = close(period = “DAY”)[-1];
def newDay = if !IsNaN(closeByPeriod) then 0 else 1;

Then remove ”and newDay” from our Plot scan statement.

This will clear up the error but the scan is defective because your Plot Scan statement is not a True/False result. I feel you are in way over your head in trying to manipulate code of this complexity. Have you contacted the original author of this code and asked them to create a scan for you?

( at May 30, 2017 9:01 am)
0

Pete: I donated to your tip jar. Please make the video and post the working code at your convenience. Admittedly, I am neither coder nor could reach the authors nor could figure out testing/accuracy of the logic from your hints. Thank you

( at May 30, 2017 2:53 pm)
0

Pete: I kept the scan running for the entire trading hours today and I got zero results (I know there were few 15 minute ORBs today). So the script simply doesn’t work. Please feel free to fix the code and make a video out of it (at your convenience). Thanks

( at May 31, 2017 11:09 pm)
0

I just ran the scan and it returned 467 results. Make sure you made the changes as I described them. This code is authored by another site. I will not be doing a video on this. I will not be publishing the entire code here. I suggest you contact the original author for further assistance.

( at June 1, 2017 7:52 am)