How to change color for Falling Knife


Category:
0
0

Hi Pete,

I wonder if you can help me write a script for Intraday 1minute chart for a Falling Knife red candle that drop more than 10% in one candle. Example: XYZ 10:30 open candle is $0.99, high 1.00, low is 0.85, closed 0.89 So, between the high $1, closed $0.89 which drop more than 10% in that 1 candle. Are you able to help me write a code that this candle can change into a different color?

Thank you so much

Jin

 

Marked as spam
Posted by (Questions: 3, Answers: 5)
Asked on October 18, 2020 1:48 pm
78 views
1
Private answer

Pretty sure this should work. I did not test it because the stocks I follow would never exhibit this behavior unless the world were coming to an end. And the example you provided was fictitious so I had nothing to use to test it. In the future please be sure to include real world examples so that we can at least test this before trying to provide a solution.

input percentThreshold = 10.0;
def percentChange = 100 * (close / high - 1);
DefineGlobalColor("signal", Color.YELLOW);
AssignPriceColor(if percentChange < -percentThreshold then GlobalColor("signal") else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4079)
Answered on October 18, 2020 4:35 pm
0
Hi Pete, I have just tested the code, it doesn’t work. Yes i have an example for you. But reply comment unable to attach images. If you check the stock symbol ”HTZ” date 10/16/2020 Intraday chart. Market hour and the big big red candle on 9:34am from 2.74 high closed 2.42 which it drops more than 10% in that candle, when I insert the code, the candle doesn’t turn yellow, it still remains gray color throughout the entire chart. Also, can you change this DefineGlobalColor(”no signal”, Color.GRAY); to regular candle stick only only change color to Yellow if it drop 10% or more in one candle. Thanks
( at October 18, 2020 5:12 pm)
0
Thank you for providing a real world example. I have updated the code in my answer to provide a solution that fits the example you provided.
( at October 18, 2020 6:01 pm)
0
It works, thanks so much Pete. I also purchased your Volume Profile, and one of Scanner u build for me few months ago they works out great.
( at October 18, 2020 6:22 pm)