Spread trading in Meta Trader - page 20

 

EURJPY - green line

USDJPY - blue line

EURUSD - red line


 
getch >>:
Попробую сместить немного тему в сторону формализации корреляции. Как определить коррелируемость двух торговых инструментов? В данном контексте имеется ввиду не академические рассуждения с таблицами коэффициентов коррелируемости, а практическая сторона - определение той корреляции, которую полезно использовать для торговли спредом.


Apparently - only by experience. Demo trading.

Take a tandem of 2 instruments and naggingly collect online transaction statistics.

For example, in yen pairs from Dec. 29 up to Seg. Day there is an observation that if there is a 35/40 pips divergence from the average spread (m1 - 100 bars) (4 signs) - you can easily buy one and sell the other.

 
On historical data.
 
rid >>:

С индексами - это в Б. надо. Там подача котировок и внутренний спред индексов и фьючей позволяют строить такую торговлю. А в др. дц - на фьючах спред - чуть ли не на порядок больше, чем в Б. и затея теряет смысл.

Работа идет на тф=м1, т.е. средне-стат. спред по ф-и Fduch-а вычисляется на тф=м1, при заданном числе баров NBars от 65 до 200 . В среднем, вход я задаю при расхождении текущего спреда от спреда среднестатистич. примерно на 150 - 300 пипсов (для 5-ти знач.котировок)

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

Нужно отметить, что иногда "хедж" уходил в просадку, - кот. по абс. в-не была больше в неск. раз, чем в итоге закрытый профит. Но такая просадка "хеджа" на реале психологически пересиживается гораздо легче, чем при одиночной обычной сделке. Особенно, при "портфельной" работе "хеджей"...

It's with the indices that a positive case can be made. As futsi and dax are constantly circling each other. But it is not so easy with DC B.

Yes, it seems that spread is smaller there (besides commission which is absent in DC Al for example). But... the guys there are very cunning. They have 2 tickers. On one you see the LAST price,

the other one has a floating spread. It seems small...So...probably only every third trade I open without a slippage...and it eats up all

The advantage of having a smaller spread visually... and the position has to be closed... and with a hedge you have to open and close 2 positions... But that's not all...

If your trading becomes profitable and you try to trade with them with 1-2 lots...I don't know how much the opening time will increase

trades and slippage will increase. Or, for example, they will open one position at once...and the second in half a minute and you are immediately in a good loss.

 

Yes. there is such a thing. But on page 10 - you can get an antidote to the ticker - see the last post there.

https://www.mql5.com/ru/forum/122468/page10

The difference between demo and real is that one cannot go back to the demo mode. And I barely notice the difference between real and demo. ("With a sheep - even if it's....")

 
rid >>:

Да. это есть такое. Но на 9 страничке - вы можете взять противоядие от тикера - см. там посл. пост.

https://www.mql5.com/ru/forum/122468/page10

н

I read all the pages before writing to you. That's not what I meant. That the difference when trading futures

on indices in B...or in other brokerage houses (on spreads) will be practically the same. You just have to adjust

the spread is big. And if you want to make money instead of indulging, you have to increase

lot size, and then the real spread will become even bigger. So the challenge is to build

to build an EA for spread trading considering even larger spread and slippage than those

