Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 174

 

если кто знает иное, математическое решение - буду благодарен )


There is no other solution, because you divide the array into two parts for which you make different calculations

1) for numbers greater than 1 - find the increment of the array member as a percentage of one

2) for numbers less than 1 - find the increment from the number less one in percents to get one, and take the result with minus sign "-".

3) obtain the average of the values calculated by two different formulas

4) add one (I do not know why, honestly, probably for further calculations, but it is more evident when all revolves around 0 (at least for me personally) )

 
ALXIMIKS:


4) add one (I don't know why, to be honest, maybe for further calculations, but it is clearer when everything revolves around 0 (at least for me personally) )


on this point i have already explained.

If you calculate an example like 0.2 5 5 0.2 without adding 1, you get 0.
But we need a coefficient. The physical meaning of zero in this case is "the value will not change".
i.e. the coefficient is actually 1.0

in this case if all values are equal to say -> 5 5 5 5
the total will be 5 - and this will be the correct total.

I got it like this

for(i=0; i<n; i++){ // loop through the array
if (Arr[i]>=1) {Sum=Sum+(Arr[i]-1);}
else (Sum=Sum-(1/Arr[i] -1);
}
Sum=Sum/n;

if (Sum>0) res=1+Sum;
else res=-1/(Sum-1);

why is it needed?
let's say we need to find the ratio of HL Tuesday to HL Monday, averaged over ten years ;-)



 
GameOver:


why do we need it?
Let's say we need to find the ratio of Tuesday's HL to Monday's HL, averaged over ten years ;-)

and how do you account for operations with zero? It is very influential if the array has a delta of some values))
 
rosomah:

Is there a ticking story in MQL5, do you know? I haven't read it and couldn't find it there either.

There is no tick history in MT5 either. In the tester ticks are generated, how is described here.
 
pu6ka:
There is no tick history in MT5 either. In the tester, ticks are generated as described here.
Thank you, already read it, favourite topic, last three days.
 

Good afternoon, dear friends!

I am asking for help in finding or writing an elementary advisor.

The conditions are as follows:

If the previous bar is rising, (open < close) we sell on the current one.

If the previous bar is falling (open > close), we buy at the current one.

We open a position at the open price of the new bar. We close positions by the close price of the new bar.

I cannot find it myself.

Thank you in advance.

 
zorkiy911:

Good afternoon, dear friends!

I am asking for help in finding or writing an elementary advisor.

The conditions are as follows:

If the previous bar is rising, (open < close) we sell on the current one.

If the previous bar is falling (open > close), we buy at the current one.

We open a position at the open price of the new bar. We close positions by the close price of the new bar.

I cannot find it myself.

Thank you in advance.


And you won't, because it makes no sense. If you think it does make sense, provide a picture of the chart with the entry and exit points marked, at least for one day, only taking into account the spread.
 
BeerGod:

And you won't, because it makes no sense. If you think it does make sense, provide a picture of the chart with marked entry and exit points, at least for one day, only taking into account the spread.
I do not know what I need such an Expert Advisor for, so please help me out. I am not able to do it myself. What kind of picture do you need to make?
 
zorkiy911:
I have a pretty clear idea of what I need such an EA for, so please help me a lot. I have not managed to write it myself. What image do you need to make?

What is the great secret behind this algorithm?

According to your terms, it's like this.

with reverse

But there will be no stability in the first or the second case.

I drew it in 5 minutes, you can spoil it)

Files:
 

The EA exits on 33 bars after a trade:

static datetime t;

if (условие)
      {
      Opn_B = true; 
      t=Time[0];
      minimum = iLow(Symbol(),Period(),0);
      }
if (Time[33]>t) 
          {                                      
          Cls_B=true;              
          }

In the real and in the tester it exited on 43 bars. I tried to set the exit parameters on the fifth bar, all is normal. In your opinion, what may be the problem?