Spread trading in Meta Trader - page 5

 

In a nutshell:

1) The average spread is calculated

2) The current spread is calculated for LAST prices

3) If the current spread is above/below the average statistical spread, the position is opened. (Lower/higher is determined depending on the market situation - contango or backwardation)

 
How do you calculate the average spread (if it is not a secret)?
 
MetaDriver >> :

I'm not really sure what the crime is. Was she colluding with a broker to move prices? Or just with her dough? If with her own dough, I don't see any criminal activity. Wit, yes. Criminal, no. And your "big score" is just neurotic moralizing. When banks do it, no one thinks to call it criminality. :)


Read it here (from post 310): http://www.procapital.ru/showthread.php?t=20648&page=21 and here http://www.procapital.ru/showthread.php?t=21115

 
rid >> :
How do you calculate the average spread (if it's not a secret)?


double CalculateAvarageSpread(string Symbol_1, string Symbol_2,
                              int Timeframe, int NBars)
{
   int k;
   double N = 0;
   double Sum = 0;
   for( k = 0; k < iBars( Symbol_1, Timeframe); k++)
   {
      if( N == NBars)
         break;

      int symb2Shift = iBarShift( Symbol_2, Timeframe,iTime( Symbol_1, Timeframe, k),true);
      if( symb2Shift != -1)
      {
         Sum += iClose( Symbol_1, Timeframe, k) - iClose( Symbol_2, Timeframe, symb2Shift);
         N++;
      }
   }
   double avarageSpread = Sum / N;
   return( avarageSpread);
}
 

That's the position of the office and it's understandable why. But if you look at the facts - the kitchen has put out a bid and an offer, which is nothing more than an offer to make a deal. The client agrees to that offer. After that, to accuse the kitchen of being cheated, and at the same time to argue that "no one ever, not even the most brilliant trader ever trades at night on meat" or "we did not know that the market's liquidity is not infinite" - is child's play.

The kitchen's position looks very weak, I doubt they will want to take the case to court.

 

Yeah... Of course it's not smooth.

At B. in the demo, orders can only be opened at GCZ9 and GCG0, (Bid = Ask) symbol prices.

In real trading the order is opened at GCZ9#I and GCG0#I, (Bid != Ask).

And the spread is obtained quite adequately but there is no mega-profit.


So, it seems to be just another way to build beautiful demo balance charts.

 
Fduch >> :

Yeah... Of course it's not smooth.

At B. in the demo, orders can only be opened at GCZ9 and GCG0, (Bid = Ask) symbol prices.

In real trading the order is opened at GCZ9#I and GCG0#I, (Bid != Ask).

And the spread is obtained quite adequately but there is no mega-profit.


So, it seems to be just another way to build beautiful demo balance graphs.


Not exactly. ! On the demo, just as on the real positions are opened / closed at Ask / Bid Ticker prices #I (and not at all LAST)!

It's in the tester - work goes on prices LAST.

(And in tester B. the spread of ticker #I is not taken into account. With all that implies...)

Thanks, by the way, for the average spread code.

It works. Approximately the same as in the states on p. 1.

Although on the real, of course, is unlikely to be so smooth. Slippage practically (at best) reduces all obtained profit to zero. One has to search for the most optimal instruments. Fortunately, there is plenty of goods (tools). Then we might manage to squeeze something out.

The EA cannot be run in the tester for obvious reasons. Therefore, we will have to monitor the situation online. This is not a quick thing to do...

 

I further assume to implement spread deviation calculation and inputs calculation not by LUST prices, but by MarketInfo(ticker #I,MODE_ASK);

In addition, set a limit on the size of the current spread for each symbol:

spr = MarketInfo(ticker #I,MODE_ASK) -MarketInfo(ticker #I,MODE_BID) ;

And also set rigidly the time intervals of work. In order not to fall into illiquid hours with a huge spread when opening a position.

I think that in this way it will be possible to increase the profit (or decrease the loss) of each trade by 2-4 ticks.

 
Because of LAST prices it happens that the tickers of the hedge have been in a good profit for a long time (I am looking at it now - I put it in the comment), but the chart and the terminal show meager profit or, worse, are still in a loss because of the inertia of LAST prices!
Watching now on GBPUSD plus 6BH0, so urgently need to switch to MarketInfo prices(ticker #I,....
 

I've been following the topic almost since the beginning.

But, I don't quite agree with detecting both the average value and not quite clear on the issue of opening i.e. when.

I have described the spread (difference) somewhat differently.It may be crude, but it shows very interesting as an EA.

If you can speak up.

extern string Sum_1="GCG0";
extern string Sum_2="GCZ9";
double ARR[100,3];
double ARR_M[100];
int N=0;
int init()
{
ArrayInitialize( ARR,0);
ArrayInitialize( ARR_M,0);
}
int start()
  {
//----
double G0=MarketInfo( Sum_1,MODE_BID);
double Z9=MarketInfo( Sum_2,MODE_BID);
ARR[ N,0]= G0;
ARR[ N,1]= Z9;
ARR_M[ N]= G0- Z9;
N++;
if ( N>=100) N=0;
double SUM_0=0;
double SUM_1=0;
for (int r=0; r<100; r++)
{ 
SUM_0= SUM_0+( ARR[ r,0]- ARR[ r,1]);

}
double Aver= SUM_0/100;
double MAX=0;
double MIN=0;
for (int rr=0; rr<100; rr++)
{
if ( ARR_M[ rr]> MAX) MAX= ARR_M[ rr];
if ( ARR_M[ rr]< MIN) MIN= ARR_M[ rr];
}
Comment ("Aver  ",DoubleToStr( Aver,2),"   ", N,"   MAX  ",DoubleToStr( MAX,2)," MIN  ",DoubleToStr( MIN,2),"\n",
G0,"  ", Z9,"  ", G0- Z9);
//----
   return(0);
  }