Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volume Delta by Gill (Paint bars coding help)

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

    Volume Delta by Gill (Paint bars coding help)

    The indicator can be found here:
    This is a volume delta indicator based on BidAsk that I have been using for a while and that is not easily accessible to NT8 non-licensed users. Among the different setups, cumulative delta can be enabled as well as cumulative delta divergence detection. Divergences are represented on main price panel.


    I thought it'd be useful to have a "paintbar" option for this indicator, I've never successfully coded in NT, that being said.
    Can this be easily added, I think so. Yet I'm not skilled enough to figure this out at the moment.

    Some help or someone willing to take on the task at hand is appreciated.

    To be clear, the bar type simple draws the same color as what the indicator fires off. Not a custom bar type, simply color the candle/bar uptop as the indicator shows below.

    This is a volume delta indicator based on BidAsk that I have been using for a while and that is not easily accessible to NT8 non-licensed users. Among the different setups, cumulative delta can be enabled as well as cumulative delta divergence detection. Divergences are represented on main price panel.

    #2
    Hello elvisuptown,

    Thank you for your post.

    Sure, the easiest way to paint the bars the same color as the bars the indicator makes would be to simply set BarBrush to the same thing the PlotBrushes[3] gets set to:

    Code:
    if (CumulativeDelta)
    {
    if (delta_close[0] > delta_close[1]) PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.LimeGreen;
    else if (delta_close[0] < delta_close[1]) PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Red;
    else PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.Orange;
    }
    else
    {
    if (delta_close[0] > 0) PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.LimeGreen;
    else if (delta_close[0] < 0) PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Red;
    else PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Orange;
    }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello elvisuptown,

      Thank you for your post.

      Sure, the easiest way to paint the bars the same color as the bars the indicator makes would be to simply set BarBrush to the same thing the PlotBrushes[3] gets set to:

      Code:
      if (CumulativeDelta)
      {
      if (delta_close[0] > delta_close[1]) PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.LimeGreen;
      else if (delta_close[0] < delta_close[1]) PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Red;
      else PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.Orange;
      }
      else
      {
      if (delta_close[0] > 0) PlotBrushes[3][0][B] = BarBrush =[/B] (Brush) Brushes.LimeGreen;
      else if (delta_close[0] < 0) PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Red;
      else PlotBrushes[3][0] [B]= BarBrush =[/B] (Brush) Brushes.Orange;
      }
      Please let us know if we may be of further assistance to you.
      Thank you Ninja Kate, that was quick, cheers.

      Added the rest I wished for, posted if it's useful to someone.
      This will paint the bar Lime Green if the current bars close is higher than the previous bars close & if the deltaVolume is green, and vice versa. Otherwise the candle's color will be the default Orange.

      Code:
      {
      if (delta_close[0] > delta_close[1] & Close[0] > Close[1]) PlotBrushes[3][0] = BarBrush = (Brush) Brushes.LimeGreen;
      else if (delta_close[0] < delta_close[1] & Close[0] < Close[1]) PlotBrushes[3][0] = BarBrush = (Brush) Brushes.Red;
      else PlotBrushes[3][0] = BarBrush = (Brush) Brushes.Orange;
      }
      else
      {
      if (delta_close[0] > delta_close[1] & Close[0] > Close[1]) PlotBrushes[3][0] = BarBrush = (Brush) Brushes.LimeGreen;
      else if (delta_close[0] < delta_close[1] & Close[0] < Close[1]) PlotBrushes[3][0] = BarBrush = (Brush) Brushes.Red;
      else PlotBrushes[3][0] = BarBrush = (Brush) Brushes.Orange;
      }
      Thank you also Gill, for the public code.

      Comment


        #4
        Ran into an issue, a bar will paint orange though I assumed the criteria is met; (should have printed a lime.green bar)
        suspect it's the PlotBrushes[3] [0]?

        EDIT: Ah it's not the culprit, the lines containing Close[0] < Close[1] aren't calculating price, it's calculating the indicator close.

        Attached a screenshot, would be cool to fix that
        Note the DeltaClose is orange, which will paint the bar type orange, though in this case it should be the ole lime.green.
        Click image for larger version  Name:	2022-09-10_10-06-10.jpg Views:	0 Size:	6.7 KB ID:	1215035
        Last edited by elvisuptown; 09-10-2022, 09:05 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,234 views
        0 likes
        Last Post xiinteractive  
        Working...
        X