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

 
pasha5282:

Can I get the information from the Account History, how much money has been withdrawn, what was the deposit and what was the profit for a certain period?

What functions or variables should I use? I can calculate the profit for a certain period with a cycle, but I don't know how to do it, what was the deposit a week ago and how much was withdrawn.

This data will also be sent by post.

To calculate how much was withdrawn/entered, look for an order with type == 6, and then already make a loop with the profit for the week and exclude/include there OrderType()==6. Then you can calculate the deposit, which was at the beginning of the week.
 
How can you remove the average line in a linear regression channel? What line should I write this on in the EA?
 

Hello, I downloaded the EMA indicator but it is not installed on the platform, can you tell me how to do it ?

 
HI ALL, HOW LONG CAN YOU SIT IN A TRADE ACCORDING TO TRADING RULES? IF IT IS AN INSTRUMENT SUCH AS A STOCK (THOSE THAT DO NOT HAVE TERMS LIKE FUTURES)
 
gi_group:
HI ALL, HOW LONG CAN YOU SIT IN A TRADE ACCORDING TO TRADING RULES? IF IT'S INSTRUMENTS LIKE STOCKS (THOSE THAT DON'T HAVE TERMS LIKE FUTURES)

What's the shouting?
 

Tried to write my first indicator. It draws lines from when the tick came, but not for old bars. I need the indicator to be displayed throughout the whole chart, including in stand-alone mode. Gurus, please advise what is wrong?

//+------------------------------------------------------------------+
//|                                                         сила.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//--- input parameters
extern int       Period_MA_1=7;
extern int       Period_MA_2=7;
extern int       Period_MA_3=7;
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    MA_1_t,                         
    MA_2_t,                           
    MA_3_t;
    MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_EMA,PRICE_CLOSE,1);  
    MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_EMA,PRICE_CLOSE,2);  
    MA_3_t=iMA(NULL,0,Period_MA_3,0,MODE_EMA,PRICE_CLOSE,3);    
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   
   for(int i=0;i<limit;i++)
   {
      ExtMapBuffer1[i]=(MA_3_t-MA_2_t)/(MA_2_t-MA_1_t);
   }
   return(0);
  }
//+------------------------------------------------------------------+
 
Forexman77:

Tried to write my first indicator. It draws lines from when the tick came, but not for old bars. I need the indicator to be displayed throughout the whole chart, including in stand-alone mode. Gurus, please advise what is wrong?


//+------------------------------------------------------------------+
//|                                                         сила.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//--- input parameters
extern int       Period_MA_1=7;
extern int       Period_MA_2=7;
extern int       Period_MA_3=7;
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    MA_1_t,                         
    MA_2_t,                           
    MA_3_t;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   
   for(int i=0;i<limit;i++)
   {
      MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_EMA,PRICE_CLOSE,i+1);  
      MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_EMA,PRICE_CLOSE,i+2);  
      MA_3_t=iMA(NULL,0,Period_MA_3,0,MODE_EMA,PRICE_CLOSE,i+3);    
  
      ExtMapBuffer1[i]=(MA_3_t-MA_2_t)/(MA_2_t-MA_1_t);
   }
   return(0);
  }
//+------------------------------------------------------------------+
It would be nice to check for zero, the division may cause an error
 
Vinin:
It would be a good idea to check for zero, because division may cause an error.
And a recalculation from "past to present" would be good as a habit (although for this indicator the order of recalculation is irrelevant).
 
Vinin:
It would be a good idea to check for zero, there may be an error when dividing
Thanks, it seems to be working!
 
TarasBY:
And a recalculation from "past to present" would also be a good idea - this is as a habit (although on this indicator the order of recalculation does not play a role).
This is my first indicator. I am not fully familiar with MQL4. I am rereading the textbook. Can I have an example, for a better understanding.
Reason: