Spread trading in Meta Trader - page 41

 

gold - oil


20077544 2010.01.15 19:41 buy 0.10 clh0 78.15 0.00 0.00 2010.01.15 20:06 78.55 -1.00 0.00 0.00 40.00
20077545 2010.01.15 19:41 sell 0.10 gcg0 1128.5 0.0 0.0 2010.01.15 20:06 1130.9 -1.00 0.00 0.00 -24.00
 
forex-k >>:

золото - нефть


20077544 2010.01.15 19:41 buy 0.10 clh0 78.15 0.00 0.00 2010.01.15 20:06 78.55 -1.00 0.00 0.00 40.00
20077545 2010.01.15 19:41 sell 0.10 gcg0 1128.5 0.0 0.0 2010.01.15 20:06 1130.9 -1.00 0.00 0.00 -24.00


Have you tried it on microreal? In B. slippage will kill everything...(((((((( a few pips is too little....

oops, sorry, wrong size of profit... 16 pips is something...)

 
We can always switch to real
 
Costy >>:

Поделитесь кусочком кода, как конретно выполняете синхронизацию. По экзотическим кроссам часто бывают пропуски на часовых данных. Поэтому тоже столкнулся с этим


I did it this way :

( software solution taken from Fduch' s code in the same thread)

  int k;  
   for( k = 0; k < iBars( Symbol_1,Period()); k++)   {  
   int symb2Shift = iBarShift( Symbol_2,Period(),iTime( Symbol_1,Period(), k),true);
  if( symb2Shift != -1)  {
//если на одном из символов пропущены бары, - то 
// - то пропускаем (не обсчитываем) их на др. символе
    
       Symbol1[ k]=.......
            
       Symbol2[ k]=......
.........

It turns out like this : - here for "hedge" (dax+futsi) - dax starts an hour earlier than futsi every day - and the indy on these bars - skips counting and rendering, - waits for futsi to start working.

See chart :



 
rid писал(а) >>

I did it this way :

( software solution taken from Fduch's code in the same thread)

It works like this: - here for "hedge" (dax + futsi) - dax starts an hour earlier than futsi - and the indicator on these bars - skips counting and rendering - waits for futsi to start working.

See schedule :

Thanks, I've already figured it out myself. I just rarely write indicators and I've never needed IBarShift function before.

To receive data for another currency pair on a certain bar you need not just use iClose(...i), but instead of i you should use the iBarshift function with the false parameter.

iClose("EURDDK",Period(),i)

iClose("EURDDK",Period(),iBarShift("EURDDK",Period(),Time[ i],false))
so if there is no bar, we will get the price of the previous bar, which is normal for currencies, as this price will be the current price at that time. In the case of indexes, your variant with gaps would probably be preferable.
 
Costy >>:

Спасибо, я уже сам разобрался. Просто индикаторы редко пишу и раньше не требовалась мне функция IBarShift.

Чтобы получить данные по другой паре на определенном баре нужно использовать не просто iClose(...i), а вместо i вставить функцию iBarshift с параметром false.

так в случае отсутствия бара мы получим цену предыдущего бара, что для валют нормально, т.к. эта цена и будет текущей на тот момент. В случае с индексами Ваш вариант с разрывами, вероятно, будет предпочтительней.

Won't it happen that the line of one instrument on the history will be shifted relative to the line of another instrument by the number of missed bars?

And on the history - this position of the lines will not be correct - for the "historical" analysis?

Though, it seems not.
 

rid писал(а) >>

And on history - would this line position be incorrect - for "historical" analysis?

If it is trading time, yes. If the trading time of the instruments is not the same, then it is better to make skips like yours.

It is possible to combine both approaches, which I am going to do, plus one more thing... Anyway, when the tool is ready and useful, I will probably share it with you.

 
rid писал(а) >>

Won't it happen that the line of one instrument on the history will be shifted relative to the line of another instrument by the number of missed bars?

And on the history - this position of lines will be incorrect - for the "historical" analysis?

I don't think so, though.

My variant will be good if the instruments are traded at one time (for example, currencies are traded 24 hours a day) and the bars are just missed due to low activity (it's nighttime). The lines will not shift, because the empty bars will be filled with the previous available price.

But an indicator based on this "synchronization" principle should be attached to the chart of an instrument, where the number of gaps is as small as possible. Because, theoretically, the bars can be absent in both instruments at different times... Or, you can follow it somehow for both symbols and fill gaps.... synthetically?

Example

EURUSD 03:13 03:14 _____ 03:16 03:17 03:18 03:19 (bars in these minutes)

EURDDK 03:13 _____ 03:15 _______________ 03:19 (bars in these minutes)

 
rid >>:

Пшеница+Кукуруза.

Сейчас, вот на сегодняшней истории виден хороший вход. Бай ZW + Селл ZC на пике кукурузы ZC (зел. линия)

Причем после максимального схождения (-136.85) - зеленая линия ZC резко, как по заказу пересекла сверху вниз синюю линию ZW и так и оставалась ниже синей до окончания расхождения..

И спред при этом, разошелся до -145.65 !

Вроде бы в Б. на календаре еженедельно выкладываются новостные отчеты по США по зерновым, молочным и т.п. инстументам. Надо бы отследить, как "хозяйственный" рынок реагирует на эти новости.




For almost a week I have been tracking a hedge (corn+wheat) with tiny lots for interest!

At the moment the situation is like this:

The total profit was both positive and negative. But on the whole, the trading was comfortable. Thus, the profit was not going in the red. It was possible to close in profit more than once.

Based on the weekly observations - we conclude that this "hedge" is quite suitable for trading according to the methods discussed in this thread!

 

Movement curve ( ZC+ZW+ZS)

(CORN-BLUE) + (WHEAT-GREEN) + (BEANS-RED)

Prospects for trading (manual and automatic) seem to be good !