Spread trading in Meta Trader - page 80

 
rid >>:

Тоже неплохой подход. Только вы не показали, - как программно вычисляются

(Mediana(symbol_1) и Mediana(symbol_2).

Кстати, как по вашему алгоритму получились бы лоты тандема GCG0+УMH0 ?

The ratios are about 1:3.2, but this is with a jagged graph, as said above.

I have described the algorithm in principle, but here is the function code just in case (instead of 30 days you can take any number, a couple of extremes are discarded):

double Mediana(string symb)
{
	int sum = 0;
	int count = 0;
	double pp = MarketInfo( symb, MODE_POINT);
	int hod[];
	ArrayResize( hod, 30);
	for (int i = 1; i <= 30; i++)
	{
		hod[ i-1] = (iHigh( symb, PERIOD_D1, i) - iLow( symb, PERIOD_D1, i)) / pp;
		if (GetLastError() == 0)
		{
			sum = sum + hod[ i-1];
			count++;
		}
	}
	
	if ( count < 30 && count > 0)
		return(NormalizeDouble( sum / count, 2));
		
	ArraySort( hod);
	
	sum = 0;
	for ( i = 2; i < 30 - 2; i++)
		sum += hod[ i];
		
	return(NormalizeDouble( sum / (30 - 4), 2));
}
 

A small indicator sketched out, based on Fduch.

Briefly:

1. It counts the difference of 2 instruments for a certain period, and averages them.

2. All resulting positive values are again averaged and multiplied by the coefficient.

3. Negative values - in the same way.

4. we may trade when the indicator reaches these levels, close on profit.


#HPQ:#IBM (1:0.45), #IBM:#INTC (1:4.63), #INTC:#MSFT (1:0.77) and other combinations in this group show very good results.

#CLH0:#NGH0 (1:11.1)


All symbols in the broker Inst...

Files:
 

Completed the lot calculation script, now offers a number of options for the instrument split. Choose the one that suits your needs.


Files:
lot_final.mq4  2 kb
 
rid писал(а) >>

Set a different magik at each input and you won't have any problems! That's why the magik is there! - So that it is different for each tandem.

And you can close any tandem by such an advisor as Kim's one(http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=44 ) according to the chosen magic code - without disturbing other tandems!


I haven't found the magician in the above-mentioned EA (or rather in the link that points to another one), but it is in http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=44,

but there is no stop loss in it.

I wondered if it would be able to close two positions with equal masters,

i.e. will it calculate total profit and loss of two positions?

 

Which other one? - We have the same link in our posts - look carefully! And the link opens the same Expert Advisor that I "meant".

It closes the total profit/loss of two or more positions with the same magician.

 
rid писал(а) >>

Which other one? - We have the same link in our posts - look carefully! And the link opens exactly that EA - which I "meant".

I don't know what you're talking about, but I'm sure you'll get the right one.

it's true, but some profits are often lost because of the tickers.

 
forex-k >>:

и все таки мой старый метод синхронизации лотов более правильный

вбиваете в настройки базовый лот и два инструмента, бросаете скрипт на график и готово...




My script sometimes doesn't count correctly (grain instr.):

Or here are the German papers :


The tick size of each tool is different in both cases (in points)

 
rid >>:


У меня что-то иной раз некорректно считает скрипт (зерновые инстр.):

Или вот немецкие бумаги :


Размер тика каждого инструмента в обоих случаях разный (в пунктах)

By the way, maybe playing with lots isn't worth it at all. Having analysed various pairs I came to the conclusion that in principle the lots should be almost always equal, even on the gold-silver pair. The criterion is an even profit/loss distribution.

Here is an indicator showing how the profit/loss with equal lots on the gold/silver pair if we opened on the green line with 0.1 and 0.1 lots

green histogram is profit/loss in deposit currency


 
forex-k >>:

Да кстати возможно игра с лотами вообще того не стоит. Проведя анализ различных пар я пришел к выводу что в принципе лоты должны быть почти всегда равны даже на паре золото серебро. Критерий это равномерное распределение прибыль/убыток.

Вот индикатор показывающий как развивалась прибыль/убыток с одинаковыми лотами на паре золото -серебро если бы мы открылись на зеленой линии с лотами 0.1 и 0.1

зеленая гистограмма это прибыль/убыток в валюте депозита



What about (dax + futsi), (KC+RCE), (YHOO+INTC=3:2) etc....
 
rid >>:


А как же (дакс +футси), (KC+RCE), (YHOO+INTC=3:2) и т.п....

need to check....

similar to dax + futsi, lots should also be the same, it's not the lots that are important, but the logical use of the tools.

it is important that the tools always return and there are no mega gaps, only then everything will work fine

regarding coffe .... there are not enough quotes for analysis


Reason: