Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1051
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
I do not understand where the answer is. I mean this: "The function integrates the check of the stop flag state of the Expert Advisor every 0.1 second"? If so, how can this flag be removed?
No, if you'd read to the end you'd see the answer to the question...
Note
The Sleep() function cannot be called from custom indicators, as indicators are executed in the interface thread and must not slow it down. The function has an embedded check of the expert's stop flag status every 0.1 second. The Sleep() function in the strategy tester does not cause any delays.
Start by sticking this at the end of the indicator. Once you see the mark on the screen, figure out how to put what you want into it. Here you get advice, but you have to do it yourself.
int Number=25;
if(H==H1&&H1==H2)
{if(J == true) {ObjectCreate(PatternText[shift],
OBJ_TEXT, 0, Time[shift1], High[shift1] + Range*5);
ObjectSetText(PatternText[shift], "pattern", 10, "Arial", Red);
downArrow[shift1] = High[shift1] + Range*0.5;}if(setalert == 0 && Alert == true) {pattern = "pattern";setalert = 1;}}
if(ObjectFind(0, "Text")<0) // check output label
{
ObjectCreate("Text", OBJ_LABEL, 0, 0, 0); // creation
ObjectSet("Text", OBJPROP_CORNER, 1); // Top right corner
ObjectSet("Text", OBJPROP_XDISTANCE, 10); //X
ObjectSet("Text", OBJPROP_YDISTANCE, 10); //Y
}
ObjectSetText("Text", string(number), 14, "Arial",Black); // Output to label
}
return(0);
}
The issue is solved in a much simpler way.
StringLen("tickEURUSD")
It's certainly easier with it.... Maybe it was missing at the time, or got lost... It's definitely missing in my favourite TurboPascal. I used to do logarithm multiplication.
For a while after switching to updated mql4 there was a bug in the documentation. Clicking on MathLog10 opened MathLog help
I wrote to servicedesk about it, but they fixed half of it and left the other half...
log(10) really isn't 1, but the fact that mql doesn't have a decimal logarithm surprises me...
What is it then? https://docs.mql4.com/ru/math/mathlog10 although there is an error in the text.
The question is much easier to solve.
I'll answer right from the last post.
What are logarithms I understand, I didn't understand what it's for in that code, but after your and that comrade's correspondence I understood that it's for decimal places, right?
Couldn't it be done in any other way? Why do I need it in code(int) ? Why is your way better than the line I provided ?))
thanks a lot)
I'll answer right from the last post.
I understand what logarithms are, I didn't understand why in that code, but after your and that comrade's correspondence I understood that it's for determining the number of decimal places, right?
Couldn't it be done in any other way? Why do I need it in code(int) ? Why is your way better than the line I provided ?))
thanks a lot)
Yes, to determine the number of decimal places. This is needed to normalize lot value if lot is defined by some formula and result may have more decimal places than allowed. In some cases, you might just put a deuce, but then you might encounter an error, so it's better to define it programmatically.
There is another way of doing it. There are two ways of solving this problem. One is to convert number to string, define string length, find index of dot character and the difference between string length and index of dot character will be evaluated as fractional part of number. And on mql5 forum, you can find several variants, some thinner, some easier.
Here is one more variant.
This function defines number of decimal places of absolutely any number.
The algorithm is outrageously simple, we should consider how many times the residue from division by 1 will be greater than zero.
I didn't say my way is better. Each programmer writes the way he sees the problem solution.
Number of type double, even if it has no significant digits in the fractional part is like, for example, 2.0, which is not quite correct, and in order to get a normal integer it is converted to int type implicitly.
Note
The Sleep() function cannot be called from custom indicators, as indicators are executed in the interface thread and must not slow it down. The function has an embedded check of the expert's stop flag state every 0.1 second. The Sleep() function in the strategy tester does not cause any delays.
Everyone is so smart that it is scary to look at them. I wrote that the slip was ignored in the Strategy Tester (which is clear), but all positions are open as I've specified. But on the demo slip does not work, and the position is opened only one, and that closes immediately. This is the problem I cannot solve.
Note
The Sleep() function cannot be called from custom indicators, as indicators are executed in the interface thread and must not slow it down. The function has an embedded check of the expert's stop flag state every 0.1 second. The Sleep() function in the strategy tester does not cause any delays.
Everyone is so smart, it is really scary. I wrote that slip was ignored in the tester (which is clear), but all positions are open as long as I've specified them. But on the demo slip does not work, and the position is opened only one, and that closes immediately. This is the problem I cannot solve.
Where is your code?
Maybe this may help?