Print ("The slope is: " + Slope(SMA(21), 10, 0)); on the ...chart at ...AM/PM
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
simple string question
Collapse
X
-
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/PMTags: None
-
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());
-
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
-
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.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
44 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
56 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
35 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
95 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
57 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment