Questions from Beginners MQL4 MT4 MetaTrader 4 - page 171

 

EA based on williams percent range. The code compiles without problems but EA does not trade, most likely the parameters for wpr are not correct . Gurus hope for your help

//+------------------------------------------------------------------+
//|                                                          WRP.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+

//--------------------------------------------------------------------
extern int     period_WPRur          = 6,
               stoploss             = 100,
               takeprofit           = 200,
               slippage             = 10,
               buy_level            = -80,
               sell_level           = -20,
               Magic                = 21;
extern double  Lot                  = 0.1;
//--------------------------------------------------------------------
void OnTick()
{
   for (int i=0; i<OrdersTotal(); i++)
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if (OrderSymbol()==Symbol() && Magic==OrderMagicNumber()) return;
   double WPRur0  = iWPR(Symbol(),period_WPRur,PRICE_OPEN,1);
   double WPRur1  = iWPR(Symbol(),period_WPRur,PRICE_OPEN,1);
   double SL=0,TP=0;
   if (WPRur0 > buy_level && WPRur1 < buy_level)
   {
      if (takeprofit!=0) TP  = NormalizeDouble(Ask + takeprofit*Point,Digits);
      if (stoploss!=0)   SL  = NormalizeDouble(Ask - stoploss*  Point,Digits);     
      if (OrderSend(Symbol(),OP_BUY, Lot,NormalizeDouble(Ask,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError());
   }
   if (WPRur0 < sell_level && WPRur1 > sell_level)
   {
      if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits);
      if (stoploss!=0)   SL = NormalizeDouble(Bid + stoploss*  Point,Digits);            
      if (OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bid,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError());
   }
}
//--------------------------------------------------------------------
 
Greetings all, I am a newbie, advise what to do, do I have toreturnthe amount of300.26$ (real account)or not, I want to stop using ECN Pool MT4 for a while?
Files:
354355.png  5 kb
 
Logic:
Greetings all, I am a newbie, tell me what to do, do I have torefund the amount of300.26$ (real account)or not, I want to stop using ECN Pool MT4 for a while?

Read your broker's user agreement.
You should read your broker's agreement and it usually says that if the account goes in the red, the client does not owe you anything.
That's what margin call and stop out are for.

 
Aleksandr SHablevskiy:

EA based on williams percent range. The code compiles without problems but EA does not trade, most likely the parameters for wpr are not correct . Gurus hope to hear from you

  double WPRur0  = iWPR(Symbol(),period_WPRur,PRICE_OPEN,1);
  double WPRur1  = iWPR(Symbol(),period_WPRur,PRICE_OPEN,2);
Put 2 at the end of the second line like I did.
 
Nikolay Khrushchev:

Read your broker's user agreement.
They usually state that if the account goes into deficit, the client does not owe anything.
That's what margin call and stop out are for.

the thing is that the broker turned out to be a scammer, neither the website nor communication is available with him
 
Nikolay Khrushchev:
put 2 at the end of the second line like I did.
looks like something else, no deals!!!
 
Hi all! Just started to learn mql4 programming, I'm watching a video course on youtube, but it turns out the material is old, I have encountered an error when I first try to create a program, help me out.Here's the mistake. The author of the video is not responding.
 
Hello all,please help me,how to write a function that would make robot flip on loss. For example, I lost 20 pips and flipped over, then flipped again.
 
turser89:
Hi all! just started to learn mql4 programming, i am watching video course on youtube, but it turns out the material is old, i encountered an error the first time i tried to create a program, please help.

Start() started with a lowercase "s" instead of an uppercase.

But now it's better not to use outdated functions.

OnTick() for experts, OnStart() for scripts, etc. Read more: https://docs.mql4.com/ru/mql4changes

 

Good afternoon.

1       16:15:33.627    2019.02.04 16:00:00  CandleStrategy EURUSD,M30: out of memory
3       16:15:33.627    2019.02.04 16:00:00  Testing pass stopped due to a critical error in the EA

How do I diagnose what is causing the out of memory error? I don't have any undeleted objects left. I start the test, stop it and there are no errors about undeleted objects in the logs. Also no errors about undeleted objects with this out of memory error.

How can I find out what exactly leads to this memory error?

Reason: