How to show a 15% pullback from High of day Price?


Category:
0
0

Hey Pete, Im lost on coding this and need your help.

 

#First condition – stock must have spiked over 60% on the day

Condition= the %change from yesterdays close to todays HOD must be greater than 60%

 

Next, if the stocks pulls back more than 15% from its (Intraday HOD) Aka prints a close price less% below HOD price after the HOD……

#PullbackShowBubble

Then plot a RED chart bubble on the current candles close called “15% pullback”

Marked as spam
Posted by (Questions: 7, Answers: 3)
Asked on December 15, 2020 2:56 pm
122 views
0
Private answer

It would have been very good if y0u had included an example that I could use for testing. Very tough to find stocks that match this pattern.

Here is the code I believe will work as requested. I have no idea whether it does.

input percentGain = 60.0;
input percentRetrace = 15.0;
plot priorDayClose = close(period = AggregationPeriod.DAY)[1];
priorDayClose.SetDefaultColor(Color.GRAY);
priorDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def newDay = GetDay() <> GetDay()[1];
rec trackHighOfDay = if newDay then high else if high > trackHighOfDay[1] then high else trackHighOfDay[1];
plot highOfDay = trackHighOfDay;
highOfDay.SetDefaultColor(Color.CYAN);
highOfDay.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def gain = 100 * (high / priorDayClose - 1);
def retrace = 100 * (close / highOfDay - 1);
rec hasRetraced = if newDay then 0 else if gain > percentGain and retrace < -percentRetrace then 1 else hasRetraced[1]; def signal = hasRetraced and !hasRetraced[1]; AddChartBubble(signal, low, Concat(percentRetrace, "% Pullback"), Color.RED, no);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 15, 2020 4:04 pm
0
Sorry, U rock !!! I will test and provide examples. One example today was $ANCN today
( at December 15, 2020 4:23 pm)
0
Yep, that example was absolutely essential. I tested the code against that and immediately identified a problem that need to be adjusted. I have updated the code in my answer to correct the error. You will need to copy this code and replace what you had copied before my correction.
( at December 15, 2020 5:10 pm)
0
Its almost perfect, but the value should not factor in premarket high. Only the High of day after 9:30 am. Another example is EDSA on July 30 2020. It shows on the 5 minute but doesn’t show on the 1 minute chart after the drop from HOD I also noticed on IMRN on 6/12/20 its is grapping many highs. ***CODE should only grab the highest high of day please.***
( at December 15, 2020 8:19 pm)
0
Sorry, this solution is the most I can provide for no charge in the Q&A Forum. This code requires that you set the chart to not included extended hours session. In order to provide a solution that works with extended hours session requires much more complexity.
( at December 15, 2020 9:59 pm)