Different colors for DRAW_ZIGZAG in MT4. - page 2

 
Fatemeh Ameri #: I just have to be sure if it us possible. The issue is that I think it is not possible. But thanks for all your help.

It is indeed possible, but not the way you think. You have to think "outside of the box".

 
Fatemeh Ameri:
Hi every one, I've been trying to create a zigzag indicator using DRAW_ZIGZAG in MT4, I want to change the color of the zigzag line for up and down lines, but seems like the color won't change, does anyone know how to change the color of zigzag line indicator?
It's simple simple ... to change the color if you know how to code and create an indicator from scratch. What a dev you are, eh?

Btw paste your code.
 
_MAHA_ #: It's simple simple ... to change the color if you know how to code and create an indicator from scratch. What a dev you are, eh? Btw paste your code.

No, it is not simple! Who are you trying to impress?

The OP has every right to question the possibility because it is in fact a challenge for many coders, to make a colour ZIgZag in MQL4. If it were easy, then there would be many examples of it in the CodeBase and the Market, but there are not. It is however possible, using a few tricks and thinking outside of the box. That I can guarantee.

Note to the OP: @Fatemeh Ameri, when you do finally achieve your goal, don't post the code. Keep it to yourself.

 
Fernando Carreiro #:

No, it is not simple! 

The thing which is hard for you might be easy for me. 


Fernando Carreiro #:

Who are you trying to impress?

Seems meaningless. Anyway since you asked me that question twice, I'm trying to impress the 404. What are you going to do so?

You have a high credit. Don't destroy it... at least for me ;p

 
_MAHA_ #:
It's simple simple ... to change the color if you know how to code and create an indicator from scratch. What a dev you are, eh?

Btw paste your code.

It is not simple, You clearly have no idea how to code it.

 
Would it be possible to use two zigzags with different colors? And use the EMPTY_VALUE to make it paint and not point as needed?
 
Dominik Christian Egert #: Would it be possible to use two zigzags with different colors? And use the EMPTY_VALUE to make it paint and not point as needed?

No, I don't think so, because it is similar to DRAW_SECTION where it connects the points that don't have EMPTY_VALUE and ignores those that do. It is kind of a "connect the dots" functionality.

The solution I am considering is using the normal DRAW_LINE and simulating the connecting line using the equation "y = mx + c", but there may be other possible solutions, like a combination of the two.

It is a question of analysing each one, pros and cons, and choosing the appropriate one.

 
Cause of "connecting the dots" I was asking. Suspected that already.

Calculating the slope and using a normal line seems to be the easiest way.
 
Fernando Carreiro #:

No, I don't think so, because it is similar to DRAW_SECTION where it connects the points that don't have EMPTY_VALUE and ignores those that do. It is kind of a "connect the dots" functionality.

The solution I am considering is using the normal DRAW_LINE and simulating the connecting line using the equation "y = mx + c", but there may be other possible solutions, like a combination of the two.

It is a question of analysing each one, pros and cons, and choosing the appropriate one.

I tried to use DRAW_LINE Mode, It does not work as well, In this mode, buffer for all candles must have a value otherwise MT4 does not connect them, so for example you want to connect the low of 2 to the high of 6, we don't have any solution for candles 3,4,5 using DRAW_LINE. 
 Up to now, the best solution is first creating the indicator using DRAW_ZIGZAG, to change the color of downward lines I used a trendline object, It works like a charm now.

 
Fatemeh Ameri #:I tried to use DRAW_LINE Mode, It does not work as well, In this mode, buffer for all candles must have a value otherwise MT4 does not connect them, so for example you want to connect the low of 2 to the high of 6, we don't have any solution for candles 3,4,5 using DRAW_LINE. Up to now, the best solution is first creating the indicator using DRAW_ZIGZAG, to change the color of downward lines I used a trendline object, It works like a charm now.

Yes, it does work, but you have to create the intermediate points as well and not just the start and end points. That is why I wrote that you need to apply the equation "y = mx + c" (equation for a line).

And please don't use trend-line graphical objects. That is inefficient.

Reason: