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 burtoninlondon, Today, 12:38 AM
        0 responses
        5 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        12 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        13 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,982 views
        3 likes
        Last Post jhudas88  
        Working...
        X