[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 33

 
xruss >> :
Do you know the answer to my additional question?

The condition below is fine, but I don't use the update function, so I can't tell you.

P.S. I'm also a beginner.

 
xruss писал(а) >>
but does anyone know if this order of listing conditions through several (&&) in one line of if() operator is acceptable?

Acceptable, although I would put more brackets - operations have different priorities in different languages - so as not to think about trivialities - something like:

if ((Max_price_1>EMA20_Open) && (Min_price_1>EMA20_Open) && (Heiniken_Red>Heiniken_Blue))
   {
    Opn_B=true;
   }
 
zfs >> :

You look for highs among the x nearest neighbours of the indicator and compare them.

What does the function of searching for the last 2 maxima on RSI look like ?

Can someone show me the code?

 
xruss писал(а) >>

...(does refresh with RefreshRates() have to be done?)...

What is the purpose of RefreshRates? The point is, that after a new tick comes, built-in variables (like Ask, Bid, etc.) are read and passed to start() function. If the start takes too long, a new tick may come, but variables are not updated. That is when you call RefreshRates.

When start takes too long? Usually when a trade operation is in progress - there is a network exchange, the server's permission for the operation is required, and a response is expected. So usually RefreshRates is used when more than 1 order is opened/closed on one tick. It is used between operations.

 
amur писал(а) >>

What does the search function for the last 2 highs on RSI look like ?

Can anyone show me the code?

Strange as it may seem, the task is not easy. Technically you have to go back and look for points such that:

y(x-1)<y(x) and y(x)>y(x+1).

But this will find local extrema, and that's a bit of a stretch - you won't be happy with the result.

 
Itso >> :

Strange as it may seem, the task is not easy. Technically, you have to go back and look for points such that:

y(x-1)<y(x) and y(x)>y(x+1).

But that will find local extrema, and that's a bit off - you won't be happy with the result.

I'm thinking roughly the same, but confused by some thoughts: how will the 1st maximum be distinguished from the 2nd,

because this condition fits both the first maximum and the second and third maximum....

 
amur писал(а) >>

I'm thinking along the same lines, but I'm confused by some thoughts: how will the 1st maximum be differentiated from the 2nd maximum,

because both the first maximum and the 2nd and the 3rd maximum fit under this condition....

I can recommend you to search and read about ZigZag (there is plenty of literature). I would recommend the Rochev zigzag - 'Zigzag R'.

 
Itso >> :

I can recommend searching and reading about the ZigZag (there is plenty of literature). I would recommend the Rochev zigzag - 'Zigzag R'.

>>Thank you. I'll have a look.

Had a look at....((( I don't understand anything clearly... The array is filled in, then the shifft function is unclear what exactly it does.

 
amur писал(а) >>

Thanks. I'll have a look.

Looked at....(((( I don't understand anything... The array is filled, then the shifft function is unclear exactly what it does.

That's the thing - the matter is quite complex - but this zigzag works without error. You can use it for RSI.

 
amur >> :

what does the function for finding the last 2 highs on the RSI look like ?

can someone show it in code form ?

It looks like this:

bool exit_for=false;
int max_1=0;int max_2=0;
for(int k=0; k<Bars; k++)
{
	if(	iRSI(Symbol(),0, rsi_period,PRICE_CLOSE, k)<iRSI(Symbol(),0, rsi_period,PRICE_CLOSE, k+1)
		&& iRSI(Symbol(),0, rsi_period,PRICE_CLOSE, k+1)>iRSI(Symbol(),0, rsi_period,PRICE_CLOSE, k+2) 	)
	{
		//Если это первый максимум:
		if( max_1==0)
			max_1= k+1;//Записываем номер бара экстремума
		else
		//Если первый найден, записываем второй
		{	
                        max_2= k+1;
                        exit_for=true;
                } 
	}
        //Выход из цикла, когда найдены оба максимума
        if( exit_for==true) k=Bars+1;  
}
Reason: