[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 358
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Man, the code itself takes two lines!
OrderSend("XAUUSD",OP_BUY,1,Ask,10,Bid-200*Point,Ask+100*Point,0);
if(S_M_0<S_S_0 && S_M_2>S_S_2)
OrderSend("XAUUSD",OP_SELL,1,Bid,10,Ask+200*Point,Bid-100*Point,0);
Man, the code itself takes two lines!
With one lot, such a swap is simply not realistic. On another test lot the position opened and closed on the TP on the same day without a rollover, and the result is the same.
Ok, thanks for the quick help, I'll leave that question until tomorrow :)
Wrote just 1 line in EA - Alert output:
Putted on the tool - at least 1 alert came out...
See here, removed TP and SL. Closing takes place only by condition.
I have removed conditions for Sell, to check only for Buy.
As a result, all deals are visually closed with profit, judging by the chart, and the history turns out to be minus!
By the way, it works as prescribed on EURUSD, but there's a problem with gold.
Maybe I didn't take something into account?
Checked in another terminal, everything is fine.
Apparently there is something wrong with the candlestick data in the first terminal. Maybe it's really midnight rolls with a crazy coefficient...
Good day to all.
The fact that control from the keyboard (e.g. opening an order) is possible has been explained to me and even shown an example. But it's very difficult to understand the tasks of called functions, even without having read their purpose.
I have seen an example of such a task in somebody else's code and faced the same problem ( I don't know anything about these functions ) Please explain.
Here is an example:
As I understand the GetAsyncKeyState function is responsible for assigning buttons (codes).
I tried to specify the following condition: if (GetAsyncKeyState(88)) OpenBuy(Lots,0,MagicNumber);
No reaction to key X could you write a piece of code for my further study which would execute any action when pressed on the keyboard (with explanations)
And if it's possible for me to get a link to some kind of resource for learning.
P.S. As far as I understand it is a library of the Windows system itself (probably providing a connection between the terminal and the operating system) maybe I'm wrong.
Looking at an example of such a task in someone else's code faced this very problem (I don't know anything about these functions), can you explain please?
Key line: #import "user32.dll"
The functions listed below this line in your code, these functions are described in the user32.dll library documentation.
Good day to all.
The fact that control from the keyboard (e.g. opening an order) is possible has been explained to me and even shown an example. But it's very difficult to understand the function's tasks without having read their purpose.
I have seen an example of such a task in somebody else's code and faced this very problem ( I don't know anything about these functions ) explain please?
Here is an example:
As I understand the GetAsyncKeyState function is responsible for assigning buttons (codes).
I tried to specify the following condition: if (GetAsyncKeyState(88)) OpenBuy(Lots,0,MagicNumber);
No reaction to key X could you write a piece of code for my further study which would execute any action when pressed on the keyboard (with explanations)
And if it's possible for me to get a link to some kind of resource for learning.
P.S. As far as I understand it is a library of the Windows system itself (probably providing a connection between the terminal and the operating system) maybe I'm wrong.
The highlighted is wrong. Look at MSDN. Here is an example of operation with function GetAsyncKeyState( ):