R,G,B colours are mixed?

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #105439 quote
    robert123
    Participant
    Master

    Hi there,

    Could anyone help me with the below question, please?

    I am colour coding using R,G, B. This work brilliantly when used in a moving average (as you can see the subtle, changes via the colour changes) but when I transfer the same idea to text it freaks out when these colour changes occur, i.e does recognise x as a spectrum of say blue.

    Has anyone encountered this before?. Is this just something that happens with text?

    TIA

    RR

    #105446 quote
    robertogozzi
    Moderator
    Master

    I never had a chance to spot that issue.

    Can you post an example?

    #105448 quote
    robert123
    Participant
    Master

    Hi Roberto,

    Thank you for your swift reply.

    Below is a snippet of the relevant part of the code. When I change the function to return the ‘returned’ value to text I get an error message the colour x is out of x colours range.

    Hope that makes sense, and thank you for your help.

    diff=exponentialaverage[36](srtl)-srtl
    if diff>0 then
    hi=highest[20](diff)
    elsif diff<0 then
    lo=lowest[20](diff)
    endif
    hig=highest[20](hi)
    loo=lowest[20](lo)
    if srtl>srtr and diff<0 then
    r=250
    g=0
    b=250
    elsif srtl<srtr and diff>0 then
    r=0
    g=255
    b=0
    elsif srtl<srtr and diff<0 then
    r=255
    g=0
    b=0
    endif
    return diff coloured(r,g,b),hig,loo,ExponentialAverage[36](diff)
    #105450 quote
    robertogozzi
    Moderator
    Master

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part!   Thank you! <<

    What are SRTL and SRTR, I get an error messages since they are not defined?

    #105451 quote
    robert123
    Participant
    Master

    SRY!

    Difficult to explain srtl and srtr without putting the whole code in, which is long.. but the problem should show it’s self if you were to use a standard ma or two. It just seems strange that the colouring works in the ‘return’ format but not the text.

    Thanks for your help

    RR

    #105452 quote
    robertogozzi
    Moderator
    Master

    This is the code:

    srtl=close   //just to let it have a value
    srtr=high    //just to let it have a value
    diff=exponentialaverage[36](srtl)-srtl
    if diff>0 then
    hi=highest[20](diff)
    elsif diff<0 then
    lo=lowest[20](diff)
    endif
    hig=highest[20](hi)
    loo=lowest[20](lo)
    if srtl>srtr and diff<0 then
    r=250
    g=0
    b=250
    elsif srtl<srtr and diff>0 then
    r=0
    g=255
    b=0
    elsif srtl<srtr and diff<0 then
    r=255
    g=0
    b=0
    endif
    drawtext("☺",BarIndex, hig+10*pipsize) coloured(r,g,b)
    return diff coloured(r,g,b),hig,loo,ExponentialAverage[36](diff)

     

    and the attached pic is the output.

    What is exactly the issue?

    x-23.jpg x-23.jpg
    #105462 quote
    robert123
    Participant
    Master

    Well, that is interesting!

    Because this is what I get, see below. And it is these colours that a) seem to change from the red/green spectrum to what you see below. B) when the same code is applied to ‘text’ in the price panel it freaks out.

    Do you think a negative number would cause this?

    I like the colour change just not the text freak out!

    RR

    #105464 quote
    robert123
    Participant
    Master

    For some reason, I can’t upload an image. However, the colours change out of the red-green spectrum. There are multiple colours, and I have no idea why.

    #105466 quote
    robert123
    Participant
    Master

    Roberto,

    If you replace the ‘close’ and ‘high’ with 20ema and 100ema you will see the difference.

    RR

    #105475 quote
    robertogozzi
    Moderator
    Master

    My previous two first lines yielded only 2 results, thus one colour was missing (your code has 3 combinations).

    With the two averages, as you suggested, I notice 3 colours, the same for both returned data and text:

    srtl=average[20,1](close)
    srtr=average[100,1](close)
    diff=exponentialaverage[36](srtl)-srtl
    if diff>0 then
    hi=highest[20](diff)
    elsif diff<0 then
    lo=lowest[20](diff)
    endif
    hig=highest[20](hi)
    loo=lowest[20](lo)
    if srtl>srtr and diff<0 then
    r=250
    g=0
    b=250
    elsif srtl<srtr and diff>0 then
    r=0
    g=255
    b=0
    elsif srtl<srtr and diff<0 then
    r=255
    g=0
    b=0
    endif
    drawtext("☺",BarIndex, hig+10*pipsize) coloured(r,g,b)
    return diff coloured(r,g,b),hig,loo,ExponentialAverage[36](diff)

    I still can’t see any issue.

    x-25.jpg x-25.jpg
    #105633 quote
    robert123
    Participant
    Master

    Hi Roberto,

    Indeed there are three colours, however, if you try the indicator out in different timeframes i.e 1 min, you will see that they ‘mix’. It is the mixes that are causing problems in the text.

    RR

    #105634 quote
    robertogozzi
    Moderator
    Master

    Sorry, but it works everywhere for me, in some cases you may see a black line when the indicator overlaps one of the bands, but that’s normal.

    I cannot be of further help. If the problem persists, you’d better press Ctrl+M from the platform to ask for assistance.

    x-26.jpg x-26.jpg
    #105652 quote
    Nicolas
    Keymaster
    Master

    You may feel that they mix when you zoom out a lot?

    #105653 quote
    robert123
    Participant
    Master

    No, that’s not it. They definitely mix, but it depends on the move and the MA’s and timeframe etc. I will take a snapshot when it occurs and post…

    #105655 quote
    Nicolas
    Keymaster
    Master

    Yes please! Without a snapshot, that’s difficult to perfectly understand what you are talking about 😆

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

R,G,B colours are mixed?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robert123 @robert123 Participant
Summary

This topic contains 19 replies,
has 3 voices, and was last updated by robert123
6 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/24/2019
Status: Active
Attachments: 4 files
Logo Logo
Loading...