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
Elapsed Time Calculation
I think I found my own answer in the date-time lesson. It assures that the time is in seconds since (some date in the past), so a simple subtraction will work. So, int elapsedTime = ElapsedTime (datetime dateTime1, datetime dateTime2) { int elapsedTime = dateTime1 -dateTime2; return(elapsedTime); } should give the results I'd like. I'll do some prints and see what I'm getting, as it doesn't seem right.
In an EA Is there any way to get the strategy tester to send emails? emails work in real time, but not in tester
Order of parameters in code
Ola!
Thanks, all you CodeMasters for your help.
One question:
is coding
{
OrderModify (OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, Green);
return(0);
}
same as coding
{
OrderModify (OrderTicket(), OrderOpenPrice(), Bid - TrailingStop * Point, OrderTakeProfit(), 0, Green);
return(0);
}
???
Does MQL calculates by written order or by mathematic logic - product (*) and divide (/) has priority before + and -?
Thank you,
Have fun,
Simon
Ola!
Thanks, all you CodeMasters for your help.
One question:
is coding
{
OrderModify (OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, Green);
return(0);
}
same as coding
{
OrderModify (OrderTicket(), OrderOpenPrice(), Bid - TrailingStop * Point, OrderTakeProfit(), 0, Green);
return(0);
}
???
Does MQL calculates by written order or by mathematic logic - product (*) and divide (/) has priority before + and -?
Thank you,
Have fun,
SimonIf you are not sure you can allways code like this:
{
OrderModify (OrderTicket(), OrderOpenPrice(), Bid - (TrailingStop * Point), OrderTakeProfit(), 0, Green);
return(0);
}
Kalenzo MaMan!
Kalenzo!
Thank you for answer. I am aware of coding the way you replied, since brackets solve the mystery and remove the mist, although the question remains:
Does MQL calculates by written order or by mathematic logic - product (*) and divide (/) has priority before + and -?
Since I am learning MQL, I need to know the answer for further reference.
Love you all,
Have fun,
Simon
Why not do a simple test yourself and answer your own question? That way you'll be 100% sure of the answer.
Lux
As this is a very 'c' like language, I'd be very suprized if the precidence was not as follows (from Order of Operations in Wikipedia). Personally, I'd use paranthesis as it gets too hard to read / remember by the time you get down to 5 and lower:
The relative precedence levels of operators found in many C-style languages is as follows:
1 () [] -> . :: Grouping, scope, array/member access
2 ! ~ - + * & sizeof type cast ++x --x (most) unary operations, sizeof and type casts
3 * / % Multiplication, division, modulo
4 + - Addition and subtraction
5 <> Bitwise shift left and right
6 < >= Comparisons: less-than, ...
7 == != Comparisons: equal and not equal
8 & Bitwise AND
9 ^ Bitwise exclusive OR
10 | Bitwise inclusive (normal) OR
11 && Logical AND
12 || Logical OR
13 ?: Conditional expression (ternary operator)
14 = += -= *= /= %= &= |= ^= <>= Assignment operators
Kalenzo!
Thank you for answer. I am aware of coding the way you replied, since brackets solve the mystery and remove the mist, although the question remains:
Does MQL calculates by written order or by mathematic logic - product (*) and divide (/) has priority before + and -?
Since I am learning MQL, I need to know the answer for further reference.
Love you all,
Have fun,
SimonHello!
Take a look here:
Operations and Expressions MetaQuotes Language 4
"Each group of operations in the table has the same priority. The higher the priority is, the higher is the group's position in the table.
The execution order determines the grouping of operations and operands.Use parentheses to change the execution order of the operations."
Order of math function - reply received
Mis Amigos!
I thank you all for your reply and help (bow).
I indeed found answer to my question while retyping some scripts. But your answers revealed much more informations (thumb up).
Have fun,
Simon
Modify EA to works with FIFO
I 've been searching around , but still haven't find any guide How to modify EA to work with FIFO rules, What is the best way to implement this, Since i can't set SL any more..and how to Set TP to close first order if i have 2 order open on the same pair..
Can any one give me some tips and sample code..
Thanks