EMA weight calculation

 
1.EMA is determined by adding a certain fraction of Close[0] to EMA[1] - what fraction exactly? (question solved)
2.how to find the weight of the cloze in the current value of the ema?
 
how?
 
Check out the indicator supplied as standard - Moving Average. It will make more sense there.
Roughly speaking, your share will be based on comparison to the period of an indicator with approximately the same smoothing.
Here is the code for EMA (pr is your share):
//+------------------------------------------------------------------+
//| Exponential Moving Average                                       |
//+------------------------------------------------------------------+
void ema()
  {
   double pr=2.0/(MA_Period+1);
   int    pos=Bars-2;
   if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
//---- main calculation loop
   while(pos>=0)
     {
      if(pos==Bars-2) ExtMapBuffer[pos+1]=Close[pos+1];
      ExtMapBuffer[pos]=Close[pos]*pr+ExtMapBuffer[pos+1]*(1-pr);
           pos--;
     }
  }
In general, check the documentation on the website more often and also the codes themselves.
 
ema[i]=k*Close[i] + (1-k)*ema[i+1];
where k is a fraction of 0...1. Often a period is used instead of a fraction, from which this fraction is calculated: k=2.0/(1+period). I.e. an EMA of fraction 0.5 would be corresponding to period 3.
 
залез в исходник ЕМА
void ema()
  {
   double pr=2.0/(MA_Period+1); // что значит период МА + 1? зачем?
   int    pos=Bars-2;
   if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
//---- main calculation loop
   while(pos>=0)
     {
      if(pos==Bars-2) ExtMapBuffer[pos+1]=Close[pos+1];
      ExtMapBuffer[pos]=Close[pos]*pr+ExtMapBuffer[pos+1]*(1-pr); // Buffer[i]=Close[i]*2% + Buffer[i+1]*(1-2)
                                                                     непонятно: зачем ЕМА[i+1] умножается на 1-2?
           pos--;
     }
  }
 
Mathemat >>:
Загляни в индюкатор, поставляемый стандартно - Moving Average. Там будет понятнее.
Грубо говоря, твоя доля получится исходя из сравнения с периодом индюкатора примерно с таким же сглаживанием.
Вот код для ЕМА (pr - твоя доля):
А вообще почаще заглядывай в документацию, размещенную на сайте, а также в сами коды.

People have become lazy altogether. Do they really prefer our obtuse language to the precise wording in the dock? )))

 
What makes you think I didn't look at the documentation? I asked about what's not in it.
and in the subject description I wrote the formula, it's the only thing in the docs.
 
Oh, come on. It's all there. And calculating the fraction from the period, too.
Okay. You got the "fraction" thing figured out now?
 
"Often a period is used instead of a fraction, from which the fraction is calculated: k=2.0/(1+period)" and 2.0 is then what, if not a fraction? because you say the period is used instead of a fraction
 
It's the Eulers formula, if I'm not mistaken. But I no longer remember how it was derived.
Reason: