Errors, bugs, questions - page 1142

 
ierehon:

Hi all!

Question, how to make a variable value updated on every tick during a minute, and then this sum is written to a separate value, when the next minute closes, the value of the sum is replaced by the new one?

Read the article! And others too.

As an example for your algorithm, I've sketched an indicator "tick counter". If you assign the required value to the variable b on every tick, you will get what you asked about.

Files:
TickSum.mq5  4 kb
 
ToMigVRN

Thanks for the article and the indicator! I will deal with it.


 
harbor:

people, who can tell me how in mql5 to calculatethe amount of free funds needed to open 1 lot of some symbol

I know how to do it in mql4, but in mql5 I cannot find it

double marg;
OrderCalcMargin(ORDER_TYPE_BUY, sym, 1, tick.ask, marg);
 
Youtube videos are not inserted with HTTPS.
 
MigVRN:

1) Do not create indicators on every tick!

2) Check whether the indicator is created or not, before accessing its values.

3) Check whether the requested values are copied from the indicator.

4) Always delete the calculation part of the indicator after the completion of the expert, otherwise it may at some point run out of RAM.

The problem was because you tried to copy the values from the indicator which hasn't been created yet. Make a rule - check the result of the functions you are calling.

Thank you, I got it!

But I change input parameters of indicators BP_var_s, BDev_var_s and MA_var_s "as we go along". What to do in this case ? Create and delete each time according to....

 
Alvin1976:

Thanks, I got it!

Only I change the input parameters of indicators BP_var_s, BDev_var_s and MA_var_s "as we go along". What to do in this case ? Create and delete each time according to....

There are several options here:

1) Indicator parameters change over time according to some criteria (conditions). Therefore, there is no need to recreate handles on every tick. Check the condition and, if it is fulfilled, recreate it.

Suppose the condition is that a "new bar" event occurs on a one-minute timeframe. Examples of the definition of a "new bar" event are many - search the website. I like this variant best.

2) If it is still necessary on each tick - to wait for termination of the checkCopyBuffer() in the loop (using sleep()). But most likely, the ticks will be skipped. As an alternative - to calculate ticks not for the entire history, but for the last couple of hundreds bars (to get into the code of standard indices and to correct the code) - it will skip less ticks.

 

Another problem has occurred.

long Min_Dist;

bool Inf=(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL,Min_Dist));
      if (Inf=true) Print("      mindist=", DoubleToString(Min_Dist)); 

Min_Dist variable in the tester gives zero all the time. I haven't checked it in the live market yet.

Why zero? It reads successfully.....

 
Alvin1976:

Another problem has occurred.

Min_Dist variable in the tester gives zero all the time. I haven't checked it in the live market yet.

Why zero? It reads successfully.....

Try it like this:
long Min_Dist;

Min_Dist=(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL);
      //if (Inf=true) Print("      mindist=", DoubleToString(Min_Dist)); 
Check the real value of SYMBOL_TRADE_STOPS_LEVEL
 
barabashkakvn:
Try this: Check the actual value of SYMBOL_TRADE_STOPS_LEVEL

It's the same thing. Zero. :(.

In the tester.

I'll check at the market on Monday.

I figured it out. This is the problem of a brokerage house. And not just one :-). I did not understand it at once because google gave nothing useful on SYMBOL_TRADE_STOPS_LEVEL but MODE_STOPLEVEL gave a lot of information.

I will use SYMBOL_SPREAD.

 
Roffild:
Youtube videos are not inserted with HTTPS.
Why does Youtube have HTTPS? Here is the usual code for the video -http://youtu.be/KG0PIVuJ2kU