Indicator with conditional formated histogram

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16562 quote
    Xerxes
    Participant
    New

    Good morning,

    is there a possibility to get an Indicator as a histogram where several signals have different colours according to there value.

    Thanks in advance!

    #16572 quote
    Nicolas
    Keymaster
    Master

    Yes you need to make 3 different variables with their own color and value.

    Someone did something like this, not so long ago, this is called a “tape” indicator. You can find an example here:  http://www.prorealcode.com/prorealtime-indicators/3-linear-regression-tapes-indicator/

    #16582 quote
    Xerxes
    Participant
    New

    Thank you very much Nicolas,

    unfortunately the command “coloured by” does not work properly for me. The indicator gets calculated but the different colours for positive or negative values are not working if there are more then one output variables (I am using v10.2).

    However here is a solution that works for me. Not nice but who cares 😉

    In this “dummy” example on the top level every second bar will be green every forth bar will be red and the rest will be black. On the bottom level every third bar will be green every sixth bar will be red and the rest will be black.

    // Set each output variable to be shown as histogram
    // Set the correct colour for each output variable (Lev1Black="black", Lev1Green="green"...)
    iBar=IntradayBarIndex
    Lev1Black=0
    Lev1Green=0
    Lev1Red=0
    Level=5
    if (ibar MOD 2 =0) and (ibar mod 4 <>0) then
    Lev1Green=Level
    elsif  ibar MOD 4 =0 then
    Lev1Red=Level
    else
    Lev1Black=Level
    endif
    
    Lev2Black=0
    Lev2Green=0
    Lev2Red=0
    Level=2.5
    if (ibar MOD 3 =0) and (ibar mod 6 <>0) then
    Lev2Green=Level
    elsif  ibar MOD 6 =0 then
    Lev2Red=Level
    else
    Lev2Black=Level
    endif
    return 0 as "Zero",Lev1Black  as "Level-1 (black)",Lev1Green as "Level-1 (green)",Lev1Red as "Level-1 (red)",Lev2Black  as "Level-2 (black)",Lev2Green as "Level-2 (green)",Lev2Red as "Level-2 (red)"
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Indicator with conditional formated histogram


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Xerxes @xerxes Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/15/2016
Status: Active
Attachments: No files
Logo Logo
Loading...