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 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.
    JesseNinjaTrader Customer Service

    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 PaulMohn, Today, 12:36 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by yertle, Yesterday, 08:38 AM
          8 responses
          36 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by rdtdale, Today, 01:02 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by alifarahani, Today, 09:40 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by RookieTrader, Today, 09:37 AM
          4 responses
          19 views
          0 likes
          Last Post RookieTrader  
          Working...
          X