Pedro Sanchez / Publications
Forum
importing mqh from the same EA folder
I have my EA which I have split into some files for readability. So I have one main .mq5 file and 2 secondary mqh files that I import into the main .mq5 file. While this is OK, in order to make this work, I need to have my main .mq5 file in the MQL5\Experts\Advisors folder, and the imported .mqh
Not enough money calculation
Just a quick question for an EA, I know about the error " not enough money " that sometimes pops-up when trying to place a trade above certain limits. My question would be, is it any (maybe easy) formula to calculate the trade parameters so it will avoid, or at least alert the user, that the trade
Deals and orders mixed retrieving history
Since I am not satisfied with the format MT5 exports the trade history to excel, I wanted to create my own with my custom format. Now, while the following function works as expected, getting the trades for the current day, it seems to be retrieving both orders and deals, but I would be interested
Delay when handling chart events
I have a test script that just draws a couple of HLines in the chart when pressing a keyboard key, any key (just for testing). Something like this: void OnChartEvent ( const int id, const long & lparam, const double & dparam, const string & sparam) { if (id== CHARTEVENT_KEYDOWN ){
Close order partially to get desired profit
Hi, I am trying to partially close some orders (2 or more) in a way that I can get some desired profit out of the trade...let me better explain with an example: Say that I have 2 (or more BUY orders) ongoing, say that all orders are in profit of, for example 567$, and my risk is 100$, with this, we
CLabel moves when rescaling or resizing window chart
I am using some CLabel insrtances in my EA and, while they work fine, I have not been able to make them stay in the desired time/price position when I re scale the chart o resize the chart window. I have been checking the CORNER and ANCHOR attributes but not sure if this is what I am looking for
NormalizeDouble problem
Do you guys have some other alternative for displaying a number in the chart window in a desired format other than NormalizeDouble function? I am asking because I have been using this function and, while this works quite ok in most of the cases, sometimes it seems to fail. Scenario : I am making
Stoploss/profit box in Mt4 with TradingView style
Hi, I was thinking about creating a SL/Profit box in MT4 similar to the one that they use in TradingView (imagen below). However, after an small attempt, I realized that, it is quite easy to use 2 rectangle objects for the SL and Profit parts, the chart candles are drawn on top of these 2
Price updates while dragging object
How do you guys do to get price updates from an object that is being dragged....let me explain.. I have an horizontal line placed at a let's say price XXXX, so when I click on that line to drag it up, I can get the CHARTEVENT_OBJECT_DRAG event, but it seems like it only gets received in the
Modify order already triggered
Hi, I wanted to modify an order using the command in MQL4 OrderModify, but, I think I might have not understood it correctly. My idea is to modify an order that is already ongoing, meaning that it has been already triggered. So that, for example, I can increase the TP by some points if the market