Derivatives market quotes in MT5 - page 10

 

Greetings Colleagues, let's summarize the use of COPY_TICKS_ALL or COPY_TICKS_TRADES!!!

As I understand from what I've read, for more correct delta calculation it's better to use ticks by trades rather than all of them. Right?

What is the difference of using one or the other. What is the effect on the result?

 
Mihail Marchukajtes #:

Greetings Colleagues, let's summarize the use of COPY_TICKS_ALL or COPY_TICKS_TRADES!!!

As I understand from what I've read, for more correct delta calculation it's better to use ticks by trades rather than all of them. Right?

What is the difference of using one or the other. What is the effect on the result?

What delta do you mean?

 
Mihail Marchukajtes #:

Greetings Colleagues, let's summarize the use of COPY_TICKS_ALL or COPY_TICKS_TRADES!!!

As I understand from what I've read, for more correct delta calculation it's better to use ticks by trades rather than all of them. Right?

What is the difference of using one or the other. What is the effect on the result?

I've seen a link to the screenshots of one forum member in his profile.

Either he had an error in his calculations or the pricing formula is wrong

Do not advertise, just look at the pictures how it looks like

but it seems to me that the price should hit Last with pinpoint accuracy, i.e. without delta, if it is calculated correctly

stockbrokers themselves say that the price is calculated every second, at least on MOEX

I don't believe in the usefulness of such huge calculations, I wanted to check it once, they rolled me over the whole cup, what about Last...., I was disappointed and ran away from the exchange
 
prostotrader #:

What delta are you referring to?

Delta, the difference between the number of buyers and sellers of a particular bar.

Here is a bit of code where the request for ticks and calculation of delta and volume takes place

   Linterest[0]=GlobalVariableGet("LLINTER");

   double delta=0;  
   double vola=0;
   int num= CopyTicksRange(Name_instrFS,tick_array,COPY_TICKS_TRADE,StartDate*1000,Start1Date*1000);
   //Print (num);
   if (num>0){
   long sumVolBuy=0;
   long sumVolSell=0;
       for (int q=0;q<num && !IsStopped();q++)
          { 
if(( tick_array[q].flags&TICK_FLAG_BUY)==TICK_FLAG_BUY && (tick_array[q].flags&TICK_FLAG_SELL)==TICK_FLAG_SELL) // Если тик обоих направлений
      Print(__FUNCTION__,": ОШИБКА! Тик '""' неизвестного направления!");
   else if(( tick_array[q].flags&TICK_FLAG_BUY)==TICK_FLAG_BUY) // Если тик на покупку
   sumVolBuy+=(long)tick_array[q].volume;
   else if(( tick_array[q].flags&TICK_FLAG_SELL)==TICK_FLAG_SELL) // Если тик на продажу
   sumVolSell+=(long)tick_array[q].volume;
           
       if(( tick_array[q].flags&TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME)   vola+=tick_array[q].volume_real; 
          }
    delta=double(sumVolBuy-sumVolSell); 
    if (Ldelta!=delta) Ldelta=delta; else delta=0;
  }
    for (int i=0;i<5 && !IsStopped();i++)
    { 
      h=FileOpen("OpenI\\"+Name_instr+"_OI.csv",FILE_WRITE|FILE_READ|FILE_ANSI|FILE_CSV|FILE_COMMON|FILE_SHARE_READ,";");
       if(h!=INVALID_HANDLE)                                                         
       {  
         
         FileSeek(h,0,SEEK_END);
         FileWrite(h,RecDate,DoubleToString(Linterest[0],0),DoubleToString(delta,0),DoubleToString(vola,0)); 
         FileClose(h); 
         Sleep(100);
         FlagOFupdate[0]= true;
        break; 
       }
    } 

Originally it was COPY_TICKS_ALL in CopyRang, but changed it yesterday to COPY_TICKS_TRADE. How much more correct would this be in relation to the problem voiced earlier???

 
Mihail Marchukajtes #:

Delta, the difference between the number of buyers and sellers of a particular bar.

Here is a bit of code where ticks request and delta and volume calculation takes place

Initially it was COPY_TICKS_ALL in CopyRang, but yesterday I changed it to COPY_TICKS_TRADE. How much more correct is this in relation to the problem I voiced earlier???

In your situation you should only take COPY_TICKS_TRADE because only trades have the contract volume parameter.

In order to use volumes of contracts ASK and BID, you have to use a glass.

for (int i=0;i<5 && !IsStopped();i++)
    { 
      h=FileOpen("OpenI\\"+Name_instr+"_OI.csv",FILE_WRITE|FILE_READ|FILE_ANSI|FILE_CSV|FILE_COMMON|FILE_SHARE_READ,";");
       if(h!=INVALID_HANDLE)                                                         
       {  
         
         FileSeek(h,0,SEEK_END);
         FileWrite(h,RecDate,DoubleToString(Linterest[0],0),DoubleToString(delta,0),DoubleToString(vola,0)); 
         FileClose(h); 
         Sleep(100);
         FlagOFupdate[0]= true;
        break; 
       }
    } 

This is quite a sad code.

At each iteration you open and close the file.

 
prostotrader #:

In your situation only COPY_TICKS_TRADE should be taken , because only the trades have the contract volume parameter.

In order to use ASK and BID contract volumes, you need to use a glass.

This is quite a sad code.

At each iteration you open and close the file.

If the first attempt is successful, then no, but the data is written at the beginning of the minute for the previous bar is quite good at recording OI, delta and volume!!!
 
Mihail Marchukajtes #:
If the first attempt is successful, then no, but the data is written at the beginning of the minute for the previous bar is quite good to record OI, delta and volume!

Can you show me a screenshot?

 
Renat Akhtyamov #:

Can I see a screenshot?

Yes, please....

You see, everything writes fine, but to know the difference of recording all ticks or just trading is not possible. I do not want to bother. After all, for NS insignificant offsets and errors are not so important, the main thing that after training the data were not changed because during initialization of the EA with NS it must correctly calculate the history up to the current moment for the next one to start calculation from the current, correct parameters. If the initialization was not done correctly, the current value of the last known signal will be different and the new signal will start to calculate from other positions, which will lead to unpredictable results. Therefore it does not matter how written, even with errors. The main thing is not to change it after training!!!!

 
Mihail Marchukajtes #:

Yes easily....

You see, everything writes fine, but to know the difference of recording all ticks or just trading is not possible. I don't want to bother. After all, for NS insignificant offsets and errors are not so important, the main thing that after training the data were not changed because during initialization of EA with NS it must calculate the history correctly to the current moment for the next one to start calculation from current, correct parameters. If the initialization was not correct, the current value of the last known signal will be different and the new signal will start to calculate from other positions, which will lead to unpredictable results. Therefore it does not matter how written, even with errors. The main thing is not to change it after training!!!!

There is a limit to the number of lines in Excel. If the machine throws, keep it in mind. Better sql. What is the result of the calculation from the screenshot, what is the practical point?
 
Renat Akhtyamov #:
There is a limit to the number of lines in excel. If the machine throws, keep that in mind. Better sql. What is the result of the calculation from the screenshot, what is the practical point?

An ordinary CWS file is written.

Collection of OI history, delta and volume respectively. The data that 100% will not be changed in the history, not to mention the absence of OI history as such. The code for calculating the recorded parameters I gave above ....