E.g. Page 4 GetTypeLastClosePos - Return type of last closed position or -1 GetTypeLastOpenPos - Return type of last open position or -1 isCloseLastPosByStop - Returns the flag of the last position closed by Stop isCloseLastPosByTake - Returns the flag to close the last position by Take. isLossLastPos - Returns the flag of loss of the last position. isTradeToDay - Returns the flag of trading today NumberOfBarCloseLastPos - Returns the close number of the last position or -1. NumberOfBarOpenLastPos - Returns the bar number of the last position opened or -1. NumberOfLossPosToday - Returns the number of losing positions closed today. PriceCloseLastPos - Returns the closing price of the last closed position.
Thank you for your reply. I have seen these functions, but they have 1 big disadvantage. They use more functions in the function body and more functions in the functions ... Imho, these are just examples, not guides. + The author doesn't give any reason for using particular functions and operators. Not good for a beginner in general.
Question: how do I sort two (or more) arrays by one of them (just like in Excel, select two or more columns and sort the data "Sort by..."? If anyone has worked with this, please advise
Hello, Could you please tell me how to spell the condition to enter into the trade the following way: IF PRICE IS TRANSFERED (UNDER or over) MA-34 TO ENTER THE TRADE.
I want to change the conditions of entry into the trade in my Expert Advisor. My current condition is IF PRICE IS BETWEEN OR ALSO MA-34. HOW TO CHANGE IT FROM ABOVE OR EQUAL TO CROSSED.
Please advise where the mistake is. I'm getting the exact value, but I can't make the "Obem_Pozic" value to be 1.00, so I can calculate the lot for displaying, I don't want to normalize values, it just gives out 4 decimal places.
Please advise where the mistake is. I'm getting the exact value, but I can't make the "Obem_Pozic" value to be 1.00, so I can calculate the lot for displaying, I don't want to normalize it, it just gives out 4 decimal places.
int start() { //Calculate the value of one lot Stoimost_Lot=(AccountBalance()/2)/82-2; NormalizeDouble(Stoimost_Lot,2);
//Calculate the volume of the lot (leverage 1:200), 1 lot (1.00) = 100,000 base currency (USD) Obem_Pozic=Stoimost_Lot*0.1; NormalizeDouble(Obem_Pozic,2);
//write a message Alert("# 1 lot = ",Stoimost_Lot," USD #"," Volume = ",Obem_Pozic," #"); }
prints 4 decimal places in Alert. use DoubleToStr() in order to display the message accurately
ilunga: The Alert function should be used with DoubleToStr() to display more accurately
You're here too :) I need value to store type double, for further assignment to the lot. And using DoubleToStr(), I will format it as string, that's exactly the problem. Is it possible to leave two decimal places, but retain the double type.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Put this address on your browser "button". There you will find answers to all such questions:
https://www.mql5.com/ru/forum/131859
E.g. Page 4
GetTypeLastClosePos - Return type of last closed position or -1
GetTypeLastOpenPos - Return type of last open position or -1
isCloseLastPosByStop - Returns the flag of the last position closed by Stop
isCloseLastPosByTake - Returns the flag to close the last position by Take.
isLossLastPos - Returns the flag of loss of the last position.
isTradeToDay - Returns the flag of trading today
NumberOfBarCloseLastPos - Returns the close number of the last position or -1.
NumberOfBarOpenLastPos - Returns the bar number of the last position opened or -1.
NumberOfLossPosToday - Returns the number of losing positions closed today.
PriceCloseLastPos - Returns the closing price of the last closed position.
Hello, Could you please tell me how to spell the condition to enter into the trade the following way: IF PRICE IS TRANSFERED (UNDER or over) MA-34 TO ENTER THE TRADE.
I want to change the conditions of entry into the trade in my Expert Advisor. My current condition is IF PRICE IS BETWEEN OR ALSO MA-34. HOW TO CHANGE IT FROM ABOVE OR EQUAL TO CROSSED.
if(GO && SignalType_2 && Bid >= MA2Please advise where the mistake is. I'm getting the exact value, but I can't make the "Obem_Pozic" value to be 1.00, so I can calculate the lot for displaying, I don't want to normalize values, it just gives out 4 decimal places.
I am writing in MQL4.
Please advise where the mistake is. I'm getting the exact value, but I can't make the "Obem_Pozic" value to be 1.00, so I can calculate the lot for displaying, I don't want to normalize it, it just gives out 4 decimal places.
I wrote it in MQL4.
//Variable representation
double Stoimost_Lot;
double Obem_Pozic;
int start()
{
//Calculate the value of one lot
Stoimost_Lot=(AccountBalance()/2)/82-2;
NormalizeDouble(Stoimost_Lot,2);
//Calculate the volume of the lot (leverage 1:200), 1 lot (1.00) = 100,000 base currency (USD)
Obem_Pozic=Stoimost_Lot*0.1;
NormalizeDouble(Obem_Pozic,2);
//write a message
Alert("# 1 lot = ",Stoimost_Lot," USD #"," Volume = ",Obem_Pozic," #");
}
The Alert function should be used with DoubleToStr() to display more accurately
You're here too :) I need value to store type double, for further assignment to the lot. And using DoubleToStr(), I will format it as string, that's exactly the problem. Is it possible to leave two decimal places, but retain the double type.
I solved the problem, in case you're wondering, converted to a string, then back to a double. :) Thanks for the tip, I'm a bit confused :)
I solved the problem, in case you're wondering, converted to a string, then back to a double. :) Thanks for the tip, I'm a bit slow on the uptake :)
You didn't quite get it right.
DoubleToStr should be used exactly in Alert- for displaying it on the screen. Internally, the number is stored as you need it to be