Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1229
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
My understanding is that it's like a periodic check for availability. (Is there EURUSD? and is there an order with the specified Magic?) If any of the conditions is missing, we open a position. Only if both of those conditions are met, we open a position.
We are then asked in Step 2. Suppose we have one order opened manually. Then we meet the first condition (we have the same symbol) and we will not meet the second condition, since this order does not contain magic. And if one of the conditions does not match, then the code should open the order. This is exactly what the code does. But at the next tick, it opens the third, fourth and fifth order.....
Why does it open a third order?
But there are two orders that meet both conditions in total. There should be a check (change to return(0)), not an opening. , not the opening.
Good night all! Can you tell me if you can write a code in mql5 that will draw a line on the chart (picture attached) and record all coordinates of this line in the file? If you want to draw a line and fill it with the coordinates, then you need to do a simple tracing of the line.
Everything is in the documentation.
Everything is in the documentation.
Thanks for the tip, maybe you can help me build one of these for free of course.
Thanks for the tip, but maybe you can help me build one of these things, not for free of course.
Not for free - that's for you)))
My understanding is that it's like a periodic check for availability. (Is there EURUSD? and is there an order with the specified Magic?) If any of the conditions is missing, we open a position. Only if both conditions are met, we open a position.
We are then asked in Step 2. Suppose we have one order opened manually. Then we meet the first condition (we have the same symbol) and we will not meet the second condition, since this order does not contain magic. And if one of the conditions does not match, then the code should open the order. This is exactly what the code does. But at the next tick, it opens the third, fourth and fifth order.....
Why does it open a third order?
But there are two orders that meet both conditions in total. There should be a check (change to return(0)), not an opening. but not the opening.
== - if it is equal != - if it is not equal. Continuity - end of loop iteration and start of a new loop iteration. Breaking - cycle termination and transition to the next operator following the cycle, return - function termination, in your case Onstart and waiting for a new tick. And if an order with your magik is open, it should end the function and leave to wait for a new tick.
Question, if you want to open an order in the current window, why do you need to specify the tool explicitly, or do you want to open orders from the window of another tool? It is also not clear how many orders you want to open. According to your code, only one order can be opened and only after it is closed, the second one will be opened. You have one magician and one open window tool. Also, the order opening conditions are checked for the Current instrument and not for the Eurobucks.
== - if equal != - if not equal. Kontinue - terminates the loop iteration and starts a new loop iteration. Break - terminates the loop and goes to the next operator following the loop, return - terminates the function, in your case Onstart and waits for a new tick. And if an order with your magik is open, it should end the function and leave to wait for a new tick.
Question, if you want to open an order in the current window, why do you need to specify the tool explicitly, or do you want to open orders from the window of another tool? It is also not clear how many orders you want to open. According to your code, only one order can be opened and only after it is closed, the second one will be opened. You have one magician and one open window tool. Also, the order opening conditions are checked for the Current instrument and not for the Eurobucks.
- Yes, I want to open in the current window;
- One order. The next order is not opened until the previous order is closed.
"Also, the order opening conditions are checked for the Current instrument and not the Eurobucks." - then ?
- Yes, I want to open in the current window;
- One order. The next order is not opened until the previous order is closed.
"Also the order opening conditions are checked for the Current instrument and not for the Eurobucks." - then ?
And what then, for example, you have a window open not Eurobucks, but the Eurofunt, you compare the selected order symbol with Eurobucks, if it is true, then on the Eurobucks there is an order, and if our magik, then returnee from the OnStart function, and if not, then we set an order on the Eurobucks, but Kloz, High, Asc, Bid, you will have an error when opening orders, because Bid and Asc for these instuents are different. And Symbol() will return the symbol of the current window and no error will occur.
You can use a template from the meta editor, there is a New button at the top left. OnStart function is still used, but it's not right, and OnStart is for scripts. The right template.
Correct code. Your order comment is missing, and the magician is not accounted for in your code. In the warnings to the opening line note Implicit type conversion of a number to a string!!!
there are many errors in your example
there should be:
here prices are not normalized OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-SL*Point,Bid+TP*Point,"My order",MagicNumber,0,clrGreen);
Here I don't understand the logic why the exit from OnTick() is necessary if the condition is false.
perhaps, we should continue the loopand just count the number of orders
Your example is very simple in logic and it would be difficult to modify it for other tasks... maybe he would like to add trailing