# PriceOsc

0
0

Hahn,

I want to kind of change the code of PriceOsc, so that this formula

plot PriceOsc = (MovingAverage(averageType, price, fastLength) – MovingAverage(averageType, price, slowLength))/”A”;

and I want to input “A” = 1 if price <100 or “A” = 10 if price >100

Thank you so much for your help,

Marked as spam
Posted by (Questions: 4, Answers: 5)
Asked on February 22, 2019 10:22 am
17 views

And can you also make it 4 distinct colors instead of the mix color like this picture

( at February 22, 2019 10:36 am)

I really don’t have a clue what you are requesting here. I read your request several times and have come up blank. Please provide more details.

( at February 27, 2019 12:26 pm)

Hahn,
I just want to add the if function for the formula
PriceOsc = (MovingAverage(averageType, price, fastLength) – MovingAverage(averageType, price, slowLength))/”A”; if price>100 then A=10, else A=1.
Secondly, when you look at the picture. There is a part with the mix color of yellow and red(the 2 main colors). I want to have like a 4 distinct colors to indicate Oversold, Overbought, above 0 and below 0.
Thank you so much Hahn,

( at February 28, 2019 2:09 pm)
( at March 14, 2019 9:04 am)
 ▲ 0 ▼ ✔ Private answer Just click create new study and paste this, it doesn’t do anything unless the close price is greater than 100 then it divides the PriceOsc by 10, which I don’t helps any?   declare lower; input colorNormLength = 14; input fastLength = 9; input price = close; input slowLength = 18; input averageType = AverageType.SIMPLE; def A; if price <= 100 then { A = 1; } else if price > 100 then { A = 10; } else { A = 1000; } ; plot PriceOsc = (MovingAverage(averageType, price, fastLength) – MovingAverage(averageType, price, slowLength)) / A; plot ZeroLine = 0; PriceOsc.DefineColor(“Highest”, Color.YELLOW); PriceOsc.DefineColor(“Lowest”, Color.LIGHT_RED); PriceOsc.AssignNormGradientColor(colorNormLength, PriceOsc.Color(“Lowest”), PriceOsc.Color(“Highest”)); ZeroLine.SetDefaultColor(GetColor(8)); Marked as spam Posted by nick bean (Questions: 6, Answers: 9) Answered on March 14, 2019 9:11 am