Forum

GlobalVariables?

Does anyone has a sample of a code using GlobalVariables in the simplest form in MQL4? I want to use it in my EA but I have not fully understand how to use it yet. I have read the https://docs.mql4.com/globals but I'm still confused, it's better if I get more examples. Let's say I want to stop

Tips on limiting new orders with multiple charts?

I made an EA with a logic that its entries only opens on new candles. I've also set a limit on how many orders should be only be open at the same time. See this example portion of my code: bool CheckForNewBar() { static int LastNumberOfBars; bool NewBarAppeared = false ; if ( Bars

EA Decompile Protection

How hard/easy it is for people to decompile an EA if I were to provide a copy to someone? (Not in MQL5 Market) The only security I've thought is to make the EA only run specifically to their broker account number - or else the EA would remove itself from the chart. This would make it difficult if a

Creating a rectangle object in MQL4 - not showing up

I'm attempting to create a simple panel on the chart with an EA. It's my first time to create one by the way. My first step was to create a simple rectangular object but it doesn't seem to show up in the chart when the EA is initialized. I could create buttons and labels but the rectangular object

Checking if a string exists in an Array

If for example I made a string, a bool, and a string array, string A = "CCC333"; bool Check; string List[ 4 ] = { "AAA111" , "BBB222" , "CCC333" , "DDD444" }; And I want to check if the string A exists in the list (where the bool "Check" should turn out true), how should the code be written? I

EA using two indicators with different timeframes

If I were to develop an expert advisor using indicators with different timeframes, would it work only being installed in one chart on MT4? For example: I'll use EMA on H4, and then MACD on M15 double MA = iMA ( Symbol (), PERIOD_H4 , 26 , 0 , 1 , 0 , 1 ); double MACDBase = iMACD ( Symbol ()

Selecting the last order opened of the chart in MQL4

I'm a beginner in MQL4, I just want to ask if the code I've written is correct - or is there a better way to write it. It's working well as expected on backtests , but things go wrong when I try it on a demo bot with multiple charts. I want to get info about the last order's price of the same chart

Do I need to attach the EMA indicator on a chart that has an EA that uses the EMA indicator?

If I use an EA that uses MT4 standard indicators (such as EMA, RSI, etc), do I still need to attach those indicators on the chart or the EA could still run without it

Is there a 3rd party program that can track multiple running MT4/MT5 accounts?

If, for example, I have 5 running MT4 in a VPS with an EA and I want to track each account's live running P/L and balance - is there a way I can do that without having to login in my MT4 or VPS? I'm looking for a 3rd party program where I can see all of my account's status live

EA Closing new orders continuously after new order with the wrong TP

We coded a simple martingale strategy EA that immediately opens new order and closes upon reaching TP. For this demo bot, we had $1 as TP. But for some reason, THIS happens: I suspect this to be a latency problem from a laggy VPS (where multiple demo bots are running) but I'm not sure. Would