Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Bar Type

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

    Custom Bar Type

    Hi

    I wanted to create a kind of bar where wicks would be replaced by a candle body.
    Or in another word, replace open and close by high and low.

    This would be a kind of Market profile bar, without letters.

    I thought that it would be enough to replace the OnDataPoint function and I did this:

    Code:
    protected override void OnDataPoint(Bars bars, double open, double high, double low, double close, DateTime time, long volume, bool isBar, double bid, double ask)
            {
                if (SessionIterator == null)
                    SessionIterator = new SessionIterator(bars);
    
                if (bars.Count == 0)
                    AddBar(bars, high, high, low, low, TimeToBarTime(bars, time, isBar), volume);
                else if (!isBar && time < bars.LastBarTime)
                    UpdateBar(bars, high, low, low, bars.LastBarTime, volume);
                else if (isBar && time <= bars.LastBarTime)
                    UpdateBar(bars, high, low, low, bars.LastBarTime, volume);
                else
                {
                    time        = TimeToBarTime(bars, time, isBar);
                    AddBar(bars, high, high, low, low, time, volume);
                }
            }​
    I derived this kind of bar from the MinuteBarsType and set a value of 30mn for period.

    However I can'y understand why wicks are still appearing on bars ?

    Can you help on this problem ?
    Attached Files

    #2
    Hello Philippe56140,

    From the image alone you wouldn't really be able to tell what happened, you would need to review the data box or use a script to output the OHLC of each bar to better understand why some bars still have wicks. Alternatively you would have to add prints into the bars type to see when the bar values are for each data point.

    Comment


      #3
      Why not just use OHLC Chart Style with HiLo Mode?
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        Alternatively, you can use Box Chart Style.

        Comment


          #5
          Thanks for theses two last options, eDanny and aligator, this is largely satisfying

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          612 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          355 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          561 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          564 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X