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

BarsType

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

    BarsType

    Hello,

    I´m using for years my simple indicator showing me the instrument and the period directly in the chart.

    DrawTextFixed("Instrument", Instrument.MasterInstrument.Name.ToString() + ", " + BarsPeriod.Value, + BarsPeriod.BarsType, TextPosition.BottomLeft,Color.Black, new Font ("Arial",10), Color.Black,Color.White,10);

    When adding here the BarsType I get errormessages when compiling whatever I try from the link https://ninjatrader.com/support/help...barsperiod.htm

    Thank you!
    Tony


    #2
    Hello tonynt,

    Are you trying to use DrawTextFixed directly from the BarsType or are you trying to use the Instrument object?

    Drawing objects specifically would not be able to be used in a BarsType, a BarsType is not meant to render anything.

    The instrument would also need to be found using the Bars object which comes in from Add.

    Code:
    bars.Instrument.MasterInstrument
    Because this is not a supported/documented concept for 7 you could refer to the Documents\NinjaTrader 7\bin\Custom\Type\@BarsTypes.cs file for some examples of existing bars types and how they access Instrument properties.

    Indicators and BarsTypes are not equal in how they work and do not share alike properties so a majority of the code used in Indicators will not work here. If the goal is to render text for the BarsType that would not be able to be accomplished from the BarsType, you could use either a ChartStyle to custom render based on bar data or an indicator as you are now. BarsTypes and ChartStyles are not documented for NT7 so there is not much that I can provide for help content on this subject, you can review the @BarsTypes.cs file and @ChartStyles.cs file.







    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. Sorry, but I have no idea what you mean and what is not able.

      I have my indicator working for years and in OnBarUpDate I have
      DrawTextFixed("Instrument", Instrument.MasterInstrument.Name.ToString() + ", " + BarsPeriod.Value, TextPosition.BottomLeft,Color.Black, new Font ("Arial",10), Color.Black,Color.White,10);
      which is plotting OK.

      I simply want to add that behind the "...Value" it shows "Minute" or "Day" or "Range" or "Ticks" (from the dataseries used in that chart)

      Thank you!
      Tony

      Comment


        #4
        Hello tonynt,

        Are you asking to use the drawing in a BarsType? A BarsType cannot use drawing objects if so.

        If you want to access the BarsPeriod you would need to view how the other BarsType utilize that value in their code.

        bars.Period

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 02:12 AM
        7 responses
        30 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by guillembm, Yesterday, 11:25 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by junkone, 04-21-2024, 07:17 AM
        10 responses
        148 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        6 responses
        101 views
        0 likes
        Last Post tsantospinto  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        7 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X