Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CandleOutlineBrushes versus ChartBars.Properties.ChartStyle.Stroke.Brush

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

    CandleOutlineBrushes versus ChartBars.Properties.ChartStyle.Stroke.Brush

    What is the difference between doing this:

    for (int bars = ChartBars.FromIndex; bars >= ChartBars.ToIndex; bars--)
    {
    CandleOutlineBrushes[barIndex] = myBrush;
    }


    and this:

    ChartBars.Properties.ChartStyle.Stroke.Brush = myBrush;
    ChartBars.Properties.ChartStyle.Stroke2.Brush = myBrush;



    I found that when I do this:
    CandleOutlineBrushes[barIndex] = Color.Transparent;
    and then click on the 'Open Data Series' button, I get an exception from Ninja (see attached trace). This did not happen in NT 7.

    I used both the above techniques in NT 7 but it seems something has changed.
    The desired result is to make the normal candle stick elements totally transparent when user spreads out bars and then switch back to be normal candles when user scrunches up the bars.

    So I am wondering what is the recommended technique for NT 8?


    Thanks,
    Gary
    Attached Files

    #2
    In one, you're changing the outline for each candle individually, in the second you're changing the brush that is used to draw all the candles. If your goal is to change all candles, you could just use the ChartStyle approach.

    I'm not certain if I follow your logic, and I can't reproduce. Can you post full code which compiles and reproduces the error?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Request for change

      I think I found the problem. In my code, I was calling:
      BarBrushes[0] = Brushes.Transparent;
      rather than
      BarBrushes.Set(index, Brushes.Transparent);
      because I saw that it was a BrushSeries and assumed you all had changed it to be Series<Brush>) like you did for DataSeries.

      This is confusing and I think it is a mistake to leave it as is.

      First of all, the code: BarBrushes[0] = brush compiles but apparently does not work the same as the BarBrushes.Set(0, brush).
      Second, it is confusing and I think I will not be the first person to be a bit surprised by this difference.

      You all changed DataSeries to Series<double>, and this was brilliant. I have used this ability a lot already for other data structures. Why not go all the way and change them to be Series<Bar> rather than BarSeries or Series<Time> rather than TimeSeries?

      My 2 cents.

      Gary

      Comment


        #4
        BarBrushes this[int barsAgo] calls Set internally, the difference being it's reference a Bars.CurrentBar - barsAgo, where as .Set is an absolute index value. I would not expect BarBrushes[0] to work through the loop you provided.

        If you rather called:

        Code:
        for(int i = ChartBars.FromIndex; i <= ChartBars.ToIndex; i++)
        {
        	BarBrushes[[B]Bars.CurrentBar - i[/B]] = Brushes.Green;
        }
        It would work the same as .Set(). I guess I'm still not completely following you if you can elaborate on why you thought setting the barsAgo value would work the same as the index value, or how making a Series<Bar> would provide some sort of solution in this area, I'll be happy to pass you words off to development to consider.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 05:44 AM
        0 responses
        5 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Working...
        X