Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Custom Candle Paint Bar

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

    Custom Candle Paint Bar

    Hi, I’d like to make a custom paint bar indicator that uses only the body of the candle (no wick), super thin and can be placed either on the left, right, or middle of the bar. Some indicators like for footprint allow you to use what’s called paint bars which do just that. Does anyone know of any indicators like this or can point me in the right direction?

    thanks

    #2
    Hello the_soloist,

    Thank you for your post.

    Can you clarify, are you trying to change the color of the bar, or draw an object to the left/right/middle of the bar?

    BarBrush will allow you to change the color of a price bar's body. CandleOutlineBrush will change the color of the outline of a candlestick.

    BarBrush - https://ninjatrader.com/support/help...8/barbrush.htm

    CandleOutlineBrush - https://ninjatrader.com/support/help...tlinebrush.htm

    Below is a list of all the Drawing methods you can use to draw different objects on the chart.


    If you want to draw to the left or the right of the bars, you will need to use custom rendering.

    Using SharpDX for Custom Chart Rendering - https://ninjatrader.com/support/help..._rendering.htm

    Please let me know if I can assist further.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello the_soloist,

      Thank you for your post.

      Can you clarify, are you trying to change the color of the bar, or draw an object to the left/right/middle of the bar?

      BarBrush will allow you to change the color of a price bar's body. CandleOutlineBrush will change the color of the outline of a candlestick.

      BarBrush - https://ninjatrader.com/support/help...8/barbrush.htm

      CandleOutlineBrush - https://ninjatrader.com/support/help...tlinebrush.htm

      Below is a list of all the Drawing methods you can use to draw different objects on the chart.


      If you want to draw to the left or the right of the bars, you will need to use custom rendering.

      Using SharpDX for Custom Chart Rendering - https://ninjatrader.com/support/help..._rendering.htm

      Please let me know if I can assist further.
      Thank you, Yeah I'm trying to do both but also make them thinner. So they look like this:

      Comment


        #4
        Hello,

        You can change the bar width by right-clicking within the chart > Data Series > change the 'Bar width' property.

        You can also access it programmatically within an indicator using ChartBars.Properties.ChartStyle.BarWidth:

        ChartBars - https://ninjatrader.com/support/help.../chartbars.htm
        ​Properties - https://ninjatrader.com/support/help...properties.htm

        Please let us know if you have any other questions.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Ok got it. In regards to SharpDX, would you have any suggestions on how to implement it in the code below:

          Code:
          #region Using declarations
          
          using System;
          
          using System.Collections.Generic;
          
          using System.ComponentModel;
          
          using System.ComponentModel.DataAnnotations;
          
          using System.Linq;
          
          using System.Text;
          
          using System.Threading.Tasks;
          
          using System.Windows;
          
          using System.Windows.Input;
          
          using System.Windows.Media;
          
          using System.Xml.Serialization;
          
          using NinjaTrader.Cbi;
          
          using NinjaTrader.Gui;
          
          using NinjaTrader.Gui.Chart;
          
          using NinjaTrader.Gui.SuperDom;
          
          using NinjaTrader.Gui.Tools;
          
          using NinjaTrader.Data;
          
          using NinjaTrader.NinjaScript;
          
          using NinjaTrader.Core.FloatingPoint;
          
          using NinjaTrader.NinjaScript.DrawingTools;
          
          using SharpDX;
          
          #endregion
          
          
          
          
          //This namespace holds Indicators in this folder and is required. Do not change it.
          
          namespace NinjaTrader.NinjaScript.Indicators
          
          {
          
          public class BarBrushTest : Indicator
          
          {
          
          protected override void OnStateChange()
          
          {
          
          if (State == State.SetDefaults)
          
          {
          
          Description = @"Enter the description for your new custom Indicator here.";
          
          Name = "BarBrushTest";
          
          Calculate = Calculate.OnPriceChange;
          
          IsOverlay = true;
          
          DisplayInDataBox = true;
          
          DrawOnPricePanel = true;
          
          DrawHorizontalGridLines = true;
          
          DrawVerticalGridLines = true;
          
          PaintPriceMarkers = true;
          
          ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
          
          //Disable this property if your indicator requires custom values that cumulate with each new market data event.
          
          //See Help Guide for additional information.
          
          IsSuspendedWhileInactive = true;
          
          }
          
          else if (State == State.Configure)
          
          {
          
          }
          
          }
          
          
          
          
          protected override void OnBarUpdate()
          
          {
          
          if (CurrentBar < 10)
          
          return;
          
          
          
          if (Close[0] > Open[0])
          
          BarBrush = Brushes.DodgerBlue;
          
          CandleOutlineBrush = Brushes.Transparent;
          
          
          
          if (Close[0] < Open[0])
          
          BarBrush = Brushes.Red;
          
          CandleOutlineBrush = Brushes.Transparent;
          
          }
          
          }
          
          }
          
          
          ​

          Comment


            #6
            Hello,

            It depends on what you would like to render using SharpDX. Are you trying to render a line, shapes, text?

            Take a look at the 'SampleCustomRender' indicator in the platform which demonstrates using SharpDX. You can look at the code for it in the NinjaScript Editor.

            Please let us know if you have any other questions.
            Gaby V.NinjaTrader Customer Service

            Comment


              #7
              Ok cool thanks for your help. Yeah I’m just trying to simply move the candles to the right side of the bar.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Segwin, 05-07-2018, 02:15 PM
              14 responses
              1,789 views
              0 likes
              Last Post aligator  
              Started by Jimmyk, 01-26-2018, 05:19 AM
              6 responses
              837 views
              0 likes
              Last Post emuns
              by emuns
               
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,294 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              13 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              63 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X