//--- importing required dll files
#include <WinUser32.mqh>
#import "user32.dll"
int GetAncestor(int, int);
#define MT4_WMCMD_EXPERTS 33020
#import
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetAlgoTradingTo(bool trueFalse) {
//--- getting the current status
bool currentStatus = IsTradeAllowed();
//--- if the current status is equal to input trueFalse then, no need to toggle auto-trading
if(currentStatus != trueFalse) {
//--- Toggle Auto-Trading
int main = GetAncestor(WindowHandle(Symbol(), Period()), 2/*GA_ROOT*/);
PostMessageA(main, WM_COMMAND, MT4_WMCMD_EXPERTS, 0 );//Toggle Expert Advisor button
}
}
jonatassantanacaje
@jonatassantanacaje
Best posts made by jonatassantanacaje
-
RE: Help - Custom MQL Codeposted in Questions & Answers
Latest posts made by jonatassantanacaje
-
RE: Problem when using more than one graphposted in Questions & Answers
@jstap right, but when it comes to calculating profit, it uses the balance value + constant (TP_Money), if a pair already has low equity and I open another pair, the profit value of that other pair will have to be much higher compared to to the value of the constant...
exemple...
I start the EA on the EURUSD pair, Balance $1000 + Constant (TP_Money) $50...
My profit will only be realized when the equity reaches $1050 right...
Let's say my Equity drops to $850 and I start another operation in gold for GBPUSD, the balance value will still be at $1000, so the GBPUSD operation will only close after I make $100 in profit instead of $50.
-
Problem when using more than one graphposted in Questions & Answers
https://fxdreema.com/shared/DecAIEigd
How can I use this EA independently from other pairs? Your balance and equity checking system will close all simultaneous operations...
-
RE: Equity Protectorposted in Questions & Answers
I don't know the reason, but now it's working correctly, it waits for all operations to close and then disables algotrading
-
Equity Protectorposted in Questions & Answers
I am doing this capital protector, its function is to close all open operations and shut down Algotrading.
The problem is, before he can fill all open orders, algotrading is being deactivated, leaving orders open, how do I solve it?
-
RE: Help - Custom MQL Codeposted in Questions & Answers
Thank you very much @willramsey
Everything is working properly
-
RE: Help - Custom MQL Codeposted in Questions & Answers
@willramsey I don't need all the functions working, I just gave examples, whichever is easier to do will be ideal for me.
Turn off automation or close all windows
-
RE: Help - Custom MQL Codeposted in Questions & Answers
@willramsey Hello, thank you for your attention, I need to turn off ALGOTRADING, because I have about 5 robots open at the same time on different charts, and all of them have to stop trading at the same time.
-
RE: Help - Custom MQL Codeposted in Questions & Answers
//--- importing required dll files #include <WinUser32.mqh> #import "user32.dll" int GetAncestor(int, int); #define MT4_WMCMD_EXPERTS 33020 #import //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SetAlgoTradingTo(bool trueFalse) { //--- getting the current status bool currentStatus = IsTradeAllowed(); //--- if the current status is equal to input trueFalse then, no need to toggle auto-trading if(currentStatus != trueFalse) { //--- Toggle Auto-Trading int main = GetAncestor(WindowHandle(Symbol(), Period()), 2/*GA_ROOT*/); PostMessageA(main, WM_COMMAND, MT4_WMCMD_EXPERTS, 0 );//Toggle Expert Advisor button } }