Forum

MT4 Indicator DRAW_ARROW Z Order

I've created an indicator to draw an arrow in the middle of a candle. When the body of candle is small I can clearly see the arrow has been drawn on chart. But when the body is big the arrow is hidden behind the candle as shown in the image. How can I set the z-order of the arrow

Getting last closed order loss

Hi, I'm trying to get the loss amount for the last closed order, using this code: void OnTradeTransaction ( const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { //--- if transaction is result of addition

Wrong values for close, open, low, high arrays in MetaTrader 5

I was getting wrong values in OnCalculate() method in my custom indicator. Here is a test indicator just logging the values. int OnCalculate ( const int rates_total, const int prev_calculated, const datetime &time[], const double &open[]

Using global arrays like Open[], Close[], Low[], High[] in custom indicator for MetaTrader 5

Hi, I'm converting an indicator written for MT4 to use it in MT5. It has a lot in small functions which uses Open[], Close[], Low[] and High[] global arrays in MQL4. I found that there are no equivalent of them in MQL5. Any suggestion how can I use those arrays? Hadi

Invalid price on multiple paris

Hi, My expert works fine when I use it on one pair. I mean drag the expert on the chart and let it execute. But when I use an array of pairs to open position on multiple pairs, It doesn't work. It seems still tries to open position on some other pair. It returns error 129 (Invalid price) static

Can't have more than one open position

Hi, I can't have more than one open position at a time in MetaTrader 5. Every time a position is opened previous position is closed instantly. Even in this simple code //+------------------------------------------------------------------+ //|

Auto closing a pending order

Hi, I have 2 pending orders, a buy_stop in price a, and a sell_stop in price b. I want each one of pending orders automatically closes when another one executes. I mean buy_stop pending order closes automatically when sell_stop pending order executes , and vice versa. how can I do it in mq4? Thanks

Open a pending order in at specific price

Hi, I want to write a code to open a pending order which: when the price reaches "a" the order opens, with TP and SL set to "p" pips. My problem is with "a" part. I've searched the forum for a day but couldn't find the answer. Thanks in advance, Hadi

Select last open order

Hi, I'm writing a code in which I open an order manually when I wanted, and the expert checks if there is an open order or not. if there is an open order it has to take control of the closing and some other stuff. the problem is, when i open an order manually, how can I select the open order to