WoodiesCCI cross above zero after new 30 day low


0
0

There’s two alerts that interest me.

1) Woodies CCI crossing the zero line

2) Stock prices is trading at a 30 day low.

 

I know how to set alerts for both of them separately, however I’m trying to combine them based on timing that of the first time it crosses after hitting the 30 day low.

So how can I code the following:

After stock price has hit a 30 day low, notifiy me the first time the woodies cci crosses the zero line.

 

Is this more advanced than I’m thinking it is?  Any help is appreciated

Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on May 11, 2020 7:52 am
352 views
0
Private answer

I updated the title of your question so that other viewers seeking this solution will be able to find it. The original title you entered was "Trying to create an alert based on timing". However the terms you used there really don't apply and they don't help others searching for a similar solution for this particular indicator. If you wanted to see examples of how we use one condition as the prerequisite for another, there are plenty of examples of that here in the forum.

Here is the code to accomplish what you have requested. There is no timing involved. The code first locates all the bars that fit the first condition, new low in the past 30 bars. We use that condition as the initialization state for the variable named trackPattern. So when a new 30 day low appears, the trackPattern variable is reset to zero. When prices rise from that low, we check each of the bars that follow that low and mark the first one where the WoodiesCCI crosses above zero.

input lookbackBarsForLow = 30;
input shortLength = 6;
input longLength = 14;
input lowerSideWinderLimit = 30.0;
input upperSideWinderLimit = 100.0;
input hideSideWinder = No;
def wCCI = WoodiesCCI(shortLength, longLength, lowerSideWinderLimit, upperSideWinderLimit, hideSideWinder).CCI;
def lowestInLookbackBars = low > 0 and low < Lowest(low[1], lookbackBarsForLow);
rec targetPattern = if lowestInLookbackBars and wCCI < 0 then 0 else if lowestInLookbackBars[1] == 0 and wCCI > 0 then 1 else targetPattern[1];
plot signal = targetPattern and !targetPattern[1];

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 11, 2020 2:57 pm
0
First off, I just want to say thank you for answering my question. I also wanted to let you know that I’m not sure the indicator is working the way I thought it would. For example, I ran the indicator today and one of the symbols I got back was CLTS. It hit a 30 day low in April, however the CCI crossed the zero line within the same month. The CCI appears to be crossing the zero line mark again today, but it has already come down below the zero line and now is going back above it. By the way, my chart and indicator is on the 1 hour time frame, and I changed the Woodies CCI to 25/14/30. I don’t know if that matters but just wanted to tell you my settings.
( at May 13, 2020 9:48 am)
0
The scan is designed to work only on the daily time frame. I you apply it to any other time frame it will find stocks that made a new 30 "bar" low and not a 30 "Day" low.
( at May 13, 2020 9:55 am)
0
Ah! Now I got it! Thank you! Donation coming :)
( at May 13, 2020 10:01 am)
0
So I ran the query using the day time frame and the chart was setup as day. However, I'm still getting some stocks that aren't correct. For example, I got EARN. It was at a low in March, and crossed the zero line in April. It has never gone below the zero line, but I was hoping the indicator would give me ones that hit today. Is this something we can maybe discuss and I can actually hire you to do for me?
( at May 13, 2020 10:46 am)
0
The scan is working perfectly when I just tested it. EARN does NOT appear in my scan results. Something is wrong with the way you have set up your scan.
( at May 13, 2020 12:01 pm)
0
One more question…is it possible to make this scan for the hourly time frame instead of the daily? So if it’s hitting a 30 day low, when the CCI on the hourly goes above zero
( at May 14, 2020 11:11 am)
0
Adjust the user input lookbackBarsForLow to whatever length you need. For hourly time frame you have 7 bars per day. So that would be 30 days times 7. For scans set to an hourly time frame the available historical data is 270 calendar days. So that gives you the limit to how far back you can set that input.
( at May 14, 2020 12:17 pm)