Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 884
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
Good afternoon, gentlemen. )) apologies for the amateurism...
I don't understand how OrderClose works :(
I need a maximum of 1 order, i.e. before opening a new one, i want the previous one to be closed...
Why does it not work this way?
OrderClose(nom, 0.01, Bid,5, Red);
OrderSend(Symbol(), OP_SELL, 0.01 , NormalizeDouble(Bid,5), 3 , NormalizeDouble(Ask+0.0005,5), NormalizeDouble(Bid-0.0008,5), "", nom,0,Red);
the log is basically swearing about an invalid Ticket .
in OrderClose instead of nom, what should I put? or am I thinking in the wrong direction at all?)
Try minStopLoss = Current price +/- (MaxValue(2*Spread, StopLoss));
I studied it, but nothing new, apparently it is (new to me) of course, obvious to all the initiated, self-explanatory. I couldn't find anything new, except the above-described feature of mutual arrangement of buffers during indexing. This sequence respected, got an even cheesier picture.
Pictures below, file attached
Maybe you are very unlucky but I don't like poking around in other people's code. All the more so when it comes to fixing it...
The next question: how often do you think the indicator value will be exactly 50?
ColorHistogram_2Buffer1[i]=50;
As I understood the problem, it should be one colour >50 and another <50, but I haven't seen ==50. Of course, to eliminate loss in case ==50, we must add to one of the comparisons >=50 or the other <=50, as religion allows. It may look better.
And the second question: how much you think it was necessary to change all indexing of buffers? After reindexing, did you fix everything in the code exactly? Maybe it would be easier to make colour buffer index 4, and auxiliary buffers 5 and 6 accordingly. There would be less need to edit and less chance of making some more errors.
I tried it. Two spreads is 24, will not work that way, starts working at 19 from closing price. From the current open price it works with three spreads.
Checked. Works
This is all strange, it says the same minStopLoss = Current Price +/- (max value(2*Spread, StopLoss)), only under Current Price we understand not the open price of the order but the mirror price.
Why is the double spread suitable?
Two more questions arise.
1. Why is SymbolInfoInteger used to get Digits() and Point(); values ?
2. Why is an entry (int) used before calling the SymbolInfoInteger function ? As I understand it, this is a forced type conversion.
Checked it. It works
This is all weird, they still write the same minStopLoss = Current Price +/- (maxZen(2*Spread, StopLoss)) but the Current Price is not the opening price of the order but the mirror price.
Why is the double spread suitable?
Two more questions arise.
1. Why is SymbolInfoInteger used to get Digits() and Point(); values ?
2. Why is an entry (int) used before calling the SymbolInfoInteger function ? As I understand it, this is a forced type conversion.
To get Point() SymbolInfoInteger will not work in any way.))
In general, it is necessary to remember that Point() or _Point is only for the current symbol. For characters other than the one on which the EA works, you must use this very function.
The SymbolInfoInteger function returns not only int values, but also long, bool and enumerations.
Sergey Voytsekhovsky, thanks for your help. And one more question, if you don't mind, please suggest the function inverse to functionCharToStr
(to get its code from a symbol), because I've got functions for it in Beisic and Delphi, but in C++, as far as I know, there are two methods:
1 -Ascii_cod function, which is not in mql4
2. - Direct type conversion. But my code is
string st="A";
Print ("Character code A=",(int)st);
Outputs text Character code A=0.
What to do?
Sergey Voytsekhovsky, thank you for your help. And one more question, if you don't mind, could you suggest the function reverse functionCharToStr
(to get its code from a symbol), because I've got functions for it in Beisic and Delphi, but in C++, as I understand it, there are two methods:
1 -Ascii_cod function, which is not in mql4
2. - Direct type conversion. But my code is
string st="A";
Print ("Character code A=",(int)st);
Outputs text Character code A=0.
What to do?
StringToCharArray, unlike the wiki function, doesn't convert just one character at a time, but can convert a string to an array of ucar type with codes of all characters in the string.
mql4 also has such a function.
To get Point() SymbolInfoInteger will not work in any way.))
In general, it is necessary to remember that Point() or _Point is only for the current symbol. For characters other than the one on which the EA works, you should use this function.
The SymbolInfoInteger function returns not only int values, but also long, bool and enumerations.
Actually Point has value double. This means that we should call it from SymbolInfoDouble
Well, Point actually has a value of double. It means that the request should be made by SymbolInfoDouble
It's about these functions for MQL4 from post #65:
I didn't see where Point is obtained via SymbolInfoInteger()
It's about those MQL4 functions from post #65:
I didn't see where Point is obtained via SymbolInfoInteger()
Yes, the same. We have slipped through it. The main thing is that he understands what's what...