Impulse - page 14

 
Event:
...

Take the MA. Find two of its identical values on bars far apart. And try using your formula to calculate the average change in price of the MAK over that number of bars. Is it zero?

Maybe I'm not making myself clear - I don't know...

 

You're all clear ))))

Do the math, catch the momentum...

 
Karputov Vladimir:
There are no such terms here. If you want to check, then calculate the value for fifteen bars (as you cannot check ticks - there is no history for them). Take the closing prices. M30 timeframe (this is for clarity).

There are similar summands here, such as -tik14 and +tik14.

I was talking about a specific formula. Do the math for yourself.

 
Event:

There are similar summands here, such as -tik14 and +tik14.

I was talking about a specific formula. Do the math for yourself.

:). That's it. I'm done. I'm off to the country. I'll be in touch tomorrow night.
 
Event:

You're all clear ))))

Do the math, catch the momentum...

Yes, thank you.

//+------------------------------------------------------------------+
//|                                                    AVG_close.mq4 |
//|              Copyright 2015, Artem A. Trishkin, Skype artmedia70 |
//|                       https://login.mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Artem A. Trishkin, Skype artmedia70"
#property link      "https://login.mql5.com/ru/users/artmedia70"
#property version   "1.00"
#property strict
#property script_show_inputs
//--- input parameters
input int      NumberOfBars=10;
int numberOfBars;
//+------------------------------------------------------------------+
void OnInit()
  {
   numberOfBars=(NumberOfBars<1)?1:NumberOfBars;
  }
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   Comment("Формула раз: "+DoubleToString(AverageChangePrice(Symbol(),numberOfBars),Digits)+
           "\nФормула два: "+DoubleToString(((Close[numberOfBars]-Close[0])/numberOfBars)/Point,Digits)
          );
  }
//+------------------------------------------------------------------+
double AverageChangePrice(string sy, int period) {
   //--- Среднее изменение цены расчёт
   double avg_change_price=0, pt=SymbolInfoDouble(sy,SYMBOL_POINT);
   for(int i=period; i>0; i--) {
      double subtrahend=(i==period)?Close[i]:Close[i-1];
      double difference_price=(Close[i]-subtrahend)/pt;
      avg_change_price+=difference_price;
      }
   avg_change_price/=period;
   return avg_change_price;
}
//+------------------------------------------------------------------+
 
Karputov Vladimir:
:). That's it. I'm done. I'm off to the country. I'll be in touch tomorrow night.
In Prostokwashino?
 
Artyom Trishkin:

Yes, thank you.

why ?
Digits 
 
new-rena:
Why?

You don't have to... There's no need for that at all. It's in the points. It's just that one was in price, the other in points. I did it all in points (tweaked the post) and didn't pay attention to the bug. Idiot ...

I'll fix it, that's all...

 

Corrected:

//+------------------------------------------------------------------+
//|                                                    AVG_close.mq4 |
//|              Copyright 2015, Artem A. Trishkin, Skype artmedia70 |
//|                       https://login.mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Artem A. Trishkin, Skype artmedia70"
#property link      "https://login.mql5.com/ru/users/artmedia70"
#property version   "1.00"
#property strict
#property script_show_inputs
//--- input parameters
input int      NumberOfBars=10;
int numberOfBars;
//+------------------------------------------------------------------+
void OnInit()
  {
   numberOfBars=(NumberOfBars<1)?1:NumberOfBars;
  }
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   Comment("Формула раз: "+IntegerToString((int)AverageChangePrice(Symbol(),numberOfBars))+
           "\nФормула два: "+IntegerToString(int(((Close[numberOfBars]-Close[0])/numberOfBars)/Point()))
          );
  }
//+------------------------------------------------------------------+
double AverageChangePrice(string sy, int period) {
   //--- Среднее изменение цены расчёт
   double avg_change_price=0, pt=SymbolInfoDouble(sy,SYMBOL_POINT);
   for(int i=period; i>0; i--) {
      double subtrahend=(i==period)?Close[i]:Close[i-1];
      double difference_price=(Close[i]-subtrahend)/pt;
      avg_change_price+=difference_price;
      }
   avg_change_price/=period;
   return avg_change_price;
}
//+------------------------------------------------------------------+
 
It's more fun now ))



But still - where's the momentum here? Is it there? Can it be caught?