Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 309

 

Good afternoon. Can you please advise why the EA sets a huge number of objects (down arrow), but the up arrow is not set???

The task is as follows: The Expert Advisor should find the Doji pattern on H4 no matter what TF the chart is open on. And when closing the 4-hour Doji, it should put an up or down arrow, depending on the pattern configuration.

Please check the errors in the code.

Thanks

Files:
111.mq4  8 kb
 
What can cause an EA to be deleted when switching timeframes on the chart?
 

Hello. A custom indicator (or rather several of them), in a separate window, draws histograms of two colours - blue and red. How to pass its values to the Expert Advisor - for example, blue histogram, buy signal; red - sell signal. Through iCustom(..., buffer, shift), I cannot figure out how. I found nothing on the Internet, or rather, I found one way, but it seems to be wrong. Can someone please advise me?

 
Youri Lazurenko:

Hello. A custom indicator (or rather several of them), in a separate window, draws histograms of two colours - blue and red. How to pass its values to the Expert Advisor - for example, blue histogram, buy signal; red - sell signal. Through iCustom(..., buffer, shift), it seems not quite right. I can't find the answer on the Internet. Can someone give me a hint?

Use iCustom() - check which buffer is blue and which is red. Use them to get the values you need. The buffer colour is not important at all, the buffer values are important. And they can have the same colour - the colour is necessary only for your eyes, but not for the EA.

 
Youri Lazurenko:

Hello. A custom indicator (or rather several of them), in a separate window, draws histograms of two colours - blue and red. How to pass its values to the Expert Advisor - for example, blue histogram, buy signal; red - sell signal. Through iCustom(..., buffer, shift), it seems not quite right. I can't find the answer on the Internet. Can someone give me a hint?

 
Buffer 0 contains the indicator data and buffer 1 contains either one colour or the second colour in turn

 
Alexander Zhmurenko:
What can cause an EA to be deleted when switching timeframes on the chart?
 
Alexander Zhmurenko:

Read the logbook, possibly "going outside the array"

 
Artyom Trishkin:

Exactly through iCustom() - see which buffer is blue and which is red. From them you get the values you need. The buffer colour is not important at all, the buffer values are important. And they can have the same colour - the colour is only necessary for your eyes, but not for the EA.


Thank you for your reply. I understand that, about the colours and values, I can't get it right. For example here is the end of the indicator code

if(ExtMapBuffer1[b]>ExtMapBuffer2[b])
{
   ExtHBuffer1[b]=1;
   ExtHBuffer2[b]=0;
   }
   else
   {
      ExtHBuffer1[b]=0;
      ExtHBuffer2[b]=1;
   }

// ExtHBuffer1[b] - синий (SetIndexBuffer(0, ExtHBuffer1)); ExtHBuffer2[b] - красный (SetIndexBuffer(1, ExtHBuffer2). Если создать функцию и написать так, будет правильно?

string GetEmotion(int tf, int shift) { string col = red; double ind = iCustom(NULL, tf, "Symphonie_Emotion_Indicatorv_v3.0", SSP, Kmax, CountBars, 0, shift); if(ind != 0) col = aqua; return(col); }

 
Youri Lazurenko:

Thank you for your reply. I understand that, about the colours and values, I can't get it right. For example here is the end of the indicator code

Can you give me the indicator? What is shown in the data window (Ctrl+D) when you move the mouse over the indicator bars? How many buffers are there and what values are in them?

Reason: