[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 105

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
look here: https: //docs.mql4.com/ru/basis/operations/math
You can do that too.
wouldn't b be equal to one?
I checked. One.
Create flags, e.g.
For TP1 - bool TP1, for TP2 - bool TP2, etc...
Initially their values are false.
Before the next closing, you do a check:
if (!TP1) {code for partial closing of the first part, after successful closing write TP1=true}
if (!TP2) {code for partially closing the second part, after a successful closing write TP2=true}
... and so on for all parts...
So the flags will signal that each part has been closed once already...
Thanks! Reworked the code... TP0==false I put it at the beginning of the program .
The problem remains: 1st part closes and immediately starts to close 2nd :-( ..., with error 131 for 2nd, understandable - lot size different ) But another nuance is that for 1st part ""Alert ("Closed ",Lot," Lot Buy ",Ticket);"" does not write in log, i.e. does not reach verification Ans==true. Why???? Below is a piece of code...
Thanks in advance!
while(true) // Close horde loop.
{
if (TP0==false && (Cls_B0==true ||Cls_S0==true))
{
LotC=MathRound(Lot/4/Step)*Step;
Alert("Lot-",Lot, "Attempting to close-",LotC," Lot Buy ",Ticket,. Waiting for reply...");
RefreshRates(); // Refresh data
Ans=OrderClose(Ticket,LotC,Bid,5); // TicketClose Buy 1/3 lots?
if (Ans==true) // It worked :)
{
TP0=true;
Alert ("Closed ",Lot," Lot Buy ",Ticket);
break; // Exit from closed loop
}
if (Fun_Error(GetLastError())==1) // Error handling
continue; // Retry
return; // Exit from start()
}
Dear programmers!
Help, please. The indicator draws values on a bullish latent divergence, and does not draw a bearish latent.... It writes, that error 4002 - array index - out of range.
I seem to have fixed everything... It took me a whole evening... And it's a shame - the code is the simplest... But it's drawing bulls with arrows, but not bears... PLEASE! What is the error in?????????????????????
Alena,
You need to allocate memory for arrays vpadcci[], v[], hh[], ss[]. They are declared as dynamic, but their size is not specified anywhere. The size of a dynamic array is specified using the ArrayResize() function.
P.S. And please use the SRC button to insert code
Question for MT5. How can I know that the Strategy Tester has completed its work? Other than visually :)
The deinit() function is executed when the job is completed. Consequently, if we get there, it means that the expert's work is finished. To determine whether the work in the tester is in progress, use function IsTesting().
Sorry, I noticed that this question is related to MT5.
It is the same there, only OnDeinit() and MQL5InfoInteger(MQL5_TESTING).
Alena,
You need to allocate memory for the arrays vpadcci[], v[], hh[], ss[]. They are declared as dynamic, but their size is not specified anywhere. The size of a dynamic array is defined using the ArrayResize() function.
P.S. And please use SRC button to insert code
Thanks so much for the reply, I'll look into it!
Please advise how to correctly record that VininI LRMA indicator colour.mq4 https://www.mql5.com/ru/code/8200 has changed.
If you use double iCustom(string symbol, int timeframe, string name, ..., int mode, int shift). I cannot figure it out. I wrote iCustom(NULL,0, "VininI_LRMA_color",55,0,1) and don't know what to do with it))
The values of the lines are in the indicator buffers 1 (green) and 2 (red). When a green line is drawn on the chart, the variable up on bar 1 has the value of this line, and the variable dn=EMPTY_VALUE and vice versa. EMPTY_VALUE is an empty buffer value, its numeric value is 2147483647.
You can then use these values as you wish.
Can we create an EA which closes all orders when the take-profit of the last opened order triggers?