Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to use transparency to overlay an indicator on candlestick chart?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to use transparency to overlay an indicator on candlestick chart?

    I have a modified version of the Heiken Ashi indicator which I would like to overlay on the candlestick chart in panel 1 in such a way as to see both the original candlesticks and the modified candles produced by the indicator. I have tried to use code such as:



    Color color = close[0] >= open[0] ? Color.RoyalBlue : Color.DeepPink, barcolor = Color.FromArgb(100, color.R, color.G, color.B);


    DrawLine(CurrentBar.ToString() + "shadow", 0, high[0], 0, low[0], barcolor, DashStyle.Solid, 1);

    DrawLine(CurrentBar.ToString() + "body", 0, open[0], 0, close[0], barcolor, DashStyle.Solid, width);

    where the high, low, close and open are DataSeries objects containing my modified High, Low, Open and Close. Yet, when I apply this indicator to the chart, all I see are my semi-transparent modified candles. The original candlesticks on which I would like them to overlay are no longer visible. How can I restore them? Thank you.

    #2
    clksoft,

    Suggest you comment out the painting routine for your indicator and leave it blank. When applied to a chart you should see the bars. Ensure this is the case and if so then it is likely that the colors you are using is blocking the original bars. If not, then you will want to slowly debug to find which line of code exactly is the one blocking the painting of the original bars.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you. I tried your suggestion and still don't see the bars. After searching a little more I see that the problem is caused by these 3 lines of code in the onbarupdate() method.


      ChartControl.ChartStyle.DownColor = Color.Transparent;
      ChartControl.ChartStyle.UpColor = Color.Transparent;
      ChartControl.ChartStyle.Pen = new Pen(Color.Transparent);
      Last edited by clksoft; 12-15-2009, 09:46 AM.

      Comment


        #4
        Yes. You have set the original bars to all be transparent there.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          One final question, how can I query the original bar width?

          Comment


            #6
            clksoft,

            Unfortunately that is not supported.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            21 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X