Forum

MQL5 Standard Library: Generic - Compatible with MT4?

Hey all! I'm working in an EA framework so I can spin strategies up for both MQL4 and MQL5, and I'd like to implement a HashMap, since there's an implementation already done for MQL5 in /Include/Generic/HashMap.mqh, I gave it a shot and moved the folder to MT4 to see what happens. To my surprise

Question about backspace key event for graphical objects

Hey everyone! I'm aware MT4 has the backspace shortcut to delete the last created object. Even though this might be useful in some cases, when creating input fields for graphical panels it presents the issue where deleting a character will also delete an object. I found this comment on the forum

Communicating between terminals

Hey all! I'm starting a personal project, a custom copier that supports MT4 to MT5 (and viceversa) communication. I'm aware that on MT4's case the common folder can be used to store and read info between terminals , howeve I couldn't find anything too helpful about communicating between MT4 and MT5

Issue while trying to print long values and ulong values

Hey all, I'm experimenting with accessing the deal history, however, I can't seem to get the correct format specifier to properly display long values. Here's my code: HistorySelect ( 0 , TimeCurrent ()); int deals = HistoryDealsTotal (); ulong ticket; long pos_id; for ( int i = 0 ; i

Retrieve profit by position, best practice?

Hey all! I have doubts about the best way to handle working with the trade history. I'm aware a single position can result in multiple deals when closing it. For example, if I'm looking for coding a martingale system based on closed trades, what would be the best approach to handle reading the trade

Modularizing code: Same #include into various files, does it negatively affect performance?

Hey all! I'm doing a refactoring of my code base to improve my developer experience. I just had a thought and struggled to find any relevant information to get some clarity. Suppose the following: A base file exists, containing various defines and declaration of custom enums 3 separate files are

Trade arrows when EA executes a trade. Color parameter not available in MQL5?

Hey all! I've been trying to find some information about this but haven't had any luck. The OrderSend() function in MQL4 allows us to pass an argument to set the color of an arrow when a trade is executed. I find that very useful to diagnose bugs on live tests. I'm translating some code to MQL5 but

Calculate average entry price

Hey all! I've found that the most common method used for the average price calculation is: Sum of (Volume * entry price) / Sum of (Volume) This works just fine if all the trades are long or short. I read that if you do have long and short trades (

Indicators: Need help understanding lookback set-up

Hey all! I've been playing again with indicators, specially using the new events handler method with OnCalculate() instead of using IndicatorCounted(). I'm having some difficulties to fully understand why it works, here's the code: // Here, limit is equal to rates_total - prev_calculated since

Classes, Objects and Memory Management question

Hey all! I'm using some libraries from the standard library in MQL5. Yet, I have some questions about some things related to performance. I'm mainly playing with CPositionInfo at the moment, my questions are the following: 1- Is there any performance/runtime advantage by using the class to create an