[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 322

 
gyfto:


Let me explain in other words: this is self-education, I am self-taught all my life, so I do NOT know what approach you have adopted. I do NOT know what is accepted by you, what is not.

OK, back to the candles. Suppose we have i_AnyBarsToHistory = 30, i_ѕеqceptBarsConnt = 3. If in a window of 30 candlesticks cntUp == i_ѕеԛceptBarsCount and cntDn == i_ѕеԛceptBarsCount one time, then what should happen? Or does it always count only one counter per pass?

Yes, and why do we exit the loop prematurely before reaching Close[1]?


The bottom line is this: If the cycle is 30 to 3, then the calculation is from index 30 to index 3 respectively, inclusive.

If on the current bar the required attribute is passed, we add 1 to the counter, if another required attribute is passed, we add 1 more to the counter. And so on, until we come across a bar that doesn't meet the required attribute. If the bar does not meet the required attribute, the counter reset, and then analyze the situation, ie carry out further calculations, the cycle, until we come to the bar with an index of 3. Simply everything.

I hope I explained clearly.

 
hoz:

int signal = GetGeneralSignal();


you may replace it with

   if(GetMa(2)-GetMa(1)<σ) return; else int cross=MathAbs(GetMA(2)-GetMA(1))/(GetMA(2)-GetMA(1));
   for (int i=i_AnyBarsToHistory; i>=1; i--){
                if(cross*(Close[i] - Open[i]) >= i_sizeOfSequentialCorrectionBar * pt) cnt++; else cnt=0;
   }
   if(cnt >= i_sequentBarsСount){
                switch(cross+1){
                        case 0: OpenBuy(); break;
                        case 2: OpenSell(); break;
                }
   }

Check whether cross=+1 or -1 corresponds to OpenBuy() or OpenSell() (and close-open or open-close). σ We have some infinitesimal value assigned here, analogous to zero.

tommy27:

Help, I cannot understand how to make an indicator compare the number of latest bars and calculate how many of them were up, how many were down and how many were pinbars and who had what prices close/open, high/low and volumes?

We need to do this exactly in the indicator.


Set CountedBars on a certain window of candlesticks (e.g. 30), and cycle CountedBars with decrement. Up or down, bullish or bearish, look at the difference of two adjacent Close[]. Pinbar look at the local high or low, and the deviation of this high or low from the adjacent values. If the deviation exceeds a certain percentage you have specified, it is a pinbar.

 
Good afternoon. Can you tell me how to determine the crossing of 38.2 on a Fibonacci arc object?
 

Hello,

Happy Holidays to all!

I've got a trading terminal OEC in need of a simple spread indicator

Maybe someone can write, or at least help me with something

It looks like this on mt4

Files:
 
ADGgeek:

Hello,

Happy Holidays to all!

I've got a trading terminal OEC in need of a simple spread indicator

Maybe someone can write, or at least help me with something

It looks like this on mt4


I can advise you to ask on the Spider. In fact, I can only quote:

GaryKa:
Add in a description of punctuation, and a definition of your concepts (e.g. "your number") andhere. And in this branch only help those who have their own hands (and then in the mood)

This applies to all. I don't know how to use it, but I'm sure it will work.

 

That's what I was looking for, thanks Garyka! Happy holidays past and upcoming!

 

Happy Holidays everyone!

Can you tell me what the terminal means when it says uninit reason 5 in the "experts" tab?

Thank you.

 
CYBOPOB:

Happy Holidays everyone!

Can you tell me what the terminal means when it says uninit reason 5 in the "experts" tab?

Thank you.


https://docs.mql4.com/ru/constants/uninit
 
hoz:

Simple as that.


As far as I understood from comparing your description with your code, they diverge, because in your code the early exit from the loop occurs wheni_seqentBarsCont:

hoz:

for (int i=i_AnyBarsToHistory; i>=1; i--)
   {
      if (directionMA == CROSS_UP)
      {
         if ((Open[i] - Close[i]) >= i_sizeOfSequentialCorrectionBar * pt)
             cntDn++;
         if ((Close[i] - Open[i]) >= i_sizeOfTrandBar * pt)
             cntDn = 0;
                                                                                        
         if (i == 1)
            Print(" directionMA ", directionMA, "; i = ", i, "; Open[i] - Close[i] = ", Open[i] - Close[i], "; cntDn = ", cntDn);

         if (cntDn == i_sequentBarsСount)            //<--
             return (REQUIRED_SEQUENTIAL_BEARS_GOT); //<--
      }

      if (directionMA == CROSS_DN)
      {
         if ((Close[i] - Open[i]) >= i_sizeOfSequentialCorrectionBar * pt)
             cntUp++;
         if ((Open[i] - Close[i]) >= i_sizeOfTrandBar * pt)
             cntUp = 0;
         if (i == 1)
            Print(" directionMA ", directionMA, "; i = ", i, "; Close[i] - Open[i] = ", Close[i] - Open[i], "; cntUp = ", cntUp);

         if (cntUp == i_sequentBarsСount)            //<--
             return (REQUIRED_SEQUENTIAL_BULLS_GOT); //<--
   }
hoz:

If the cycle is from 30 to 3, then the calculation goes from index 30 to index 3, respectively, inclusive.

If the bar does not correspond to the required index, then the counter is reset, and then we analyse the situation, i.e. we continue calculating by the cycle, until we reach the bar with index 3.

 
gyfto:


As far as I understood from comparing your description with your code, there is a discrepancy, because in your code there is an early exit from the loop wheni_seqentBarstCont:



I understand that you probably need to have a counter, which will be incremented after each calculated bar and when its value is equal to i_AnyBarsToHistory, then it will output what has been outputted up to this point.

I'm going to throw out what I think, and I'll write back.