How can I get information about current time frame from the chart and convert this value into string? Because I need to read some special information from files for each times frames, and users can choose time frame on the chart.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Get current time frame from chart
Collapse
X
-
Get current time frame from chart
Dear friends.
How can I get information about current time frame from the chart and convert this value into string? Because I need to read some special information from files for each times frames, and users can choose time frame on the chart.Tags: None
-
Originally posted by daglas View PostDear friends.
How can I get information about current time frame from the chart and convert this value into string? Because I need to read some special information from files for each times frames, and users can choose time frame on the chart.
Comment
-
public string TF_TO_STR_PARSER(BarsPeriodType _tf_type, int _tf_magnitude)
{
/*
BarsPeriodType.Second --- 3
BarsPeriodType.Minute --- 4
BarsPeriodType.Day --- 5
BarsPeriodType.Week --- 6
BarsPeriodType.Month --- 7
BarsPeriodType.Year --- 8
*/
string tf_str = "";
if(_tf_type == BarsPeriodType.Tick)
{
tf_str = "TICK";
}
else if(_tf_type == BarsPeriodType.Second)
{
tf_str = "SEC";
}
else if(_tf_type == BarsPeriodType.Minute)
{
tf_str = "MIN";
}
else if(_tf_type == BarsPeriodType.Day)
{
tf_str = "DAY";
}
else if(_tf_type == BarsPeriodType.Week)
{
tf_str = "WEEK";
}
else if(_tf_type == BarsPeriodType.Month)
{
tf_str = "MONTH";
}
else if(_tf_type == BarsPeriodType.Year)
{
tf_str = "YEAR";
}
else
{
tf_str = "ERR";
}
return _tf_magnitude.ToString() + " " + tf_str;
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
26 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
19 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
93 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
164 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
170 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment