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
is I am selling and when bid reach my first take profit (variable = profit),
then i want to close 80% of the position..
If the variable "profit" is a price level (not a profit in points, pips or currency) then the first condition could be so. If the variable "magic" is a ticket number (not a magic number) the second condition could be so too. In the function OrderClose use OrderClosePrice() instead of Bid as Keith said. Realize that we see a piece of your code and we can't have an overall picture.
If the variable "profit" is a price level (not a profit in points, pips or currency) then the first condition could be so. If the variable "magic" is a ticket number (not a magic number) the second condition could be so too. In the function OrderClose use OrderClosePrice() instead of Bid as Keith said. Realize that we see a piece of your code and we can't have an overall picture.
Thanks for your comment.
I really appreciate. it is true that I do not know what I am doing with this magic number.
playing with it for nothing I think.
thanks for pointing out that to me.
Have a good week-end
Luciole
If the variable "profit" is a price level (not a profit in points, pips or currency) then the first condition could be so. If the variable "magic" is a ticket number (not a magic number) the second condition could be so too. In the function OrderClose use OrderClosePrice() instead of Bid as Keith said. Realize that we see a piece of your code and we can't have an overall picture.
I do not understand the problem with the magic number.
i use it only to make sure that my EA manage the trade i want only..
1. Why do you suggest that was a problem?
2. If i do not want a magic number what should I write instead?
I do not understand the problem with the magic number.
i use it only to make sure that my EA manage the trade i want only..
1. Why do you suggest that was a problem?
2. If i do not want a magic number what should I write instead?
and then you can select the order by ticket:
If you want to filter your orders by magic number you can use something like this:
You mix a magic number with a ticket. Magic number is a number which can help you to recognize which EA created the order (you needn't use it). But ticket is a unique number for each order (it be assigned by broker). You used "magic" as a ticket in OrderSelect() in your first post but there must be used "ticket" instead of. You should read documentation or search for using magic number and ticket in this forum. In simplified way your code should look like:
and then you can select the order by ticket:
If you want to filter your orders by magic number you can use something like this:
I understand clearly what you are saying.
So, I change and everything work, but the variable "magicNumber" appear in red through all the codes.
Do you know what this mean?
I understand clearly what you are saying.
So, I change and everything work, but the variable "magicNumber" appear in red through all the codes.
Do you know what this mean?
This is standard color text formatting in MQL editor. If you declare a variable as extern or input then it will be red in the code. As you can see numbers are green, built-in functions are violet...
This is standard color text formatting in MQL editor. If you declare a variable as extern or input then it will be red in the code. As you can see numbers are green, built-in functions are violet...
Thanks :)