that we have now when testing on demo (I'm speaking about futures).

 

The Expert Advisor does not calculate a hedge closing profit by LUST prices (which we see on the chart in B.) - it calculates the current profit by ticker prices - i.e. the actual profit. It sets the total closing profit in pips. Closed instruments are set in PROPERTIES.

If your hedge has been opened manually, you should set Magic=0 (by default), but in this case you are allowed to have only one hedge for this pair of symbols.

Otherwise, set Magic2 = (Magic+1); - I described above this point.

Works only in B.

See download.

#property copyright "rid"
#property link      "mql"

extern int     Magic = 0;int Magic2;
extern string  Symbol_1 = "FTSEH0";
extern string  Symbol_2 = "FDAXH0";
extern string  Symbol_1t = "FTSEH0#I";
extern string  Symbol_2t = "FDAXH0#I";
extern string  __ = "=== Ф-я закрытия по заданному профиту ==="; 
extern bool    Close_Profit = true;
extern int     CloseProfit = 150;//в пунктах
extern string ___ = "=== Прочие Параметры советника  ===";

extern bool   UseSound      = True; // Использовать звуковой сигнал
extern string NameFileSound = "expert.wav";// Наименование звукового файла
extern color  clCloseBuy    = Yellow;    // Цвет закрытия покупки
extern color  clCloseSell   = Green;    // Цвет закрытия продажи
extern int    NumberOfTry   = 10;      // Количество попыток
string SoundSuccess  = "ok.wav";      // Звук успеха
string SoundError    = "timeout.wav";// Звук ошибки
int        Slippage        = 50;   // Проскальзывание цены при закр
//-- Подключаемые модули --
#include <stderror.mqh>
#include <stdlib.mqh>
//--------------------------------------------------
int start()
{

double Ask_Tiker1 = MarketInfo( Symbol_1t,MODE_ASK);
double Bid_Tiker1 = MarketInfo( Symbol_1t,MODE_BID); 
double Ask_Tiker2 = MarketInfo( Symbol_2t,MODE_ASK);
double Bid_Tiker2 = MarketInfo( Symbol_2t,MODE_BID);
double POINT_Tiker1 = MarketInfo( Symbol_1,MODE_POINT); 
double POINT_Tiker2 = MarketInfo( Symbol_2,MODE_POINT); 
if ( Magic !=0) Magic2 = ( Magic+1); else  Magic2 = 0;

//жжжжж Закрытие позиций жжжжжжжжж

if ( Close_Profit == true){//если выкл-ль включен
//если первый символ продан, а второй куплен 
if (    ( ( PriceOpenLastPos( Symbol_1,OP_SELL, Magic)- Ask_Tiker1)/ POINT_Tiker1 +
   ( Bid_Tiker2- PriceOpenLastPos( Symbol_2,OP_BUY, Magic))/ POINT_Tiker2 )
>= CloseProfit){//если суммарный профит сделок 
// по факту больше заданного значения,
// -закрываем OP_SELL 1-го символа и OP_BUY второго симвлоа
if ( Magic !=0) {
ClosePosFirstProfit( Symbol_1,OP_SELL, Magic);
ClosePosFirstProfit( Symbol_2, OP_BUY, Magic);
                }
if ( Magic ==0)                
                {
ClosePosFirstProfit( Symbol_1,OP_SELL,0);
ClosePosFirstProfit( Symbol_2, OP_BUY,0);
                }
                         }
//если первый символ куплен, а второй продан
if ( (( PriceOpenLastPos( Symbol_2,OP_SELL, Magic2)- Ask_Tiker2)/ POINT_Tiker2 +
      ( Bid_Tiker1- PriceOpenLastPos( Symbol_1,OP_BUY, Magic2))/ POINT_Tiker1 ) 
   >= CloseProfit){//если суммарный профит сделок 
// по факту больше заданного значения,
// -закрываем OP_SELL 2-го символа и OP_BUY первого симвлоа
if ( Magic2 !=0) {
ClosePosFirstProfit( Symbol_1,OP_SELL, Magic2);
ClosePosFirstProfit( Symbol_2, OP_BUY, Magic2);
                }
if ( Magic ==0)  {
ClosePosFirstProfit( Symbol_1,OP_SELL,0);
ClosePosFirstProfit( Symbol_2, OP_BUY,0);
                }
                         }                     
       }//if (Close_Profit == true){//если выкл-ль включен
//-----------------------------------------------------------------
return (0);
 //-------Конец функции int start()------
     }

//жжжжжжж Пользовательские функцииИ.КИМА жжжжжж
Files:
 
rid >>:

Советник считает профит закрытия "хеджа" не по ценам ЛАСТ (которые мы видим на графике в Б.) - а расчитывает текущий профит по ценам тикеров - т.е. фактический профит. Задается суммарный профит закрытия в пунктах. Закрываемые инструменты задаются в СВОЙСТВАХ.

Если позиции "хеджа" были открыты вручную - то следует задать Magic=0 (т.е. по умолч.) - но в этом случае в работе допускается иметь только один "хедж" по данной паре символов.

В противном случ. задавать Magic2 = (Magic+1); - я выше описывал этот момент.

Работает только в Б.

См. закачку.


Have you ever thought of analysing several indices and their relative strength against each other...as in a multi-currency

CC indicator?

 

Yes - that was the idea.

But that would just be price lines of different indices in the same indicator window.

And not the relative strength of each other.

And do they influence each other? If they do, their influence is not significant.

Let's see now.

 
rid >>:

Да - была такая идея.

Но вот только - это будут просто линии цен разных индексов в одном окне индикатора.

А вовсе не относительная сила др. на друга.

А да и влияют ли они друг на друга? Если и влияют - то оч. незначительно.

Сейчас глянем.

On M1, yes. But on bigger TFs...it could be movements...there is an RS indicator.

Not RSI. There is no RSI in MT4.

Reason: