Indicators: MACD Crossing the zero level (color candles)

 

MACD Crossing the zero level (color candles):

Color candlesticks display areas, in which the MACD indicator crosses the zero line.

MACD Crossing the zero level (clr candles) MACD

Author: Vladimir Karputov

 

I understand that this is an example of how not to do it.....

What's wrong with the standard iMACD() indicator??? Why did you need to use two indicators?

//--- get MA handles
   ExtFastMaHandle=iMA(NULL,0,InpFastEMA,0,MODE_EMA,InpAppliedPrice);
   ExtSlowMaHandle=iMA(NULL,0,InpSlowEMA,0,MODE_EMA,InpAppliedPrice);


And it's time to read the documentation and instead of

//---
   int limit;
   if(prev_calculated==0)
      limit=0;
   else limit=prev_calculated-1;

write shorter words without losing readability and operability.

//---
   int limit = prev_calculated == 0 ? 0 : prev_calculated-1;


Then we wait for an indicator in the form of bars, then in the form of a line. Can you do it depending on the chart type? The indicator should show what chart we switch to.

Switch with these buttons


 
Alexey Viktorov:

I understand that this is an example of how not to do it.....

What's wrong with the standard iMACD() indicator??? Why did you need to use two indicators?


And it's time to read the documentation and instead of

write shorter words without losing readability and operability.


Then we wait for an indicator in the form of bars, then in the form of a line. Can you do it depending on the chart type? The indicator should show what chart we switch to.

Switch with these buttons


Indicators can always be written using at least two approaches: 1. by making changes in the parent code of the indicator or 2. by accessing the indicator handle and then copying information from indicator buffers.
I chose option 1.
 
Vladimir Karputov:
Indicators can always be written using at least two approaches: 1. by making changes in the parent code of the indicator or 2. by accessing the indicator handle and then copying information from the indicator buffers.
I have chosen option 1.

This is where changes are made to the parent code by reading the iMA indicator buffer

CopyBuffer(ExtFastMaHandle,0,0,to_copy,ExtFastMaBuffer)
CopyBuffer(ExtSlowMaHandle,0,0,to_copy,ExtSlowMaBuffer)

So is it the first option or the second? Modifying the parent code or reading the buffers????

 
Alexey Viktorov:

This is which parent code is modified by reading the iMA indicator buffer

So is it the first option or the second??? Modifying the parent code or reading buffers????


MACD indicator code: MACD

 

So what about the universality of the indicator with switching the view of the indicator with the buttons of switching the view of the chart?

Forum on trading, automated trading systems and testing trading strategies.

Indicators: MACD Crossing the zero level (colour candles)

Alexey Viktorov, 2017.10.26 10:29 AM


Next we wait for the indicator in the form of bars, then in the form of a line. Is it possible to do depending on the type of chart? What chart we switch to, the indicator should show.

Switch with these buttons


 

Great indicator, advisor on it is not enough:) someone can write a robot on this indicator?

 
Krivets:

Great indicator, advisor on it is not enough:) someone can write a robot on this indicator?


Well, I can :) .

 
Vladimir Karputov:

Well, I can :) .


Wouldn't be bad) would write it myself if I know programming.

 
Krivets:

Great indicator, advisor on it is missing:) can someone write a robot on this indicator?


This is an ordinary terminal MACD indicator - only in a different rendering. And there is a ready-made Expert Advisor for it, which comes with the terminal.

 
Andrey F. Zelinsky:

This is an ordinary terminal MACD indicator -- just in a different rendering. And there is a ready-made Expert Advisor for it, which comes with the terminal.


In the terminal the Expert Advisor works on a different principle, in this case I am interested in the zero line crossing by the indicator itself.