[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 462

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
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 >= MA2
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.
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