Discussion of article "An Example of Developing a Spread Strategy for Moscow Exchange Futures" - page 4

 

The example Si - RTS is not very well chosen, because RTS does not proportionally depend on Si,

MIX(MXI) can have a great influence on RTS, because RTS is a reflection of MICEX index in currency.

It is much more interesting to consider SBRF - SBPR different futures for the same asset.

Added

Or consider RTS VS MIX without taking into account hedging Si, because not the whole RTS contract is recalculated in clearing, and

only the difference between the buy price and the clearing price.

MIX = RTS * USD_INDEX * LOT_RTS = 10 * 0.02

Just USD_INDEX jumps can be the reason for profit taking, not vice versa.

Added

Note on implementation (Strategy4_SpreadDeltaPercent_EA.mq5)

It is necessary to work not with bars, but with stacks.

//+------------------------------------------------------------------+
//| Expert Book event function|
//+------------------------------------------------------------------+
void OnBookEvent(const string &symbol)
{
  if((symbol == Symbol()) || (symbol == sec_symbol))
  {
  }
}

The first position should be opened not by the market,

bool BuyAndSell(string sym1,string sym2,double lot1,double lot2)
  {
//--- buying and selling
   trade.Buy(lot1,sym1);
   trade.Sell(lot2,sym2);
//---
   return true;
  }

but with a limit order, if the position is opened.

open a counter trade according to the market

It is not clear where and how lot1 and lot2 are calculated.

 
prostotrader:

The first position should not be opened at the market,

bool BuyAndSell(string sym1,string sym2,double lot1,double lot2)
  {
//--- buying and selling
   trade.Buy(lot1,sym1);
   trade.Sell(lot2,sym2);
//---
   return true;
  }

but with a limit order, if the position is opened, then

we open a counter trade at the market

I wonder why it is so - first by limit order, then by market?
 
Dennis Kirichenko:
I wonder why it's like this - first the limit, then the marque?

Because the glass can be "discharged".

The first element of the glass is volume 1 with a price of 100, followed by volume 99 with a price of 500,

Buying at the market, we're in the red,

and by buying with a limit, we either buy or don't buy at the price we want.

 
prostotrader:

Because the beaker can be "discharged".

The first element of the glass is volume 1 with a price of 100, followed by volume 99 with a price of 500,

Buying at the market, we're going to go under,

and buying at the limit, we either buy or we don't buy at the price we want.

Great example! So why buy at the market and not always at the limit?
 
Dennis Kirichenko:
Great example! So, why mark-to-market at all, and not always limit?

A response trade should be executed ASAP with the full volume that was used to open the first position.

Responding with a limit trade does NOT GUARANTEE the volume or the fact of the trade execution.

 
prostotrader:

A counter trade must be executed as soon as possible with the full volume of the first position.

A response with a limit trade does NOT GUARANTEE the volume.

Oh, sorry, I missed the term "retaliatory". Thank you. Very good point "limit-market" then. Respect
 
prostotrader:

It is not clear where and how lot1 and lot2 are calculated

It is not calculated anywhere, the limitations are described in the article itself in a separate section.
 
prostotrader:

The example Si - RTS is not very well chosen, because RTS does not proportionally depend on Si,

MIX(MXI) can have a great influence on RTS, because RTS is a reflection of MICEX index in currency.

It is much more interesting to consider SBRF - SBPR different futures for the same asset.

Added

Or consider RTS VS MIX without taking into account hedging Si, because not the whole RTS contract is recalculated in clearing, and

only the difference between the buy price and the clearing price.

MIX = RTS * USD_INDEX * LOT_RTS = 10 * 0.02

Just USD_INDEX jumps can be the reason for profit taking, not the other way round.

Thanks for the comments, this is of interest to all.
 

How can I get F-statistic and p -value from built reg model through alglib, maybe someone has already done it? There are only AVGerr and RMSerr there

 
Maxim Dmitrievsky:

How can I get F-statistic and p -value from built reg model through alglib, maybe someone has already done it? There are only AVGerr and RMSerr there

There is a static method for F-statistic in CAlglib class:

//+------------------------------------------------------------------+
//| Two-sample F-test|
//| This test checks three hypotheses about dispersions of the given |
//| samples. |
//| Input parameters:|
//| X - sample 1. Array whose index goes from 0 to N-1. ||
//| N - sample size.|
//| Y - sample 2. Array whose index goes from 0 to M-1. |
//| M - sample size.|
//| Output parameters:|
//| BothTails - p-value for two-tailed test. ||
//|If BothTails is less than the given |
//| significance level the null hypothesis is |
//| rejected.|
//| LeftTail - p-value for left-tailed test. ||
//|If LeftTail is less than the given |
//| significance level, the null hypothesis is |
//| rejected.|
//| RightTail - p-value for right-tailed test. ||
//|If RightTail is less than the given |
//| significance level the null hypothesis is |
//| rejected.|
//+------------------------------------------------------------------+
static void CAlglib::FTest(const double &x[],const int n,const double &y[],
                           const int m,double &bothTails,double &leftTail,
                           double &rightTail)