Alert from scan using daily stochastic and 15 min pullback


0
0

Hi Pete,

I have a general question.  I tried searching through the other posts but couldn’t find anything similar.

I followed your video and built an alert from a custom scan.  My scan is to look for stocks where 1) the daily stochastic crosses above 20% and 2) there is a pullback on the 15 minute candlestick chart.  So say I get an alert today because the daily stochastic moved from 15% to 25% and there was a pullback on the 15 min candlestick chart.  Tomorrow the daily stochastic opens above 20%, but there is another pullback on the 15 min chart.  Will I receive an alert tomorrow being that the daily stochastic is above 20% but it won’t technically “cross” above 20% tomorrow?

Thank you

Editor’s note: Please be clear and concise when entering the title of your questions. “Scans Alert” is far to vague to be of any use to other viewers. The title and URL of this post has been adjusted to better reflect it’s context and make it easier for others to search and find a solution.

Marked as spam
Posted by (Questions: 3, Answers: 5)
Asked on October 2, 2017 12:28 pm
533 views
0

Your question is far from ‘general’. In order for me to answer this question you are going to have to provide more details. There is no way for me to tell how your scan is going to behave without seeing the code. In the mean time, I will take a stab at it and say that your second day stochastic opens above 20 and therefore there is no cross. No alert. But without seeing the code I am making some big time assumptions.

( at October 2, 2017 7:14 pm)
0
Private answer

Hi Pete,  sorry about that. The scan below is for the stochastic and the one below that is for the pullback.

STOCHASTIC SCAN
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = { “No”, default “On FullK”, “On FullD”, “On FullK & FullD”};
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC – lowest_k;
def c2 = Highest(priceH, KPeriod) – lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);
def OverBought = over_bought;
def OverSold = over_sold;
def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;
def UpSignal;
def DownSignal;
switch (showBreakoutSignals) {
case “No”:
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case “On FullK”:
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case “On FullD”:
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case “On FullK & FullD”:
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}
# use this to scan for bullish signals
#plot scan = !IsNaN(UpSignal);
# use this to scan for bearish signals
plot scan = UpSignal == OverSold;

PULLBACK SCAN
#Wizard text: The
#Wizard input: price
#Wizard text: has
#Wizard input: Choice
#Wizard text: over the last
#Wizard input: length
#Wizard text: consecutive bars

input price = close;
input length = 3;
input Choice = {default “increased”, “decreased”};
plot scan;

switch (Choice){
case “increased”:
scan = sum(price > price[1], length) == length;
case “decreased”:
scan = sum(price < price[1], length) == length;
}

Thank you

Marked as spam
Posted by (Questions: 3, Answers: 5)
Answered on October 3, 2017 4:02 am
0
Private answer

Ok, now that we have the full code used in the scan I can provide a bit more details. The scan based on Stochastic picks up ONLY the cross of the OverSold or OverBought line. For the UpSignal scan, the FullK must begin under the OverSold line and then cross above it. Once this is triggered the signal cannot occur again until the FullK resets the condition by moving back below OverSold. Likewise for the DownSignal in relation to the OverBought line.

You did not ask this question, but it was implied in your description. How can I modify the Stochastic scan so that I continue to get alerts on 15 min pullbacks after the UpSignal has triggered.

The easiest way is to simply replace:

plot scan = UpSignal == OverSold;

With…

plot scan = FullK > OverSold;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 3, 2017 8:13 am
0
Private answer

Thank you!

Marked as spam
Posted by (Questions: 3, Answers: 5)
Answered on October 3, 2017 11:32 am