Off-topic MT4/mql4 questions. - page 41

 

Hi

I want to know : why my*.ex4 file does not work in another computer

every time I must transfer the *.mq4 file and compile it on the destination.

do you know why??

 
Jalal kaviani #:

Hi

I want to know : why my*.ex4 file does not work in another computer

every time I must transfer the *.mq4 file and compile it on the destination.

do you know why??

Copy/paste of ex4/5 files doesn't work for MQL5.com Market purchases.

You need to login into your MQL5 account with your jalakaviani login in MT4/5 >> Tools >> Options >> Community and install your purchases as you did in the first MT4/5 terminal.

Any installation of a MQL5.com Market purchase in a different computer or non MQL5 VPS, requires an extra activation.

 
Maurojose1989 #:

hi i have some error, fix please

'iCCI' - wrong parameters count


Hi Maurojose,  The error is because iCCI doesn't have a MODE_MAIN parameter. It only has MODE_SMA , MODE_EMA , and MODE_SMMA for moving average modes. Also, PRICE_TYPICAL is not a valid parameter for applied_price

Use this Function instead 

double cci = iCCI(NULL, 0, 14, PRICE_TYPICAL, 0);

Here is the correct way, it should compile

//+------------------------------------------------------------------+
//|                                                      mmmccc1.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int start()
{
  int maPeriodFast = 21;
  int maPeriodSlow = 9;
  double maFast = iMA(NULL, 0, maPeriodFast, 0, MODE_EMA, PRICE_CLOSE, 0);
  double maSlow = iMA(NULL, 0, maPeriodSlow, 0, MODE_EMA, PRICE_CLOSE, 0);
  double atrValue = iATR(NULL, 0, 14, 0);
  double macd = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
  double macdSignal = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
  double cci = iCCI(NULL, 0, 14, PRICE_TYPICAL, 0);

  if (maFast > maSlow && macd > macdSignal && cci > 100) {
    // bullish market, place a buy order
    double stopLoss = Bid - atrValue*2;
    double takeProfit = Bid + atrValue*4;
    int result = OrderSend(Symbol(), OP_BUY, 1, Ask, 3, stopLoss, takeProfit, "My EA Buy Order", 16384, 0, clrGreen);
    if (result > 0) {
      Print("Buy order placed successfully");
    }
  } else if (maFast < maSlow && macd < macdSignal && cci < -100) {
    // bearish market, place a sell order
    double stopLoss = Ask + atrValue*2;
    double takeProfit = Ask - atrValue*4;
    int result = OrderSend(Symbol(), OP_SELL, 1, Bid, 3, stopLoss, takeProfit, "My EA Sell Order", 16384, 0, clrRed);
    if (result > 0) {
      Print("Sell order placed successfully");
    }
  }

  return(0);
}

//+------------------------------------------------------------------+

Always remember to use your reference.

 

hey! I can't able to download mt4 pc win 10 version

 
Sumant Singh #: I can't able to download mt4 pc win 10 version

If you had used this (before posting), you would have found (among 400+) Where to download MT4? - General - MQL5 programming forum (2017)
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

It has been years since you could download MT4 from Metaquotes. You can only get it from a broker's website.
          Where to download the orginal MT4 installer - MQL4 programming forum (2018)

 
hello i have a problem with my ea when i compile it , im getting tghis error and i have doubled checked the code but cant seem to find the duplicated oninit function this error occured when i added the license validation check function in my ea
'OnInit' - function already defined and has body FSM.mq4 80 8
 
Zenzele Maseko #: , im getting tghis error and i have doubled checked the code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked, so we can't see your machine.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Always post all relevant code (using Code button) or attach the source file.

 
Hi everyone i a robot i would like it to place a break even to profitability can you send me the code?
 
@Punza Yannick Kakungula #: Hi everyone i a robot i would like it to place a break even to profitability can you send me the code?

Firstly, don't hijack other users forum threads for your off-topic question.

Secondly, here is a boiler-plate answer to your query (again, as you did not even read the thread you originally posted on) ...

  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL4 programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.
 

@William Roeder, what is your problem with EA pending orders?

ok