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

simple string question

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

    simple string question

    Hi, I'd like to see the time of day and the data series in this string, but I'm new and can't get the syntax right. any help appreciated:

    Print ("The slope is: " + Slope(SMA(21), 10, 0)); on the ...chart at ...AM/PM

    #2
    Hello trader3000a,

    Thanks for your post.

    I think you mean the close time of the bar, assuming you want to look back at the chart and know what the slope was on a specific bar.

    If that is the case you can use Time[0] which will present the date and time.

    Print (Time[0]+ " The slope is: " + Slope(SMA(21), 10, 0));

    or

    Print ("The slope is: " + Slope(SMA(21), 10, 0)+ "on the chart at "+Time[0]);

    You may need to add .ToString() to the Slope, like this:

    Print ("The slope is: " + Slope(SMA(21), 10, 0).ToString());
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      thanks Paul. Is there a way to capture the data series of the chart to which my indicator is added, so that i can say "the slope is x at x time on the x(5 minute, for instance) chart?

      Comment


        #4
        Hello trader3000a,

        Thanks for your reply.

        Yes, there are a number of properties you can access:

        For the name of the instrument: Instrument.MasterInstrument.Name Reference: https://ninjatrader.com/support/help...ument_name.htm

        For the bars type: BarsPeriod.BarsPeriodType
        For the bars period: BarsPeriod.Value
        Reference: https://ninjatrader.com/support/help...barsperiod.htm
        (Note that these properties are for standard bar types, if using certain bar types you would need other properties as shown in the help guide link.

        ​​​​​​​
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Nicholewatkinsi, Today, 10:53 PM
        0 responses
        4 views
        0 likes
        Last Post Nicholewatkinsi  
        Started by dward123, 01-02-2024, 09:59 PM
        4 responses
        175 views
        0 likes
        Last Post Lancer
        by Lancer
         
        Started by ETFVoyageur, Today, 04:00 PM
        2 responses
        19 views
        0 likes
        Last Post ETFVoyageur  
        Started by AaronKTradingForum, Today, 03:44 PM
        1 response
        14 views
        0 likes
        Last Post AaronKTradingForum  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        11 responses
        80 views
        0 likes
        Last Post Felix Reichert  
        Working...
        X