Spread trading in Meta Trader - page 9

 
knt-kmrd >> :

getch, please explain to those who are in the dark

What does it mean to open a position on a synthetic instrument?

I read your explanation several times, but still do not understand.

What does it mean to open a position on EURUSD/EURGBP pair?

What do BID and ASK mean?

Read the comments on the advisor. As far as I could, I answered the questions there.

 
Rita >> :

In the context of the idea of arbitrage, synthetic instruments are correlated artificial trading instruments of equal value.

For example, different grades of oil are correlated trading instruments. Corresponding synthetic instruments are those matched to the same oil grade through coefficients.

In the theory section, everything is written succinctly and without "water". The idea is the same for any arbitrage.

 

Thank you. I see.

I was misled by the very first line of "theory".

"Using EURUSD as an example.Imagine synthetic pairs EURUSDx and EURUSDy...."

If it was written a little differently, like this: "Using the example of EUR and USD . Imagine ... etc. " - it would have been much clearer

//-------------------------

But the point that I must manually move the information from the ArbitrageStatistic.txt file to the Trade-Arbitrage.txt file was revealed only on the 25th page of my comments.

Initially it was impossible for me to understand this in the description. Only now I saw it.

//------------------

I wrote it not in reproach. And to make it easier for new visitors of your link to comprehend. There's a new surge of interest in arbitrage on this thread.

 

rid писал(а) >>


This can be implemented (in its simplest form) like this:

... ...

Because I have put in Magic (Magic and Magic2) the type of "hedge" in the code - it is necessary, because different positions in both types of "hedge" are calculated and closed at different prices, - by Ask and Bids of both tickers #I.

In addition, I have displayed the profits of the current trades in the comment "actual". That is, not the "fake" profit displayed by the terminal, but the actual one according to the tickers. Which will close "for real ... " !

At the very beginning of f-i START :

          
//----- Вывод информации на экран -----------------------------------------
string info="";
string on_off="---------------------------------------------------"+  "\r\n";
on_off=StringConcatenate  (
 "Среднестат.Спред = ", CalculateAvarageSpread( Symbol_1, Symbol_2,0, NBars)/ POINT_Tiker1);

//если 1-й продан а второй куплен
if ( NumberOfPositions( Symbol_1,OP_SELL, Magic)>=1  )
string on_off2=StringConcatenate ( on_off2,
"Текущая прибыль Sell-UP = ",( PriceOpenLastPos( Symbol_1,OP_SELL, Magic)- Ask_Tiker1)/ POINT_Tiker1,"\n");
else         on_off2=StringConcatenate ( on_off2,"Нет OP_SELL-сделок UP","\r\n");

if ( NumberOfPositions( Symbol_2,OP_BUY, Magic)>=1  )
string on_off3=StringConcatenate ( on_off3,
"Текущая прибыль BUY-UP = ",( Bid_Tiker2- PriceOpenLastPos( Symbol_2,OP_BUY, Magic))/ POINT_Tiker2,"\n");
else         on_off3=StringConcatenate ( on_off3,"Нет BUY-сделок UP","\r\n");

//----------------------------------------------------------------------
//если 1-й куплен  а второй продан
if ( NumberOfPositions( Symbol_2,OP_SELL, Magic2)>=1  )
string on_off5=StringConcatenate ( on_off5,
"Текущая прибыль Sell-RV = ",( PriceOpenLastPos( Symbol_2,OP_SELL, Magic2)- Ask_Tiker2)/ POINT_Tiker2,"\n");
else         on_off5=StringConcatenate ( on_off5,"Нет Sell-сделок RV","\r\n");

if ( NumberOfPositions( Symbol_1,OP_BUY, Magic2)>=1  )
string on_off6=StringConcatenate ( on_off6,
"Текущая прибыль BUY-RV = ",( Bid_Tiker1- PriceOpenLastPos( Symbol_1,OP_BUY, Magic2))/ POINT_Tiker1,"\n");
else         on_off6=StringConcatenate ( on_off6,"Нет BUY-сделок RV","\r\n");
//--------------------------------------------------------------------

info=StringConcatenate( info, on_off,/*on_off1,*/ on_off2, on_off3/*,on_off4*/, on_off5, on_off6,"\r\n");
info=StringConcatenate( info,"\r\n");
Comment( info);      
CalculateAvarageSpread( Symbol_1, Symbol_2,0, NBars) function was posted by Fduch somewhere above. However, this mapping can be removed altogether.


 

First results on the demo. Ticker work has been implemented. It opens positions by the Expert Advisor. Sometimes it is closed manually. But more often - through the Expert Advisor. There are quite a lot of slippages when opening/closing them.

Deals made in the last day and a half using (CL+BRN):

1111 exp_UP
19728426 2009.12.28 08:50 sell 0.10brng0 76.63 81.14 73.14 2009.12.28 09:37 76.42 -1.00 0.00 0.0021. 00

