Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 33

 

Found a thread, rubbed the topic:

I'm sorry for a separate topic, I couldn't find a topic with questions "from dummies". How is a factorial set in MQL4? I searched through all documentation - I can't find it. I want to ask you something. If this function has no factorial, please share the script, if available, to pull a piece of code.

 
uzi:

Found a thread, rubbed the topic:

I'm sorry for a separate topic, I couldn't find a topic with questions "from dummies". How is a factorial set in MQL4? I searched through all documentation - I can't find it. I want to ask you something. If this function has no factorial, please share the script, if available, to pull a piece of code.


You can use the function

        int recurs(int n)
{
    int m=n;
    int result=1;
    if (n>1)result=recurs(n-1);
    result*=m;
    return result;
}
 
Roger:


You can use the function


THANK YOU!
 

I need a hint, please,

how to spell out the conditions: 1 - if a new bar has opened

2,3,4 - if order (buy, sell, any) closed?

 
edhom:

I need a hint, please,

how to spell out the conditions: 1 - if a new bar opens

2,3,4 - if order (buy, sell, any) closed?

Something like this

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"


bool New_Bar=false;
static datetime New_Time;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   New_Time=Time[0];
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
  Fun_New_Bar();                               // Обращение к ф-ии
  
    if (New_Bar)                               // 1 -  если открылся новый бар
      {
      if(OrdersTotal()==0)                     //2,3,4 - Открытых ордеров нет
        {
        //Ваш код .....
        //.............
        }
      }
     
//----
   return(0);
  }
//+------------------------------------------------------------------+
void Fun_New_Bar()                              // Ф-ия обнаружения ..
  {                                             // .. нового бара
                                                // Время текущего бара
   New_Bar=false;                               // Нового бара нет
   if(New_Time!=Time[0])                        // Сравниваем время
     {
      New_Time=Time[0];                         // Теперь время такое
      New_Bar=true;                             // Поймался новый бар
     }
  }
 
When testing the EMA the difficulty arises that it rises and falls on small movements, creating false signals. How to filter out false signals by setting a certain number of pips to exclude minor EMA fluctuations?
 
r772ra:

Something like this


THANK YOU!
 
Forexman77:
When testing the EMA the difficulty arises that it rises and falls on small movements, creating false signals. How to filter out false signals by setting a certain number of pips to exclude minor EMA fluctuations?


The easiest option is to use OPENPRICE in the EMA as "apply to" and gradually sliding down to CLOSEPRICE, try to use other intermediate slightly smoothed PRICE
 
Forexman77:
When testing the EMA the difficulty arises that it rises and falls on small movements, creating false signals. How to filter out false signals by setting a certain number of pips to exclude minor EMA fluctuations?


The easiest option is to use OPENPRICE in the EMA as "apply to" and gradually sliding down to CLOSEPRICE, try to use other intermediate slightly smoothed PRICE
 
Forexman77:
When testing the EMA the difficulty arises that it rises and falls on small movements, creating false signals. How can I set a certain number of points to filter out false signals in order to exclude minor EMA fluctuations?
Use the LWMA!
Reason: