Eeee, how do you get 112 from 60, 240, 1440?
OK, I figured this out - it is decimal to hexadecimal conversion, so all I have to do is sum values of wanted timeframes and use that sum as input:
|
Hex |
Decimal |
|
OBJ_NO_PERIODS, EMPTY |
-1 |
|
The object is not drawn in all timeframes |
OBJ_PERIOD_M1 |
0x0001 |
1 |
The object is drawn in 1-minute chart |
OBJ_PERIOD_M5 |
0x0002 |
2 |
The object is drawn in 5-minute chart |
OBJ_PERIOD_M15 |
0x0004 |
4 |
The object is drawn in 15-minute chart |
OBJ_PERIOD_M30 |
0x0008 |
8 |
The object is drawn in 30-minute chart |
OBJ_PERIOD_H1 |
0x0010 |
16 |
The object is drawn in 1-hour chart |
OBJ_PERIOD_H4 |
0x0020 |
32 |
The object is drawn in 4-hour chart |
OBJ_PERIOD_D1 |
0x0040 |
64 |
The object is drawn in day charts |
OBJ_PERIOD_W1 |
0x0080 |
128 |
The object is drawn in week charts |
OBJ_PERIOD_MN1 |
0x0100 |
256 |
The object is drawn in month charts |
OBJ_ALL_PERIODS |
0x01ff |
511 |
The object is drawn in all timeframes |
Still, if any of you would be kind enough to tell how the code would look if I wanted to use timeframe-to-minutes scale (i.e. 60,15,1440), that would be nice.
Best regards,
Simon
Just detect which timeframe and assign appropriately.
Just convert it, let say h1 = 60 minutes. There are many ways to do the logic.
Just detect which timeframe and assign appropriately.
Just convert it, let say h1 = 60 minutes. There are many ways to do the logic.
Thank you, but I am learning to program on the go, so some more specific answer would be appreciated.
Anyway, I was thinking and one solution would be a code that would:
- read the input line and sum all parameters that are there
- use that sum and insert it as PlotOnTimeframes value
That is:
input int PlotOnTimeframes = 60, 240, 1440; ... read PlotOnTimeframes values and sum = 60 + 240 + 1440 = 1740 convert to hexadecimal and pass to PlotOnTimeframes values in the code
Now I need to figure it out how to sum those values. Any hint would be welcome...
Best regards,
Simon
input int PlotOnTimeframes = 60, 240, 1440;
Now I need to figure it out how to sum those values. Any hint would be welcome...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello!
I have a script, which plots data from .csv, as vertical lines with (or without) text. At the script start, I would like to be able to select timeframes that those vertical lines (and text) should be plotted on. Like:
input int PlotOnTimeframes = 60, 240, 1440;
csv is in this format:
1990.07.08 00:00, Ch 000 Sa
1990.07.21 00:00, Ch 180 Sa
etc...
yyyy.mm.dd hh:mm, text
I tried replacing all instances of 'OBJ_PERIOD_H4 | OBJ_PERIOD_D1 | OBJ_PERIOD_H1' with 'PlotOnTimeframes', and it works, just, when I run the script and input window pops-up, the last input line reads 'PlotOnTimeframes - 112'?
Eeee, how do you get 112 from 60, 240, 1440?
Thank you for your help,
Best regards,
Simon