I have a question. I want to reconstruct my MT4 platform (attached img) W%R and OsMA are drawn just as 2 independent layers. But on PRT, they return quite different digit values in the panel.
So I tried to make indicator that always returns highest value of last~200 OsMA For the purpose of multiplying OsMA indicator to be within -/+100 range. but it does not work correctly.
relatedly I need screening condition that tells whether MACD value is near zero(~10%) or not.
Show me a hint please…
I can’t understand what you mean, do you have any code to post as an example?
And what does the code do? and what would you like it to do?
Thank you and sorry for reading my post.
I want to make OsMA indicator return values just within -/+100 for the purpose of display it with W%R indicator on the same panel.
Then I tried to get highest or lowest value of OsMA to enlarge it. (for example, OsMA’s last 200 highest value is 0.5 -> I’ll multiply entire OsMA’s value by 200.)
I made another indicator just gauge it and I called it in my OsMA indicator. Now I understand It’s meaningless.
Now I wrote it.
var1 = ExponentialAverage[12](close) – ExponentialAverage[26](close)
var2 = average[9](var1)
mao = var1 – var2
var4 = max(abs(highest[200](mao)),abs(lowest[200](mao)))return mao * (100 / var4)
Not worse but little shape changed from original line.
Thanks
Your code seems to work, it ranges -100 to +100:
var1 = ExponentialAverage[12](close) - ExponentialAverage[26](close)
var2 = average[9](var1)
mao = var1 - var2
var4 = max(abs(highest[200](mao)),abs(lowest[200](mao)))
return mao * (100 / var4) AS "mao",+100 AS "+100",-100 AS "-100"
Thank you replying.
I remade it using DrawOnLastBarOnly and drawsegment
It’s a little heavy.
DEFPARAM DRAWONLASTBARONLY = true
DEFPARAM calculateonlastbars = 300
var1 = ExponentialAverage[short](close) - ExponentialAverage[long](close)
var2 = Average[sma](var1)
mao = var1 - var2
maxabs100 = max(abs(highest[100](mao)), abs(lowest[100](mao)))
for i = 0 to bars-1 do
DRAWRECTANGLE(barindex-i, 0, barindex-i-1, mao[i] * 100 / maxabs100) coloured(0,255,255,255)
next
return -100,100, (Williams[14](close)+50) * 2 , -60, 60
Sorry for a basic question.
Is “IF IsLastBarUpdate…” means “load only when new candle is made”?
they seem to move tick by tick when I put in line.8 of previous code in it.
Thank you for your replying.
“, 1 time when the indicator is applied on the chart and anytime the last bar on the chart is updated, ”
If it doesn’t mean “when new candle is stood”, what differs from normal way?
There’s no meaning i=1 but not 0 in the sample code?
OK I’m understanding it
It may be useful for my indicator.
Thank you.