Scan for three consecutive days of two percent daily gain


Category:
0
0

Individual Daily Gain scanner over period of days

i will gladly contribute for your time if you can help me out, im looking for something somewhat simple.

i need help trying to setup a thinkorswim scanner that will scan previous 3 days in which every day (day 1 day 2 day 3) EACH had a a minimum gain of 2% each day. (not a AVERAGE gain, but each individual day had a 2% gain minimum)….. is there a way to accomplish this? im pulling my hair out searching google but im too dumb with the thinkscript im going crazy trying to understand the thinkscript formulas.

gaol is so that it finds stocks with setups similar to the attached picture

Moderator’s Note:

The title and url of this question has been adjusted to more clearly reflect the content of the question. This will optimize the ability of others to search for and locate this post.

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 13)
Asked on March 16, 2017 10:38 am
2407 views
0
Private answer

I can do that scan in 3 lines. Remember “Name that tune”? Well if you don’t then you’re probably much younger than I. So here is the code. I have attached a screenshot to demonstrate. This is from the Study Alert screen and is a handy place to test out scan statements. Be sure to up-vote any answers that best solve your question!

def twoPercentGain = 100 * (close / close[1] - 1) >= 2.0;
def threeBarsOfGain = twoPercentGain[2] and twoPercentGain[1] and twoPercentGain;
plot scan = threeBarsOfGain[1];

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 16, 2017 12:27 pm
0
Private answer

thank you sir, i will try it tomorrow, please let me know if you got my contribution to ####[email protected] from Dave, im hoping that was you. thanks for your time and thanks for helping people, you are awesome. i will try it out tomorrow.

Marked as spam
Posted by (Questions: 4, Answers: 13)
Answered on March 16, 2017 2:00 pm
0

Yes I see that contribution. Thanks so much for your support! Let us know how it goes.

( at March 16, 2017 3:42 pm)
0
Private answer

Thanks worked like a charm

Marked as spam
Posted by (Questions: 4, Answers: 13)
Answered on March 17, 2017 7:08 pm
0
Private answer

LoL, you did EACTLY what i asked for originally, i guess it was my mistake of not “wording” what i wanted correctly. What i needed was the exact same thing but instead of days i needed it for previous 48hours, because “previous 2 days” is skipping the current day. i tried to adjust the code like below but then i got lost. can u make a full code for me?

def 48BarsOfGain = bar[47] and bar[46] and bar[45] and bar[44] and bar[43] and bar[42] and bar[41] and bar[40] and bar[39] and bar[38] and bar[37] and bar[36] and bar[35] and bar[34] and bar[33] and bar[32] and bar[31] and bar[30] and bar[29] and bar[28] and bar[27] and bar[26] and bar[25] and bar[24] and bar[23] and bar[22] and bar[21] and bar[20] and bar[19] and bar[18] and bar[17] and bar[16] and bar[15] and bar[14] and bar[13] and bar[12] and bar[11] and bar[10] and bar[9] and bar[8] and bar[7] and bar[6] and bar[5] and bar[4] and bar[3] and bar[2] and bar[1] and bar;

 

 

Marked as spam
Posted by (Questions: 4, Answers: 13)
Answered on March 20, 2017 9:55 am
0

Ok, pretty sure I’m lost now. Let’s see if I can find my way. You just changed the 3 consecutive days of 2% gain to 48 consecutive hours of….. what exactly? And when you say that when you set the original code to previous 2 days, it skips the current day. My screenshot does indeed show that the signal is only triggered once the three bars of 2% gain have completed. So you don’t get a false signal.

If you need to scan for two consecutive daily bars of 2% gain INCLUDING the current daily bar….

def twoPercentGain = 100 * (close / close[1] – 1) >= 2.0;
def twoBarsOfGain = twoPercentGain[1] and twoPercentGain;
plot scan = twoBarsOfGain;

But if instead you wanted to go with the original specification, 3 consecutive daily bars of 2% gain. But instead you wanted to INCLUDE the 3rd daily bar as the current one…..

def twoPercentGain = 100 * (close / close[1] – 1) >= 2.0;
def threeBarsOfGain = twoPercentGain[2] and twoPercentGain[1] and twoPercentGain;
plot scan = threeBarsOfGain;

( at March 20, 2017 10:38 am)
0
Private answer

sorry i couldnt get back to your earlier as i had some personal issues going on and i wasnt at my computer much at all last week. i got it working, thanks again Pete

Marked as spam
Posted by (Questions: 4, Answers: 13)
Answered on March 29, 2017 4:18 pm
0

You are very welcome. Thanks for participating on the Q&A forum. I’m sure this post will be a great help to many visitors in the future.

( at March 29, 2017 8:35 pm)