[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 976

 
granit77:
Choose the right one.
+10 :)))))
 
fanat:

It's working!!! It's just that I was finding a lot of unnecessary stuff, and I don't know how to weed out the unnecessary stuff.
What makes you think there's too much unnecessary? If someone has already written what you need, then they haven't written too much, have they? And it's probably so that this "unnecessary" is not the money of your deposit... What do you think? Or maybe you should offer, and most importantly - show what you think is superfluous. Otherwise, go to a telepathic forum.
 
tuma88:


Thank you!

and can the first arrow be found and then exit the loop?

Which one is it? Either one? Or both, but only the first?

If any first arrow is needed, then exit the loop when it is found, but if both arrows are needed, then the loop, or rather the search within the loop, needs to be rewritten.

 
artmedia70:

Somewhere like this...

This code won't do anything useful - every time an arrow is found in the loop, it will assign the BarWithArrowUP and BarWithArrowDN variables the number of the bar where the arrow is found. It is up to you to decide how to handle them. You can create an array where you will save the bars with arrows up and down, and then take numbers of the bars with arrows from this array; or you can, or you can, whatever you want... :)

Your code will find the very first arrow from the beginning of the loop. break will break the loop and return will be needed only if it is a function, and it will return the value of the arrow buffer found, not the number of the bar this arrow is on.


oops...so i wrote it right ?

I don't need the bar number.

I need any of the very first arrow and that value to remember .

About return....This value in brackets will be the arrow ? (Can this value be seen, felt, touched somehow? Or is it simple as there is a voltage in the socket or there is none ? That is zero and one ?)

Regarding my code, I want to further clarify syntax

for (int i=0; i<Bars(); i++)

{

signal = iCustom (NULL,0 and so on... up arrow buffer )

// here we should also add a buffer check for both the up-arrow and the down-arrow as you do ?

signal2=iCustom (NULL,0 and so on... down arrow buffer )

// and here we still need to arrange a check if (signal || signal2>0) to remember the value and exit the loop.

Geez...something got me confused... how to output in return if we have signal and signal2 what to output from them if it turns out to be more than zero ???

{ // this is where brackets are needed ???

return(signal)

}

break

}
 

What is the order of substitution of bars instead of i in iCustom

for (i=0; i<nBars; i++) {
   DataIndUP = iCustom(Symbol(),Period(),"Имя индюшонка", через запятую все параметры индюка , номер буфера стрелки вверх, i)
   DataIndDN = iCustom(Symbol(),Period(),"Имя индюшонка", через запятую все параметры индюка , номер буфера стрелки вниз, i) 
For example, all the bars for the first arrow up function are searched, and then the same bars are searched for the down function...? I mean, I wanted to ask, is the value for the up and down arrow on the selected bar calculated simultaneously?
 
tuma88:

And what is the order of substitution of bars instead of i in iCustom

So I wanted to ask, is the value for the up and down arrow on the selected bar calculated at the same time
?

The indicator, if it draws arrows through a buffer, can only output different arrows with different buffers. Therefore, the up arrow is output by one buffer, the down arrow by another. In order to detect and find both arrows, both buffers must be checked.

In the loop, at the very beginning, the values at the 0th bar are checked at i=0; at the next iteration of the loop, the first bar is checked at i=1, then the second, third, and so on, until i=nBars-1

In the loop, the values of both buffers are checked at each iteration of the loop.

 
double DataIndUP, DataIndDN;
int    i, GlobalFlag, nBars = 250 ;  // nBars = количество проверяемых баров вглубь истории

for (i=0; i<nBars; i++) 
{
   DataIndUP = iCustom(Symbol(),Period(),"Имя индюшонка", через запятую все параметры индюка , номер буфера стрелки вверх, i)
   DataIndDN = iCustom(Symbol(),Period(),"Имя индюшонка", через запятую все параметры индюка , номер буфера стрелки вниз, i)
   if (DataIndUP !=EMPTY_VALUE)     // или if (DataIndUP !=0) // найдена стрелка вверх
                                    // всё зависит от того, что выдаёт буфер при отсутствии стрелки 
                                    // нажмите Ctrl+D и посмотрите что вам в окне данных будет показано
      GlobalFlag=+1                 // присвоение значения +1(стрелка вверх)  переменной 
      Break;                        //выход из цикла, так как  нашлась последняя стрелка
if (DataIndDN !=EMPTY_VALUE)     // или if (DataIndDN !=0) // найдена стрелка вниз
                                    // всё зависит от того, что выдаёт буфер при отсутствии стрелки 
                                    // нажмите Ctrl+D и посмотрите что вам в окне данных будет показано
      GlobalFlag=-1                 // присвоение значения -1(стрелка вниз) переменной
      Break;                        //выход из цикла, так как  нашлась последняя стрелка
}

Will such a construction with GlobalFlag signed and Break operator work?

But before that, in the block where variables are initialized, should this variable be initialized as well ? And give int type to ?????

 

Anyway. I have an idea for a robot. I can't write the program myself, but if you're interested, let me know.

 
Tupen:

Anyway. I have an idea for a robot. I can't write the program myself, of course. If you're interested, whistle.

Do you think you'll get whistled at? More like booing... :)

Throw the idea out there and see if people will come around (if the idea is good) ... And for an agreed fee may even be a little more active ... :)

 
Tupen:

Anyway. I have an idea for a robot. I can't write the program myself, but if you're interested, let me know.

Do you use your hands to work with this algorithm?