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

 
paladin80:
Well, it depends on what kind of account you are using, e.g. a normal or cent account. Sometimes 1 pip for 0.01 lots = 1 cent (x10x200 = 20 USD), and sometimes 1 pip for 0.01 lots = 10 cents (x10x200 = 200 USD).
i have 1 pip - 1 cent. so i need 20 usd to be able to stop down to 200 pips?
 

I'll duplicate the question, perhaps no one has noticed because of the follow-up questions.

I decided to understand how theATR indicator works, and at the same time, to study its code. I understood the essence of it, but it is written strangely.

Here is itsstart function:

int start()
  {
   int i,counted_bars=IndicatorCounted();
//----
   if(Bars<=AtrPeriod) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=AtrPeriod;i++) AtrBuffer[Bars-i]=0.0;
//----
   i=Bars-counted_bars-1;
   while(i>=0)
     {
      double high=High[i];
      double low =Low[i];
      if(i==Bars-1) TempBuffer[i]=high-low;
      else
        {
         double prevclose=Close[i+1];
         TempBuffer[i]=MathMax(high,prevclose)-MathMin(low,prevclose);
        }
      i--;
     }
//----
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   for(i=0; i<limit; i++)
      AtrBuffer[i]=iMAOnArray(TempBuffer,Bars,AtrPeriod,0,MODE_SMA,i);
//----
   return(0);
  }
//+----------------

Here is the first block with some confusion:

//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=AtrPeriod;i++) AtrBuffer[Bars-i]=0.0;
//----

What is the sense of doing something if the counted_bars value <1. In my opinion, it means that the indicator hasn't counted any bar and I should just exit the function because there is no value yet... What is the catch?

WhyAtrBuffer has the index[Bars-i]? I understood that the idea is to set the buffer to 0.0 if there are no values. But it turns out that the value 0.0 is defined only for bars from(Bars) to(AtrPeriod), while fromAtrPeriod tothe 0-th bar nothing is written to the buffer. Why?

I do not understand the logic of this code fragment

In the next block:

//----
   i=Bars-counted_bars-1;
   while(i>=0)
     {
      double high=High[i];
      double low =Low[i];
      if(i==Bars-1) TempBuffer[i]=high-low;
      else
        {
         double prevclose=Close[i+1];
         TempBuffer[i]=MathMax(high,prevclose)-MathMin(low,prevclose);
        }
      i--;
     }
//----

In the line:

if(i==Bars-1) TempBuffer[i]=high-low;

Condition ifi==Bars-1. It appears that the value ofthe 1stbar from the beginning of the chart on the left is taken into account...But this is very far away, what good is this value?

 
hoz:

I'll duplicate the question, perhaps no one has noticed because of the follow-up questions.

I decided to understand how theATR indicator works, and at the same time, to study its code. I understood the essence of it, but it is written strangely.

Here is itsstart function:

Here is the first block with some confusion:

What is the sense of doing something if the counted_bars value <1. In my opinion, it means that the indicator hasn't counted any bar and I should just exit the function as there are no values yet... What is the catch?

WhyAtrBuffer has the index[Bars-i]? I understood that the idea is to set the buffer to 0.0 if there are no values. But it turns out that the value 0.0 is defined only for bars from(Bars) to(AtrPeriod), while fromAtrPeriod tothe 0-th bar nothing is written to the buffer. Why?

I do not understand the logic of this code fragment

In the next block:

In the line:

Condition ifi==Bars-1. It appears that the value ofthe 1stbar from the beginning of the chart on the left is taken into account...But this is very far away, what good is this value?


The bars are counted from right to left (from 0 to the last (Bars) minus 1). With each new bar (0) all bars are correspondingly increased by one, and the last one (on the left) is never specified in the numerical measurement, and this variable Bars, because no one knows what history you have, but it guarantees the work of the indicator on all the history, which it has. Train your logic, there is no way to understand anything without it!
 
laveosa:
I have 1 pip-1 cent. does that mean i need 20USD to be able to withstand a 200 pips downside stop?
If a 0.01 point lot = 1 cent, then for a 0.1 lot position with a 200 pips stop loss = 20 USD.
 
borilunad:

The bars are counted from right to left (from 0 to the last (Bars) minus 1). With every new bar (0) all the bars are correspondingly increased by one, and the last one (left) is never specified numerically, and this variable Bars, because nobody knows what history you have, but it guarantees the work of the indicator on the whole history, which it has. Train your logic, there is no way to understand anything without it!

I know that bars are counted from right to left. If there are 5000 bars on the chart and ATR period = 14, then[Bars-i] will take the value from (5000 - 1) to (5000 - 14), i.e. from 4999 to 4986.

Sothe AtrBuffer will be with index i equal to 4999 to 4986. And where are the remaining bars from 0 to 4986???

 
hoz:

I know that bars are counted from right to left. If there are 5000 bars on the chart and ATR period = 14, then[Bars-i] will take the value from (5000 - 1) to (5000 - 14), i.e. from 4999 to 4986.

Sothe AtrBuffer will be with index i equal to 4999 to 4986. And where are the other bars from 0 to 4986???


How do you calculate? If ATR period = 14, then the zero bar gives the average of the 14 bars before the zero bar and so on into the depth of history.

The i goes over the 14-bars last in time but the first in numbers to average them or what to do with the formula. Also counts the value of the 4986th bar by the 14 bars previous in time, i.e. by those standing on the left.

Study the for operator in Doc and in the tutorial!

 
borilunad:


How do you calculate? If the ATR period = 14, then the zero bar gives the average of the 14 bars before the zero bar and so on into the depth of history.

i goes over the 14-bar last time, but over the first by number to average them or what to do by the formula. Also counts the value of the 4986th bar by the 14-bar last in time, i.e. by the ones standing on the left.

Study the for operator in Doc and the tutorial!

That wasn't the question, what you said I understand. It was me being overworked and stupid. There was a niggle in the fact that theAtrPeriod buffer passes the number of bars of history... And I was looking at it and I didn't get it. I get like that when I overwork...
 
hoz:

Victor, your assumptions are illogical.

If the indicator hasn't processed a single bar, it means that it should process all the bars and not terminate the programme.

And the indicator values on the history are needed to analyse the history:)

 
Esteemed pros, is a matodied EA spread of 4 when testing all ticks on 5mins still bad, or is it more or less?
 
kakin:
Dear Professionals, is the 4 spread of an EA in a 5 min test all ticks still bad, or is it more or less?

Not much information, and the pros are asleep:)
Reason: