Please edit your post and
use the code button (Alt+S) when pasting code
I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
Please edit your post and
use the code button (Alt+S) when pasting code
I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
Hello Keith, Thanks for the answer,
Tried to edit and paste it with the commands ALT+S as you told me and doesnt paste anything...
So... Do you know how to save the value of the price when executed ?
- Kenmei Miyamura: Tried to edit and paste it with the commands ALT+S as you told me and doesnt paste anything...
It works just fine do it again. (Go here and click on the image.) Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor - Kenmei Miyamura: Also, seems that "double" doesn´t return more than 4 digits, is there another way for 5 digits ?
Floating-point has an infinite number of decimals, it's your not understanding floating-point and that some numbers can't be represented exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia, the free encyclopediaSee also The == operand. - MQL4 programming forum
If you want to see the correct number of digits, convert it to a string with the correct/wanted accuracy. You don't want 5.
question about decima of marketinfo() - MQL4 programming forum 2016.05.18 - Kenmei Miyamura: What happens here is that when the OrderSend is executed in the Comment I can see the Value allthough it lasts only until new tick.OrderSend is not executed in a Comment; that is babel. What happens is
How can I save that value ?
- The If starts.
- The OrderSend is executed.
- You update the variable Takeprofit.
- The if ends.
- You print the variable.
- On the next tick, the variable is zero (not using strict), the if is false and does nothing, and you print zero.
-
Perhaps you should read the manual. MQL4 Reference → Language Basics → Variables → Static Variables and Global Variables
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. -
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
-
It works just fine do it again. (Go here and click on the image.) Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor -
Floating-point has an infinite number of decimals, it's your not understanding floating-point and that some numbers can't be represented exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia, the free encyclopediaSee also The == operand. - MQL4 programming forum
If you want to see the correct number of digits, convert it to a string with the correct/wanted accuracy. You don't want 5.
question about decima of marketinfo() - MQL4 programming forum 2016.05.18 - OrderSend is not executed in a Comment; that is babel. What happens is
- The If starts.
- The OrderSend is executed.
- You update the variable Takeprofit.
- The if ends.
- You print the variable.
- On the next tick, the variable is zero (not using strict), the if is false and does nothing, and you print zero.
-
Perhaps you should read the manual. MQL4 Reference → Language Basics → Variables → Static Variables and Global Variables
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. -
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
Ok,
Seems more difficul than I tought :)
Thank you for youre explanations !!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I would need some help please.
How can i save the Takeprofit Level ? I dont want to put it in the "OrderSend". Because i need it for something else.
What happens here is that when the OrderSend is executed in the Comment I can see the Value allthough it lasts only until new tick.
How can I save that value ?
Also, seems that "double" doesn´t return more than 4 digits, is there another way for 5 digits ?
Thanks
/////////////////////////////////////////////
void OnTick()
{
double OpeningPrice;
double Takeprofit;
if (OrdersTotal() ==0)
{
OrderSend(Symbol(),OP_BUY,0.1,Ask,NULL,NULL,NULL);
OpeningPrice = Ask;
Takeprofit=OpeningPrice+100*_Point;
}
Comment ("T/P is: ",Takeprofit);
}