Indicators: MACD Crossing the zero level (color candles) - page 2

 
Krivets:

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


The crossing of the main line and the signal line -- and the crossing of the main line and zero -- are the same thing.

Instead of the signal line, put zero in the code -- that's all the edits.

 

in this place in the code of the terminal Expert Advisor"MACD Sample":

bool CSampleExpert::Processing(void)
  {
...
   m_signal_current =m_buff_MACD_signal[0];
   m_signal_previous=m_buff_MACD_signal[1];

write it like this:

bool CSampleExpert::Processing(void)
  {
...
   m_signal_current =0;
   m_signal_previous=0;

-- there will be a crossing of the main line with zero

 
Andrey F. Zelinsky:

in this place in the code of the terminal Expert Advisor "MACD Sample":

write it like this:

-- there will be a crossing of the main line with zero


Changed the code, checked it in the tester, the Expert Advisor stopped making trades, maybe something else needs to be changed somewhere else.

 
Krivets:

I changed the code, checked it in the tester, the EA stopped making trades, maybe something else needs to be changed somewhere else.


It could be anything -- it's just a quick guess, I didn't pay much attention -- my goal was to show the essence of the changes.

 
Krivets:

I changed the code, checked it in the tester, the EA stopped making trades, maybe something else needs to be changed somewhere else.


I suggest you try to make the changes yourself -- if it doesn't work, we'll discuss it -- you'll learn at the same time, I guess.

 
Andrey F. Zelinsky:

I suggest that you try to make changes yourself -- if it doesn't work out -- we'll discuss it -- and you'll learn at the same time, probably


From the Expert Advisor that comes with the terminal mt5 "MACD Sample", removed data about "moving average" and "MACD signal line" as they are not planned to be used. It turns out that the only thing left is the "main line of the MACD indicator ", which will cross "0", due to which it is planned to buy/sell. But the funny thing is that the result is the same, the Expert Advisor works the same old way, only there are fewer or more trades.


 
Krivets:

From the Expert Advisor that comes with the terminal mt5 "MACD Sample", removed the data on the "moving average" and "MACD signal line" as they are not planned to be used. It turns out that the only thing left is the "main line of the MACD indicator ", which will cross "0", due to which it is planned to buy/sell. But the funny thing is that the result is the same, the Expert Advisor works the same old way, only there are fewer or more trades.



"works the same way" in the sense of opening still follows the old signals, even with the signal line removed -- or is the result the same?

Either way, as you can see -- solved the problem quickly -- no need to ask anyone.

 
Andrey F. Zelinsky:

"works the same way" in the sense of opening still using the old signals, even with the signal line removed -- or is the result the same?

Either way, as you can see -- solved the problem quickly -- no need to ask anyone.


The problem is not solved, it opens the same way as before, when the "MACD main line" is below or above the" MACDsignal line ", many missed signals.

And I would like to make an Expert Advisor from this indicator, and the usual MACD just separately hooked as an indicator, so that sometimes manually trade. But it was interesting to try to do something myself)

 
Krivets:

The problem is not solved, it opens the same way as before, when the "MACD main line" is below or above the" MACDsignal line ", many missed signals.

Yes, and I would like to make an EA from this indicator, and the usual MACD just separately hooked as an indicator that sometimes manually trade. But it was interesting to try to do something myself)


Well, you should start. Start small - create a new Expert Advisor in MetaEditor. The second step - add input parameters for the indicator and write all the necessary procedures for creating the indicator and accessing indicator buffers.

In general, I think you will succeed in the first step. We will help you with the second step. The main thing is to post your code and ask, ask, ask ... :)

 
Krivets:

The problem is not solved, it opens the same way as before, when the "MACD main line" is below or above the" MACDsignal line ", many missed signals.

Yes, and I would like to make an EA from this indicator, and the usual MACD just separately hooked as an indicator that sometimes manually trade. But it was interesting to try to do something myself)


post the code with your edits -- explain what edits you made -- let's see.

If you are interested in doing it yourself, there is a chance to figure it out.