19728431 2009.12.28 08:50 buy 0.10clg0 78.17 73.67 81.67 2009.12.28 09:38 78.03 -1.00 0.00 0.00-14.00

19729203 2009.12.28 09:38 buy 0.10brng0 76.42 71.91 79.91 2009.12.28 09:42 76.47 -1.00 0.00 0.00 0.005.00

19729201 2009.12.28 09:38 sell 0.10 clg0 78.03 82.55 74.55 2009.12.28 09:42 78.08 -1.00 0.00 0.00-5.00

19729725 2009.12.28 10:14 buy 0.10brng0 76.59 72.10 80.10 2009.12.28 12:06 76.76 -1.00 0.00 0.0017.00

19729723 2009.12.28 10:14 sell 0.10clg0 78.23 82.73 74.73 2009.12.28 12:06 78.39 -1.00 0.00 0.00-16.00

19735914 2009.12.28 18:18 buy 0.50 brng0 77.04 0.00 0.00 2009.12.28 19:31 77.20 -5.00 0.00 0.0080.00

19735913 2009.12.28 18:18 sell 0.50clg0 78.76 0.00 0.00 2009.12.28 19:31 78.89 -5.00 0.00 0.00-65.00

19731371 2009.12.28 12:42 sell 0.50clg0 78.24 0.00 0.00 2009.12.29 10:52 78.98 -5.00 0.00 0.00-370.00

19731384 2009.12.28 12:44 buy 0.50brng0 76.66 0.00 0.00 2009.12.29 10:52 77.61 -5.00 0.00 0.00475.00

 
Why is the average spread used?
 

From this average spread (it is calculated for a specified number of bars - CalculateAvarageSpread(Symbol_1,Symbol_2,0, NBars), - I have extern int NBars=50; at timef=m1) the initial count is done when the EA is on and there are no trades.

It means, if this spread equals 159 pips when the EA is on and no trades are opened, then EA will remember this value as distance = 159.

And then, this value "distance=159" on every tick is compared with the current, changing value of the average spread - using the same CalculateAvarageSpread(Symbol_1,Symbol_2,0, NBars) from Fduch

And as soon as the current value of the average spread deviates from the "distance=159" value, which the EA "remembered" at the start, by the given value of the DELTA (=16 pips), - then the entry of the first (1 symbol to buy, 2 symbols to sell) or the second (2 symbols to buy, 1 symbol to sell) type is implemented. Depending on whether the current value of the average spread deviates upwards or downwards (from "distance=159").

Perhaps this is too confusing. But - I did - as best I could. (The indicator on the chart is not used by the Expert Advisor. The indicator is just for illustration - nothing more)

If you have any idea - how to make the entry easier and better, then please share!

//-----------------------------------------

Here's where Rita sends me now in the ICQ - this is the same Expert Advisor at the opening of the London session, set at (dax + futsi) has worked (closed) the first hedge:

19746512 2009.12.29 11:29 buy 0.11fdaxh0 6013.5 0.0 0.0 2009.12.29 11:48 6016.0 -1.10 0.00 0.009.91
1110 exp_UP
19746509 2009.12.29 11:29 sell 0.30ftseh0 5386.0 0.0 0.0 2009.12.29 11:49 5386.5 -3.00 0.00 0.00-2.40
1110 exp_UP


 
rid >> :

Rita is messaging me now, - the same Expert Advisor after the opening of the London session, set on (dax+futsi) has already worked (closed) the first hedge:


The second hedge of the day on (d+f) closed:

19747410 2009.12.29 12:11 buy 0.22fdaxh0 6018.0.0 0.0 2009.12.29 15:29 6027.5 -2.20 0.00 0.0075.41
1111 exp_UP
19747407 2009.12.29 12:11 sell 0.60ftseh0 5391.5 0.0 0.0 2009.12.29 15:29 5397.5 -6.00 0.00 0.00-57.65
1111 exp_UP

 
rid писал(а) >>

The second hedge of the day on (d+f) closed:

Is this a demo or a real?

If it is a demo, then the increased slips and requotes can kill the profit on a real account.

 

This is a demo. There are no requotes here (in this brokerage company). There are slippages for the worse.

What is interesting, they are almost the same on demo and on real - these slippages....

However. In my experience in this brokerage company demo and real do not differ much from each other, - provided that the real - not more than 2-2.5 thousand $.

//------------------------------------

P/S - the third (and last) hedge in today's session on (d+f) was closed manually before the close of the session. Looks like we need to increase the lot size at dax a bit.

19753331 2009.12.29 17:13 buy 0.22fdaxh0 6020.5 0.0.0 2009.12.29 21:36 6029.5 -2.20 0.00 0.00 71.08
19753328 2009.12.29 17:13 sell 0.60ftseh0 5395.0 0.0 0.0 2009.12.29 21:36 5401.0 -6.00 0.00 0.00-57.27



Reason: