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 AnnBarnes, 04-24-2024, 12:17 PM
        2 responses
        19 views
        0 likes
        Last Post tradingfxvps  
        Started by samish18, 04-17-2024, 08:57 AM
        28 responses
        137 views
        0 likes
        Last Post tradingfxvps  
        Started by TradeSaber, Today, 10:33 PM
        0 responses
        3 views
        0 likes
        Last Post TradeSaber  
        Started by saturntd, Today, 10:18 PM
        0 responses
        3 views
        0 likes
        Last Post saturntd  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        123 responses
        2,887 views
        1 like
        Last Post SilverSurfer1  
        Working...
        X