Errors, bugs, questions - page 1681
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It doesn't make any difference if the quotes are going or standing. You need to control condition prev_calculate==0 in the indicator - this is history swap and the second point - sparing mode of recalculation of changed bars, that is in fact rates_total -prev_calculate+1.
You should read what's written before replying. The code to reproduce the debugger bug! All the data to reproduce it is given.
Here is a script to reproduce the same bug
You should read what is written before answering. Code to reproduce the debugger bug! All data for reproduction is given.
I answered you - you don't care how many times OnCalculate is called. Your task is to provide either full or partial recalculation of the indicator by analyzing two values: rates_total, prev_calculate and the condition when prev_calculate==0.
There is no strict condition that OnCalculate() must be called once or twice. OnCalculate() does not owe anyone anything. But the programmer must control two values: rates_total, prev_calculate and the condition when prev_calculate==0.
I told you - you do not care how many times OnCalculate is called. Your task is to provide either full or partial recalculation of the indicator, analyzing two values: rates_total, prev_calculate and the condition when prev_calculate==0.
I care how many times the debugger is called and how many times OnCalculate is called. I'm an AWESOME person by nature! And I care about everything.
You are trying to teach me something without understanding the essence of the problem. Thank you, of course. But let's listen to and hear our opponent.
Nah, I'm running it on RTS now, when the kotirs are standing. Figured out that it's called once and the debugger lies, showing as if it's two. Code to play (run on a character where no ticks are going on)
After pressing F5 it will hit a breakpoint. And after a second press on F5 - similarly. While this should not be - as a confirmation, you can shorten that line in the code and try with it.
That's how you can see what's wrong. Watch the value of i at the first and second stops.
This is how you can see what the problem is. Trace the i value at the first and second stops.
Traced it, that's why I wrote it.
Found out that it's called once, but the debugger is lying, showing it as if it's two.
Why does the debugger return me to the same place after the second press on F5? No such thing happens with return(0), which is correct.
It doesn't lie, it stops twice - before calculating the bracketed expression, and after it, just before the return.
By the way, a very handy trick, in my opinion. I need to remember it. No need to put the result in parentheses into a separate variable to check the return value before exit, the debugger itself will stop again.
It doesn't lie, it stops twice - before calculating the bracketed expression, and after it, just before the return.
By the way, a very handy trick, in my opinion. I need to remember it.There is no need to put the result in brackets into a separate variable to check the return value before exit, debugger itself will stop for the second time.
Put the code like this:
and put the indicator on the chart. And then reload the terminal (you do not need to remove the indicator from the chart). You will see that OnCalculate() can be called once or twice or even three times. That is, as I said above - there are no strict rules.
Put the code like this:
and put the indicator on the chart. And then reload the terminal (you do not need to remove the indicator from the chart). You will see that OnCalculate() can be called once or twice or even three times. That is, as I said above - there are no strict rules.
I would agree that this is handy. But how can I find out the return result before the exit without a variable in the debugger?
Look in the Func() body to see what it returns before exiting. I'm talking about a special case. If the value will be calculated directly in brackets, of course, you can't.
PS. Although... Why not? At the second stop, look up all arguments return() and calculate the result. )