Indicator with multiple start and end times

 
Hi everyone.

Im simply seeking advise from the professionals. I want to build an indicator that changes candlestick colors between 3 different time periods. 
Eg. Between 1am to 7am candles are pink.
Between 8am to 1pm candles are orange.

Is this actually possible? 
If yes - I would greatly appreciate a small example or explanation. I will code the entire indicator  myself.
 
Vengeance SeekerHi everyone. Im simply seeking advise from the professionals. I want to build an indicator that changes candlestick colors between 3 different time periods. Eg. Between 1am to 7am candles are pink.
Between 8am to 1pm candles are orange. Is this actually possible? If yes - I would greatly appreciate a small example or explanation. I will code the entire indicator  myself.

Yes it is possible. Simply analyse the time of a bar and set its colour according to your rules.

The following two code examples from the CodeBase, draw candles for Heikin Ashi, but you can change it to draw normal candles and have as many colours as you wish.

Both use the "DRAW_COLOR_CANDLES" plot style to accomplish this

Code Base

Dōteki Heikin Ashi (Dynamic Average Foot/Bar)

Fernando Carreiro, 2018.10.15 17:33

A dynamic version of the standard Heikin Ashi indicator (code compatible with both MQL4 or MQL5).

Code Base

Extended Heikin Ashi Indicator

Dominik Christian Egert, 2021.04.23 21:35

Extended version of the original Heikin Ashi indicator.
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_CANDLES
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_CANDLES
  • www.mql5.com
DRAW_COLOR_CANDLES - Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:

Yes it is possible. Simply analyse the time of a bar and set its colour according to your rules.

The following two code examples from the CodeBase, draw candles for Heikin Ashi, but you can change it to draw normal candles and have as many colours as you wish.

Both use the "DRAW_COLOR_CANDLES" plot style to accomplish this

Thank you so much. I greatly appreciate your assistance. The example is close to what I want to build. 
 
Vengeance Seeker #: Thank you so much. I greatly appreciate your assistance. The example is close to what I want to build. 

You are welcome| However, it seems there is another example in the codebase which is closer to what you want ...

Code Base

Specified_Time_Range_Candles

Scriptor, 2018.11.20 12:44

Specified time range candles indicator
 
Fernando Carreiro #:

You are welcome| However, it seems there is another example in the codebase which is closer to what you want ...

Yes these examples are in line with what I want. But I'd also like to see a snippet of the code. You've definitely shown me that it's possible which was something I was questioning after countless research with trail and error. I don't know how codebase works, like is there a button to get the code? Seeing a snippet of code will save me a lot of sleep

 
Vengeance Seeker #: Yes these examples are in line with what I want. But I'd also like to see a snippet of the code. You've definitely shown me that it's possible which was something I was questioning after countless research with trail and error. I don't know how codebase works, like is there a button to get the code? Seeing a snippet of code will save me a lot of sleep

But the CodeBase is exactly that, complete examples of code. All of the examples I quoted provide the full source code.

Use a desktop browser, not a mobile browser.

  • Click on the "view" (next to the filename) to see them in the browser window or ...
  • Click on the filename to download it, or ... 
  • Click on the "Download as ZIP" to download an archive of all the files when there are more than one.
There is also a link "How to download code from MetaEditor" to do all this from within MetaEditor itself, if you prefer.
     
    Fernando Carreiro #:

    But the CodeBase is exactly that, complete examples of code. All of the examples I quoted provide the full source code.

    Use a desktop browser, not a mobile browser.

    • Click on the "view" (next to the filename) to see them in the browser window or ...
    • Click on the filename to download it, or ... 
    • Click on the "Download as ZIP" to download an archive of all the files when there are more than one.
    There is also a link "How to download code from MetaEditor" to do all this from within MetaEditor itself, if you prefer.

      Silly me. On iPad the links weren't showing. I'm on desktop now and everything shows up. Thanks again. You've got no idea how immensely valuable this info is for me. I greatly appreciate it. 

       
      Vengeance Seeker #: Silly me. On iPad the links weren't showing. I'm on desktop now and everything shows up. Thanks again. You've got no idea how immensely valuable this info is for me. I greatly appreciate it. 
      You are welcome!
      Reason: