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

 
artmedia70:
Ask here.
Asked.....
 
OK, now one more question. How to make the indicator read from a certain bar, on any startup or compilation???? Because there are more bars every minute.....
 
nikelodeon:
OK, now one more question. How to make the indicator read from a certain bar, on any startup or compilation???? Because there are more bars every minute.....
The bar has a certain time. You can use this time to calculate the needed bar. Then it will not interfere with the fact that every minute there are more and more bars.
 
Vit201:

Help to convert the script into a function to add to an EA

Permanent link to the script https://forum.mql4.com/ru/5872#24097

You've been helped in a neighbouring thread, delete that repetition! And use the SRC button to the left of the camcorder to paste the code!
 
artmedia70:
A bar has a specific time. Use that time to calculate the right bar. Then it won't bother you that there are more and more bars every minute.

Is that a number in the form of the number of seconds since 1970?

 
nikelodeon:

Do you mean a number in the form of number of seconds since 1970?

The int variable contains the number of seconds since 1970, while the datetime variable contains the date.

If you need a certain bar in the history, then it doesn't matter how you specify it - by date or by number of seconds, in any case, the variable will indicate the time of opening of this particular bar, regardless of the arrival of new ticks and opening of new bars.

 
Please help. I can't figure out the reason - it doesn't do division, gives 1.00000 result for all values of divisor and divisor.Below is a snippet of codeps. SRC is not inserted: if(Down>Up) {rezult=Down/Up; string value=DoubleToString(rezult, 5); Alert("Down=",Down,",Up=",Up,",Zero=",Zero); Alert("POWER DOWN=",value);}
else {rezult=Up/Down; string value=DoubleToString(rezult, 5); Alert("Down=",Down,",Up=",Up,",Zero=",Zero); Alert("POWER UP=",value);}The values Down, Up and Zero the Alert outputs, but it doesn't want to divide.
 
rapid_minus:
Please help. I can't understand the reason - it doesn't do division, gives 1,00000 result for all values of divisor and divisor.Below is a snippet of codeps. SRC is not inserted, I'll write it this way:
if(Down>Up)
 {
  rezult=Down/Up;
  string value=DoubleToString(rezult, 5);
  Alert("Down=",Down,",Up=",Up,",Zero=",Zero);
  Alert("СИЛА ВНИЗ=",value);
 }
else
 {
  rezult=Up/Down;
  string value=DoubleToString(rezult, 5);
  Alert("Down=",Down,",Up=",Up,",Zero=",Zero);
  Alert("СИЛА ВВЕРХ=",value);
 }
Down, Up and Zero values alert outputs, but does not want to divide.

Everything is inserted normally.

And where and what type of variables are declared?

 
rapid_minus:
Please help. I can't figure out the reason - it doesn't do division, gives 1.00000 result for all values of divisor and divisor.Below is a snippet of codeps. SRC is not inserted: if(Down>Up) {rezult=Down/Up; string value=DoubleToString(rezult, 5); Alert("Down=",Down,",Up=",Up,",Zero=",Zero); Alert("POWER DOWN=",value);}
else {rezult=Up/Down; string value=DoubleToString(rezult, 5); Alert("Down=",Down,",Up=",Up,",Zero=",Zero); Alert("POWER UP=",value);}The Alert outputs values Down, Up and Zero, but does not want to divide.
Isn't the result an int by any chance?
 
local variables: int i,up,dn,zr,Down,Up,Zero;
double op_i,cl_i,rezult;