Hi,
I am looking for an histogram indicator which provides bars when price moves by a multiple of its average true range over a certain number of days ie if the average true range is 5c and there is a current price range of 10c in the last 10 days then a spike bar will appear.
Any assistance would be appreciated.
Jonathan
JSParticipant
Senior
ATR = AverageTrueRange[n](Close)
xSpike = (Range / ATR)
//If xSpike < 2 then
//xSpike = 0
//EndIf
Return xSpike style (Histogram) as "xSpike"
Hi
@jwh145
I used the “Range” here divided by the “ATR”.
You can have this drawn in a histogram and if you only want to have a ratio greater than, for example, two than:
xSpike = Range / ATR
If Range/ATR < 2 then
xSpike = 0
EndIf
Hi JS,
Thanks for your help on this, much appreciated.
Do you know if there is a way to color the bar say RED if it was lower close than open and Green if higher close than open?
Cheers
Jono
JSParticipant
Senior
ONCE n = 10
ATR = AverageTrueRange[n](Close)
xSpike = (Range / ATR)
If xSpike < 2 then
xSpike = 0
EndIf
If Close < Open then
R=255
G=0
B=0
else
R=0
G=255
B=0
EndIf
Return xSpike Coloured (R,G,B) style (Histogram) as "xSpike"
Hi JS,
Do you happen to have or could provide code that screens for tickers up or down a certain % over a lookback period, eg up 25% over last 20 days?
I can’t seem to see any screeners like this in the library.
Jono
JSParticipant
Senior
xPeriod = 20 //20 days
xGain = 25 //25%
Signal = 0
If (Close - Close[xPeriod])/Close[xPeriod]*100 >= xGain then
Signal = 1
EndIf
SCREENER[Signal](Signal as "1 = LONG")
Hi
@jwh145
Try this one…