Can I draw OsMA ( or MACD, etc) as -100~+100%?
Forums › ProRealTime English forum › ProBuilder support › Can I draw OsMA ( or MACD, etc) as -100~+100%?
- This topic has 9 replies, 2 voices, and was last updated 2 years ago by lashanta92.
-
-
01/23/2022 at 6:06 PM #186372
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…
01/24/2022 at 4:03 PM #186468I 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?
01/24/2022 at 5:29 PM #186489Thank 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
01/25/2022 at 8:52 AM #186540Your code seems to work, it ranges -100 to +100:
12345var1 = ExponentialAverage[12](close) - ExponentialAverage[26](close)var2 = average[9](var1)mao = var1 - var2var4 = max(abs(highest[200](mao)),abs(lowest[200](mao)))return mao * (100 / var4) AS "mao",+100 AS "+100",-100 AS "-100"01/26/2022 at 1:09 AM #186633Thank you replying.
I remade it using DrawOnLastBarOnly and drawsegment
It’s a little heavy.
12345678910DEFPARAM DRAWONLASTBARONLY = trueDEFPARAM calculateonlastbars = 300var1 = ExponentialAverage[short](close) - ExponentialAverage[long](close)var2 = Average[sma](var1)mao = var1 - var2maxabs100 = max(abs(highest[100](mao)), abs(lowest[100](mao)))for i = 0 to bars-1 doDRAWRECTANGLE(barindex-i, 0, barindex-i-1, mao[i] * 100 / maxabs100) coloured(0,255,255,255)nextreturn -100,100, (Williams[14](close)+50) * 2 , -60, 6001/31/2022 at 12:36 PM #187119Sorry 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.01/31/2022 at 1:13 PM #187121This the official explanation https://www.prorealcode.com/documentation/islastbarupdate/.
01/31/2022 at 2:10 PM #187122Thank 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?01/31/2022 at 2:30 PM #187123Try this indicator:
1Return IsLastBarUpdate01/31/2022 at 2:38 PM #187124OK I’m understanding it
It may be useful for my indicator.
Thank you. -
AuthorPosts