I don't know how to create indicator about bar count numbers (look at image attached). Help me!

To add comments, please log in or register
2TJV
28
2TJV  

Hi Experts,

I have traded for 4 years, but I'm still a novice at programming. I started learning how to write code a couple of days ago so that I can create my indicator for trading purposes. You can see the indicator (look at the image) which I am trying to create. Utilities of the indicator:


  1. At a specific time in the day (I mean every day), it appears number 1 below Low of the bar at that time. You can see in the image, number 1 appears below the Low of the bar at 08:00. We can simply call it is Start Trading Hour. By the way, my main TF is M5.
  2. Then, it does not show a regular sequence of numbers 1, 2, 3, 4, 5,... It shows an even number (2, 4, 6, 8,...) sequence corresponding to the bars after bar number 1.
  3. After 12 bars, the number will change color because there is the time the bar on H1 closed. 12 bars on M5 = 1 bar on H1. So the color of numbers 12, 24, 36,... will be changed.
  4. It keeps going on until a specific time like 20:00 on that day (not yesterday or tomorrow). That is End Trading Hour. After 20:00, it won't appear any numbers.
  5. Tomorrow at the same time 08:00, again... repeat and repeat...

I know I have to ObjectCreate(...), OBJ_TEXT but the time and price... I don't know how to write that...

Thank you so much for helping me!

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
When a graphical object is created using the ObjectCreate() function, it's necessary to specify the type of object being created, which can be one of the values of the ENUM_OBJECT enumeration. Further specifications of object properties are possible using functions for working with graphical objects.
Files:
EURUSDM5.png 22 kb
ASDDA
10
ASDDA  

https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_text

I would start with the example code given there and play with it until it makes sense.

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_TEXT
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_TEXT
  • www.mql5.com
//| Creating Text object                                             |               chart_ID=0,                               sub_window=0,                              time=0,                                      price=0,                                  font_size=10,                          angle=0.0,                ...
2TJV
28
2TJV  
ASDDA:

https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_text

I would start with the example code given there and play with it until it makes sense.

I did like you said but I could not have any ideas to write. That's why I posted a help!

Thank you for helping me, ASDDA!

To add comments, please log in or register