Random Flow Theory and FOREX - page 43

 

Flow theory is a very large and fundamental work. I've tried my best to put it into words here. The mathematics is too complicated. But it can be used to mathematically describe any flow, it can be a flow of events in the world (such as speeches by central bank heads, interest rates, actions by Ben Laden, etc. ANYTHING !!!) It can be a stream of psychological energy, a stream of sell orders etc. The maths is given there, how and what formulas can do it, how one flow will interact with another and how to identify and investigate it, etc.

Nuzhny thanks, I have a Kalman filter and it is implemented in several languages. The point is not about it, it's about what's embedded in that filter. What model. The filtering procedure itself is standard and well-known. It is like the Fourier transform, everybody knows it, but you have to understand what it is and how. Many people can hold a scalpel in their hands, but not all of them are surgeons. If you put linear models into a filter, it will be a linear filter, and if you put non-linear models into a filter, it will be a non-linear filter. The procedure is one universal (there are a few variations of it depending on the initial data, but it doesn't matter).

The fact that many Bolshakov formulas for more than 50 years could not be solved, while Berg mathematically proved it is not possible to their exact solution. And relatively recently Slukin head of research institute of Bauman Moscow State Technical University showed that it is possible to find solutions with so-called sufficient accuracy for practice.

By the will of fate I have faced with these scientific researches, as I could describe them with reference to the market (often explaining something to others, I get my own marbles in place). I understand if the investor had the password to the real account with equity resting in the sky or had won first place in a contest for 3 years, the contest would have had more weight. I hope the ideas and thoughts expressed here are not less valuable. Nuzhny I hope those 4 hours that you spent reading it didn't go in vain. At least I think it was interesting and thought-provoking.

 

Please advise how to improve the indicator. I chose this principle because of the reasons described here 'How to write fast non re-drawing zigzags'.

Here is the indicator template itself.

#property  indicator_chart_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  MediumVioletRed

extern  int      MinBars = 0;

int      PreBars;
datetime BarTime;
int      StartPos;
int      pos;

double   Kalman[], Prognoz[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
  SetIndexBuffer(0, Kalman);
  SetIndexBuffer(1, Prognoz);
  SetIndexStyle(0,DRAW_LINE);
  SetIndexStyle(1,DRAW_LINE);
//---- Устанавливает значение пустой величины  
  SetIndexEmptyValue(0,0.0);
  SetIndexEmptyValue(1,0.0);
  SetIndexLabel(0,"Kalman");
  SetIndexLabel(1,"Prognoz");
  return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
  return(0);
}
//+------------------------------------------------------------------+
//|расчеты при инициализации и сбоях                                 |
//+------------------------------------------------------------------+
int Reset() {
  if ( MinBars == 0) MinBars = Bars-2;
  StartPos = MinBars;
  PreBars = 0;
  BarTime = 0;
// .......
  StartPos++;
  return( StartPos);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
double K_1=1, K_2=1;
//  Работаем только по закончившимся барам
  if (Bars == PreBars) return(0);  
//  Проверим, достаточно ли баров на графике
  if (Bars < MinBars) {
    Alert("Калман: Недостаточно баров на графике");
    return(0);
  }  
//  Если не было докачки истории, обсчитываем только закончившийся бар
  if (Bars- PreBars == 1 && BarTime==Time[1]) StartPos = 1;
//  Иначе пересчитываем заданное в функции Reset() количество баров 
  else StartPos = Reset();
// Модифицируем контрольные переменные
  PreBars = Bars;  
  BarTime = Time[0];
// Цикл по истории
  for ( pos= StartPos; pos>0; pos--) {
// алгоритм расчета .....
// ......
// истинное (оцененное) значение цены 
   Kalman[ pos]= K_1*Close[ pos];      // в качестве примера
// наносим прогноз на график
   Prognoz[ pos-1]= K_2* Kalman[ pos]; // в качестве примера

  }  //  pos=StartPos;pos>0;pos--) 
  return(0);
}

How to make the indicator to take data from a timeframe of 5, 15, 30, etc. set by an external variable, and display it correctly on the chart.

Thanks in advance.

Z.I. The indicator is built on the principle that it does not matter what was yesterday, an hour ago, or a minute ago. It is important what price now and forecast accuracy = transition matrix = system matrix (in the example taken as a number) respectively K_1 (correction) and K_2 (responsible for the accuracy of the forecast).

Files:
 
Prival >> :

How to make an indicator on a minute chart, that would take the data from the timeframe 5, 15, 30, etc., set by an external variable, and display it correctly on the chart.

Thank you in advance.

Will replacing Close with iClose not work?

Only you need to use an additional mechanism for pre-loading (before calling iClose) quotes from the required timeframes

 
sabluk писал(а) >>

Wouldn't replacing Close with iClose work?

You only need to use an additional mechanism for prefetching (before the iClose call) quotes from the required timeframes.

This mechanism should be triggered only by the bar formed. It should not be able to read between them (see below)

I think it's simple, but I do not understand what should be added to the if

 
_
Files:
 
Prival писал(а) >>

It's not the point, it's what's put into this filter. What model. The filtering procedure itself is standard and well-known. It is like the Fourier transform, everybody knows how to do it, but you have to understand what is there and how. Many people can hold a scalpel in their hands, but not all of them are surgeons. If you put linear models into a filter, it will be a linear filter, and if you put non-linear models into a filter, it will be a non-linear filter. The procedure is one universal (although there are some variations depending on the initial data, but it doesn't matter).

Hi Sergei !

I wonder if it is possible to use statistical model in Kalman filter. Both linear and nonlinear and any other deterministic model is one thing, but statistical model is another one.

 

Here's what Sergei replied to my post a few months ago, Yuri.

 
Yurixx писал(а) >>

Hi Sergei !

I wonder if it is possible to use a statistical model in Kalman filter. A linear or non-linear or any other deterministic model is one thing, but a statistical model is quite another.

There are statistical models out there too. Here I have attached a file 'Theory of random flows and FOREX' to see how and from what assumptions Singer's model is made. It's not too complicated. If there's anything you need clarification on, I'm often on Skype.

 
Mathemat >> :

By subtracting the current LR value from the price, we get rid of trends, including non-linear ones, perfectly.

Hello, dear Mathemat.
I apologize in advance if my question seems to you too simple and uninteresting, but it is very important for me.
In general, your discussion here has interested me very much.
On page 17 of this thread on 22.11.2007 at 14:12 you wrote the following:
"By subtracting the current LR value from the price, we perfectly get rid of trends, including non-linear ones."
Do you get new price values as a result of such an operation, i.e. a new series of quotes?
I thank you in advance.

 
prostoleha >> :

"By subtracting the current LR value from the price, we get rid of trends, including non-linear ones, perfectly."
Do you get new prices as a result of this operation, i.e. a new series of quotes?

If you subtract the linear regression from the prices, of course, you get something else fluctuating around zero, rather than prices.