How to write an indicator to show specific price ribbons or boundaries

 

There are 5 colored ribbons or boundaries or whatever you wish to call it. With pre-specified high and low prices. 

I suppose it is very simple. User will specify those ribbons low and high prices in indicator setting and indicator should draw those regions.

I just don't know how to draw a ribbon like this in mql4. I tried DRAW_LINE but it got me nowhere. I just need a clue. 

I have written some experts before but never worked with an indicator. 

Does it have to be an indicator or could it be implemented in a script as well ? 

 
mostafanfs:

How can I implement an indicator to show me something like this picture in MT4 using MQL4 ? 

As you can see there are 5 colored ribbons or boundaries or whatever you wish to call it. With pre-specified high and low prices. 

I suppose it is very simple. User will specify those ribbons low and high prices in indicator setting and indicator should draw those regions.

I just don't know how to draw a ribbon like this in mql4. I tried DRAW_LINE but it got me nowhere. I just need a clue. 

I have written some experts before but never worked with an indicator. 

Does it have to be an indicator or could it be implemented in a script as well ? 


Hello,


use ObjectCreate() and the OBJ_RECTANGLE

you can define the size by your own.


dont forget to DeInit


amando

 
amando:

Hello,


use ObjectCreate() and the OBJ_RECTANGLE

you can define the size by your own.


dont forget to DeInit


amando

Thanks amando !

Does it matter where to call this function

I mean could I call it from OnCalculate() so that I can have ribbons for new prices as well or just call it from OnInit is enough ? 

(In experts I used OnTick function and I was able to do what I want with new incoming ticks/prices)

 
in general it doenst matter, but its better to creat an function and make only the move within the OnCalculate
Reason: