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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment