Can I draw OsMA ( or MACD, etc) as -100~+100%?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #186372 quote
    lashanta92lashanta92
    Participant
    New

    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…

    スクリーンショット-2022-01-23-034049.png スクリーンショット-2022-01-23-034049.png
    #186468 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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?

    #186489 quote
    lashanta92lashanta92
    Participant
    New

    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

    #186540 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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"
    #186633 quote
    lashanta92lashanta92
    Participant
    New

    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
    #187119 quote
    lashanta92lashanta92
    Participant
    New

    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.

    #187121 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    #187122 quote
    lashanta92lashanta92
    Participant
    New

    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?

    #187123 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Try this indicator:

    Return IsLastBarUpdate
    #187124 quote
    lashanta92lashanta92
    Participant
    New

    OK I’m understanding it
    It may be useful for my indicator.
    Thank you.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Can I draw OsMA ( or MACD, etc) as -100~+100%?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
lashanta92 @lashanta92 Participant
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by lashanta92lashanta92
4 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/23/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...