MQL4 and MetaTrader 4 - page 71

To post a new topic, please log in or register
Dear pro, I try to code EA to alert if bar length > 20pip in M15 chart. But when running, alert is continuous and cannot stop. I just need alert 1 time/1 bar. Pls help me to check code below. Thanks a lot! void OnTick()   {     double a = iHigh(Symbol(), PERIOD_M15 ,0);  double b = iLow (Symbol(),...
I want to create a function similar to: void  Print(    argument,     // first value    ...           // next values    ); or uint  FileWrite(    int  file_handle,   // File handle    ...                 // List of recorded parameters    ); Example function: bool checkCharacters(argument) {...
Hi everybody! This is my very first message on this board, so I thank you in advance for the help you will kindly provide me with. I would like to have some hints about the best way to make mql4 interact with external programs, written in a different language as it may be Python. The task I'd like...
phuonglan19
i want file .mql4 such :robot will deleted pending orders after I order those around 5 minutes or 10 minutes or 15 minutes and more... if pending order did not excute.  Thank you very much
How can I change the maximum lot size an EA can trade with in MT4? And how can I activate 'autotrading' for each forex pair separately in MT4?
CurrentPrice = Bid;              while((Bid-OrderOpenPrice())/_Point > TakeP*3/4){                  if(Bid > CurrentPrice){                   CurrentPrice = Bid;                   TakeP = (CurrentPrice-OrderOpenPrice())/_Point;                   }              }...
I submit the local compiled code on MT4, and find the system prompt error. How can I solve it effectively?
Am i right that MT4 will not store what each individual trade margin is per a trade? Can i select a order and just display what has been put up for this order? I understand i can do the calculation which is very straight forward but things get a little tricky with tiered margin. Thanks for your help...
Hello,  When I try to change a stop loss line with the cursor.  1.- I put the cursor on the stop loss dotted line  2.- Then I click the mouse en two horizontal lines appear and I can only move in horizontal sense. So I can not change the stop loos line.  I saw other people chaging stop loss with the...
Good morning, This might sound like a silly question but do mt4 indicators have compatibiliy with mt5? Thank you.
Here is the code i'm using int OnInit(){   Print("init Year: "+Year());   //---   return(INIT_SUCCEEDED);}//+------------------------------------------------------------------+//| Custom indicator iteration...
Hi All I've searched high and low to try and find a template EA which allows you to refers to an indi with a simple arrow up / down trigger but can't find one. I just wanted to create an EA to trade the attached indi with SL/TP/trailing? I'm not a coder so couldn't create one myself but could insert...
V_LINES are created in the Chart  Window. OBJPROP_BACK, true places the V_Lines behind the buttons in the separate window - as per attached image. The V_LINES in the separate window scroll with the chart window - the buttons remain stationary - The V_Lines above and below the buttons form a...
I'm stuck with this code, i have to find the highest and the lowest in like 161 candel, and that's ok, then i have to draw a vertical line  N candle forward where the price doesn't arrived yet , what is my error? here is the code : void M()   { int max = iHighest(NULL,0,MODE_HIGH,161,0); int min =...
When an EA starts to get fairly large, structuring the code gets vital. Ways to structure.  - Subroutines in main code  - Include subroutines  as mqh  - Include classes  - Libraries I have favoured Libraries. You get a clean interface and good "isolation". During development it is a bit of a...
  One more average ... (508   1 2 3 4 5 ... 50 51)
The usual story goes something like this : which is the best moving average? Everyone that ever started to do any kind of technical analysis was pulled into this "game". Comparing, testing, looking for new ones, testing ... ______________________________ The idea of this one is simple : it should...
I was recently looking for some code like new candle but loads at first run then waits for new candle to run indicator faster... and accurate.. But during my tryouts come of wit this solution Time frame independent. Let me share and what you think?...
Is anybody familiar with the GetClassName and GetTitle functions in C++ and whether or not they have equivalents in mql4?
Hey guys,  Brand new to MQL4, been reading the docs and all that, so go easy on me!  Just wondering if its possible to initialize an array with a variable length.   For instance, the following works fine:   double blah[10];   ...Whereas this doesn't':   int arrayLength = 10; double...
Hello I'm a newbie using MQL4. Can anyone suggest me how to check existing order in range example I want to know how many order in price 1.25000 - 1.26000  and what is the order pending price. Are there any command to check it?  Thank you
Hello everyone, Are chart_id's random numbers generated by forex/MQL4/5?
  Custom EMA (5)
Hi, I try to create multiple EMAs which is parallel to H1 Ema 20 with 10 pips interval by editing the custom moving average as follow (highlighted ) and it doesnt create parallel lines but overlap on existing ema 20 line. The completed file is attached. Please help....
Hi all I've been racking my brain on this all afternoon and can't work out where I'm going wrong...  My goal is to find the high/low between now and a previous trade. I know the general gist of it is  (1) find current datetime and past reference datetime (2) find the hours between the two datetimes...
Hi, is this possible?  Really don't want to constantly change every part of the date/time/year/ every time i need a little adjustment.  I want the default when I start the EA to be the current datetime.  Can anyone help with this?  Thanks.
I have an ea which is placed  on  10  different charts in mt4. The problem is it opens many trades. I just want it to place a maximum of 3 positions. So for example if the chart 1 trade is buy EURUSD, chart 2 is buy USDJPY and chart 3 is Buy USD/CAD and  on chart4 there is a signal to buy usd/chf,...
Is there any way to monitor opened positions during the strategy test, and also close them by manually if needed. And i don't mean the "Results" tab, i mean the same view like you will have in live trading. Thanks,
  Error 148 (1)
Hello, I have a question with error 148. I checked the max pending with this code. int max_allowed_orders=(int)AccountInfoInteger(ACCOUNT_LIMIT_ORDERS); Some time results =0; What is the meaning? Is it mean no pending allow?  But when I send manually pending order to the account, it is successful....
Hello everybody, actually I am using this EA to close at a profit level and deleting all Pending Orders placed left on Terminal. It works perfectly but I would like to add this functions: 1) Delete Pending Orders    True/False options,to activate or de-activate and a  2)"Value of Total Orders"...
Hi all, I am using MACD indicator in MQL4. The issue I am facing is macd showing different value on mouseover but in code it is giving different value. Please refer to the blow snapshot  for value  of histogram and highlighted value printed via code. 4.8766603758299e-05
Hi, I recently returned to using some of my old MT4 charts and modifying an old indicator. The original works perfectly well, however, when I modified the timeframe to make it calculate and draw lines for 4H candles, it doesn't work.  There is no error message when the indicator was compiled, but it...