MQL4 and MetaTrader 4 - page 437

[HELP] "CHARTEVENT_OBJECT_CLICK" - OBJPROP_STATE Is Always Returning 0 (False) - I used OBJ_LABEL to Create Wingdings For Fixed Position.. Bug? I clicked the wingdings but ObjectGetInteger(0, "show_buff_obj"+0, OBJPROP_STATE); is returning Boolean value is 0 (false).. It should be true when clicked...
Hello there, I am creating a  buttons panel, so far is so god, but whent i am trying to aatach zoom function to my zoom buttons, I get this bug : The timeframe buttons do not released, and i cannot erase a template, when i want to save it. Here is my code (What is wrong please ? ) : long...
I have a buffer array named JPY_Band[] and another named CHF_Band[]. I want to subtract the value in the first index from the value in the first index of the other. Something like this double result = JPY_Band[1] - CHF_Band[1] this is not giving me what I expect. In fact it's not returning anything....
Hi, everyone. I'm wondering if someone can help me on this. Suppose I need to open a 112 lot buy trade while the broker only allows max 50 lots in a single trade. So I need to break up into 3 trades 50 lot, 50 lot and 12 lots. the following code does not work and I don't know why. In back test it...
To say that I am puzzled is an understatement. I removed all the Buy Sell and Exit conditions from this EA, Ran the Strategy Tester and it still makes trades. It seemed that no matter what trading conditions I entered weird trades would take place, beginning and ending at random.  Oblivious to the...
  A little confused  (10)
Hello everyone, I don't understand what I have done to course error  - constant expression required. Please enlighten me double  MAW= iMA(Security,Timeframe,Preiod,MA_Shift,MODE_SMMA,PRICE_WEIGHTED, SHIFT);double  MAT= iMA(Security,Timeframe,Preiod,MA_Shift,MODE_SMMA,PRICE_TYPICAL...
Hi, I am just programming an EA and I have been reading the documentation I found: https://docs.mql4.com/files/fileopen As far I know (I am not an experienced programmer), FILE_SHARE_WRITE (or share read) must be used when a file is accessed from multiple programs, right? My EA automatically exports...
  OrderClose  (2)
Can any one explain? the OrderSelect, OrderType and OrderClose functions am I using correctly ?  I want to close a trade when the new high comes. if(OrdersTotal()>0          && OrderSelect(ticketBuy,0,MODE_TRADES==true)          && OrderType()==0)       {         //bool...
  Mq4 you tube coding lessons  (19   1 2)
Check here this person giving coding lessons on mt 4, 30 lessons in all, from what I've seen so far he is a very good teacher.This will get you to lesson #29, but once there you will see the rest
Hi. I would like to ask the following: 1. Init - does something that you want the EA to do as it is loaded in the chart. If that is so, why does this not prompt the Hello world upon load of the EA? int OnInit()  {   return(INIT_SUCCEEDED);   Print("Hello World");     } - Why do the following errors...
How to Put Object VLINE Under Candle To See the Upper/Lower Shadow of the Candlestick? I want to make Vertical Line under the candle to see clearly the shadow/tail of candles or Is there any way to avoid hitting the candlestick?  There should be one—and preferably only one—obvious way to do it. (Zen...
Please can anyone point out what is wrong in this part of code below, it is showing "array out of range" and pointing that the error is on this line: datetime time = Time[0]; datetime getLastTradeTime(int type){    datetime time = Time[0];    for(int cnt = OrdersTotal()-1...
  ADD LOT Problem  (4)
Hi Guys, i`m struggling upon something -  its an add lot function. Can you help me make it start only one additional order per main order? Mine starts like a million additional orders. I`d really appreciate the help. Best Regards
Wherever I searched the forum, I could not find information on this issue, as if no one had thought about it. If there are such opportunities in coding or have any ready variants of code which will allow to do so - please advise. :) Thanks in advance
Hi, I'm a bit confused with the "lots" unit, is there any way to get the total amount in USD or current currency for some order position? I know we can get the OrderOpenPrice() and OrderLots() but I don't know how to use it. For example, if OrderOpenPrice is $100 and OrderLots is 0.1, what is total...
Hi guys! I've already read topics in this forum about this error and implemented my code. However, I can't understand why error 1 is still presented, even though occasionally. Here is my code (I use two ticket: "0" to identify buystop and "1" to sellstop) void TrailingPendingOrder()   {...
i downloaded an EA mentioned in subject. it has 2 issues... 1) it does close a trade at reaching the given pips, either in loss or profit. means it has only 1 option for profit and loss. we can't give let's say i want it to close if reach at 30 pips profit or  20 pips loss. it ask only one number...
  Math Question  (4)
OK I need to know the difference between two numbers. This is easy when I need to know the difference by subtracting the smaller number from the larger number however there are many cases where I need to know the difference of the numbers when I need to subtract the smaller number from the larger
Hello, i just want to code a rectangle which should be moveable, when dragged. Unfortunately, i get no CHARTEVENT_OBJECT_DRAG called. Is there any setting in MetaTrader 5 or a "ChartSetInteger" to be called in order to get it work? I played around with zorder, from 0 to 2, but no help. The property...
This code wont paint arrow in real time. I know there is one loop needed for checking current running candle but firstly I don't understand what this "void clearmarks" function does? And can I write a new loop into "void CheckNPB" ? double CalRange(int bar_num, bool verify=false){   int counter,...
Hi there, I come to you to ask you : How can i draw a VLINE on the 50th (or Xth) bar in the future. In my case, i want to put the Vline 50 bars after the current time/bar (what ever the timeframe, always the 50th bar in the future). ObjectCreate("My_Vline", OBJ_VLINE, 0, TIME ???, 0); Thank you....
  MT4 for MAC  (3)
Hi everyone, did somebody know how to make a mt4 for MAC like on this site? https://www.xm.com/?gclid=EAIaIQobChMIi5Li25ev2gIVyeAYCh0ueg4XEAAYASAAEgIXo_D_BwE Or this? https://pepperstone.com/uk/trading-platforms/metatrader-4-mac
I think the MT4 - Money Flow Index Calculation is Wrong! I tried to replicate this MT4 - MFI Indicator but there's something wrong when I tried to follow the author MFI formula. I discovered that MT4 - MFI signal is a little bit different, they used "Current Volume" in "Previous Money Flow...
I am busy developing an EA. I have gotten the EA working correctly on focusing on one magic number. what do I need to add so the EA focuses on 2 magic numbers, but focuses on them separately? Example  EA take profit = $5.0 magic number 1 = $2.5 magic number 2 = $5.0 EA closes magic number 2 EA does...
When I have multiple if statements, will the if statements after the first true if statement run?       //Signals to purchase or sell the EURGBP//Let's say this bit is true            if(((perGBP - perEUR) > gap) && (((Close[i+1] < previousK) < previousD)) && currentK > currentD && currentD <...
Hello dear programmers, I made an expert advisor which uses 2 MA's (among some filters) to trade on the buy/sell signals when the MA-lines are crossing which looks like this: double S0 = iMA(NULL, 0,MAC_MA_ShortPeriod,0,MAC_MA_ShortMode,PRICE_CLOSE,0); double L0 = iMA(NULL
Hi, I am running the code :   if(TotalOpenOrders() == 0 && IsNewBar())         {             double C_O =  Open[0];            double C_C =  Close[0];                        Print("C-A");            Print(C_O);            Print(C_C);        } and I get Open = Close all the time!   Any idea why ?...
  Not enough money  (3)
Isend the order and a read the journal. I use One click trading, open 1 lot, ballance is 900000!!!!!! And read in journal: „555380: order buy 1.00 EURCAD opening at 0.00000 sl:0.00000tp: 0.00000 failed[Not enough money]” Why zero, zero….? In other demo account is working.
  how to modify this Alert?  (11   1 2)
void OnTick ( void ) { if ( Bars < 100 ) { Alert (" Bars less than 100 !"); return ; } if ( IsTradeAllowed ()== false ) { Alert ("Trade is not allowed!"); return ; } } I added few checkup lines to my EA. But the EA validation team comment to that like
  Elementary Inquiry on Codes  (15   1 2)
Hi. I would just like to inquire regarding boolean functions, particularly the OrderModify. I understand that OrderModify is a boolean function, returning TRUE/FALSE, upon execution. I was thinking that this is a test whether the Order has been successfully Modified or not. However, I was surprised...