Hello. The indicator can redraw more than six bars.
The color of the line can change on the third or fifth bar, it is unstable.
How do I know that the color has changed now, no matter on which bar?
sell_1=NormalizeDouble(iCustom(Symbol(),0,"mymy",1,1),Digits);
sell_2=NormalizeDouble(iCustom(Symbol(),0,"mymy",1,2),Digits);
if(sell_1!=0.0 && sell_1_2==0.0)
{
open_pos(magic);
}
lil_lil
The line is red, buffer #1 on each bar is full. The price, quickly up, on five bars became an empty buffer. The color on the five bars turned green. Not necessarily 5. There is a different number of bars. As soon as these buffers become empty, a signal is needed. How do I get it?
I made a recalculation on the new bar, I do not copy the zero bar. The same print on each bar, although the color has not changed, the Line is constantly moving, but the value in the first buffer does not change, either zero or the price. The price is in the buffer when the line is red.
saasa_ivanov
Hi!
The theme smells like trolling .
“As GUARANTEED ….” and then you can already score on this topic , Gee Gee Gee…
type code changed and here’s the Grail, which will give “guaranteed” signals….
and some even try to advise him … Gee Gee Gee ..
lil_lil
Yes, you can change the color on the sixth bar, but you need to get a signal.
Buffer with index 1-red color here is the condition from the given code: if there is red on the first bar and there is no red on the second one
if(sell_1!=0.0 && sell_1_2==0.0)
selling. As I said before, sometimes the color changes immediately for 5 bars.
To open a position on such a signal, you need to write down the condition: if there is red on the fifth bar, there is no red on the sixth bar, I sell. But this is not correct, the color could also change on the near bars
igorm
something like this should be:
static double last_ind[8,100];
//+------------------------------------------------------------------+
void OnTick()
{
double ind[8,100];
for(int j=0;j<100;j++)
{
for(int i=0;i<8;i++)
{
ind[i,1]=GetIndBuffer(i,j);
}
}
if(ArrayCompare(last_ind,ind)= =0) Print("no changes in the indicator!!!");
else
{
ArrayCopy(last_ind,ind);
Print("the Indicator has been redrawn!!!");
}
}
//+------------------------------------------------------------------+
double GetIndBuffer(int nbuff_,int nbar_)
{
return(iCustom(NULL,PERIOD_CURRENT,"name",nbuff_,nbar_));
}
//+------------------------------------------------------------------+
but you need to check, I do not like the built-in MQL functions when working with arrays, anything can be (I’m talking about ArrayCompare() and ArrayCopy()) I would rewrite them for this case
savinkins
You need to know which buffer of the indicator is responsible for the color. Just use the expert Advisor to call more buffers. Set the output of messages and track how the color change affected the change in the value of which buffer.
lil_lil
There is no indicator code. This piece is a call to the indicator and opening a position on the signal on the first bar. Positions are opened, but it happens, it was checked on visualization that the indicator line is green on the first bar, the price quickly goes down and the line becomes red 3, 4 or 6 bars ago, of course, my code skips this color change. How do I know at the moment that the color has changed?
vitales
There is too little information in your piece of code to understand the logic of the indicator.