[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 282

 

Gentlemen, teach how to take adivergence signal from an indicator(FX5_Divergence_V2.1.mq4) to an EA.

Buffers 2 and 3 of the indicator give out EMPTY_VALUE.

 
Does anyone have a tick collector that saves tick history as follows: tick arrival time, asc, bid? the codebase only has a tick collector without asc.
 
Sergey_Rogozin:

Gentlemen, teach how to take adivergence signal from an indicator(FX5_Divergence_V2.1.mq4) to an EA.

Buffers 2 and 3 of the indicator give out EMPTY_VALUE.

Did I write your script? It has everything in it. Instead of outputting a message with Alert, write your processing. You can write eight in DoubleToString() instead of six decimal places if it outputs zeros. In any case, the signals are present and the script reads them. Apply some mind and effort.
 
artmedia70:
Did I write you a script? It has everything in it. Instead of outputting a message with Alert, write your processing. You can write eight in DoubleToString() instead of six decimal places if it outputs zeros. In any case, the signals are present and the script reads them. Apply some mind and effort.
What a stubborn man. Let me explain it to him again on my fingers.
The empty values of the buffers with arrows are filled instead of zeros with values EMPTY_VALUE numerically equal to 2147483647. Where there are arrows, the values are different, e.g. 0.000031.
We have to filter out "empty" values programmatically, because they look like the number 2147483647 in comparison.
For instance, I do it this way and it works. Who is smarter, can make it more beautiful.

double buy=iCustom(NULL,0,"FX5_Divergence_V2.1",2,CountBar);
// отфильтровывает значения EMPTY_VALUE, заменяя их на 0 
if(buy==EMPTY_VALUE) buy=0.0;
// теперь значения buy могут быть либо 0, либо значением стрелки, например, 0,000032
 
granit77:
What a stubborn man. Let me explain it to him again on my fingers.
Empty values of buffers with arrows are filled instead of zeros with values EMPTY_VALUE numerically equal to 2147483647. Where there are arrows, the values are different, e.g. 0.000031.
We have to filter out "empty" values programmatically, because they look like the number 2147483647 in comparison.
For instance, I do it this way and it works. Who is smarter, can make it more beautiful.

Now the person will write that buffers 2 and 3 output only zeros :)))

Man, such a simple logic: if buffer's value is NOT equal to EMPTY_VALUE, it means there is an arrow on this bar and therefore a signal.
And how to present this empty value and what to compare it with is a matter of taste.

 
artmedia70:

Everything's a bloody mess here...


To the island!!! :)

I have the same numbers (via Expert Advisor) but the Data window shows EMPTY_VALUE! Is there any way to fix this?


 
granit77:
Stubborn man. Let me explain it to him again on my fingers.
The empty values of the buffers with arrows are filled with EMPTY_VALUE numerically equal to 2147483647 instead of zeros. Where there are arrows, the values are different, e.g. 0.000031.
We have to filter out "empty" values programmatically, because they look like the number 2147483647 in comparison.
For instance, I do it this way and it works. Who is smarter, can make it more beautiful.



understood roughly.

 

To artmedia70.

I really couldn't use the script. I tried to do almost the same as granit77 ,but it didn't work either.

If(buy==EMPTY_VALUE) buy=0.0 ; - the result is always "0". I have Alerts coming from the indicator but the Alert attached to the Expert Advisor is not working.

Okay, thanks, I will continue to "suffer" ...)))

 
Sergey_Rogozin:

To artmedia70.

I really couldn't use the script. I tried to do almost the same as granit77 ,but it didn't work either.

If(buy==EMPTY_VALUE) buy=0.0 ; - the result is always "0". I have Alerts coming from the indicator but the Alert attached to the Expert Advisor is not working.

Okay, thanks, I will continue to "suffer" ...)))

you're not the only one - agonising, I'm already fixing the indicator :)))
 
todem:

I have the same numbers (via EA), but the Data window shows EMPTY_VALUE! Is there any way to fix this?

When you print buffer values to the screen, what do you do? It's the numeric data that's being output anyway. If you want to output an empty string, or "Empty Value" or "EMPTY_VALUE", output them as string variables.
I.e. :
string val;
if(buffer value==EMPTY_VALUE) val="EMPTY_VALUE";
But if(buffer value!=EMPTY_VALUE) val=DoubleToString(buffer value, 8);
and display the value of variable val instead of the buffer value.
For example: Comment ("Value = ", val);
Reason: