Triarbitrage Help

 

I like the idea of projecting a price and trading 3 currenciy pairs. If you know that one of the 3 is going in a particular direction you can in theory take a corresponding position in all 3 pairs knowing that they will all "share" a value somewhere down the road. Might be a usefull way to predict the short term market direction....

A,B,C = your pairs.

Note some pairs are represented "backwards" so you have to divide by 1 to get the correct value.

If this formula is not true then you have an arbitrage opportunity. you can realize your profits in any of the currencies by changing what you are buying or selling. Also note that you have to use the correct value (bid or offer) depending on the direction you are going.

I find this method pretty useful. Gives you a big picture view of market behavior. See the snapshot, these calculations allow me to predict which direction the currency is going to be pulled. Dont just look at one pair and decide weather its going up or down, with this method you know.

Is someone interested in this tipe of trading?

Feel free to ask and share expirience becouse this is THE SYSTEM!!!

Files:
pic_3.jpg  46 kb
 

This must be a record

This is not true Arbitrage Its basically just calculating what the market thinks the price should be. For example if you have great upward momentum in the USD, other currency's will have to adjust. So you simply take a position to capitalize on the adjustment. One cool thing about forex is volatility, one move causes a chain reaction with other currencys. Like making waves at 2 ends of the same pool, the waves will eventually pan out when the energy is lost but until they do you have all sorts of different directional waves that you can catch (in theis case calculate).

The calculations account for the difference in the bid and offer (spread) via a std deviation. It will not be profitable if you are trying to trade the market mover, its more like follow the leader. Even the EurUSD has to make adjustments when other pairs move.

Files:
test_2.jpg  107 kb
 

This is not Tri arbitrage in its true form.

Creating synthetic prices is correct, I called it consensus pricing.

Ok just to clarify how the formula works ... Solving for EURUSD

(Verification$/Cross$ * Base$/Verification$ = Base$/Cross$. )

The actual Price of EURUSD = 1.5786

(AUDUSD * EURAUD = EURUSD)

So if the AUDUSD = .9607, and EURAUD = 1.6430

According to the AUD Triangular relationship to the EURUSD. The EURUSD should = 1.5784 (.9706 * 1.6430 = 1.5784)

In this case the Actual price is 2 pips higher than the price according to the AUD triangular relationship. This is within the Std deviation (spread) and not significant. But if say the EURUSD was really trading at 1.5790 then we would take a short EURUSD position hoping that the market will correct itself.

taking it one step further you verify the price against all the major currencies and determine if the price should be higher, lower or if its correct. Now we use all that info to determine what positions to take.

Files:
 

The EA has to calculate:

The correlations of 36 currency pairs to across 35 other pairs.

3-8 Triangular validations for each pair

the relationship of each Triangular validation to the Index

the direction of each index

a consensus value for each pair

Then using the consensus values starting back at #1 to compare it to the actual price.

I am using the calculated prices as more of a filter to determine the short term market pressures (5-15 min) this allows me to determine overbought or oversold conditions. Then if the really short term (1-3 min ) pricing is outside of the the std deviation (+spread) I use it as a signal and take a position. then I hold it until the market corrects or reverses.

I disagree with weighting everything the same throughout the day. The reason being: If you run simple currency correlations through out the day you will not get any statically significant results, (basically you get white noise) but if you compartmentalize the day by market times you end up with some pretty significant findings. I break the market hours down to 7 separate categories.

London,LondonNY,NY,Sydney,SydneyTok yo,Tokyo,TokyoLondon.

then further break that down by News announcements (which usually occour during the beginning of a new market opening.) and weekly open and close.... (begining of the week is usually pretty unpredictable and the end is usually pretty slow.)

this gives us roughly 40 distinct markets on any given week and each market is influenced by different factors.

Technical systems are like looking at white noise on a TV screen and determining which pixels are going to turn black and which ones are going to be white. There is simply no pattern unless you can figure out how to filter the noise correctly.

So here are the results of live testing on a new demo account for the past 24 hours. Again this is just entrys and exits based on signals and reverse signals.

Usually the market just returns to equilibrium rather than reversing. . . I think a more logical order management would be just to take a pip as soon as you have it as a counter trend system or hold on to positions that agree with your fundamentals.

I used it as my entry logic for yesterdays and todays trades with the EURUSD (in addition to my fundamentals which said long positions only) and closed 262 positions at a 100+ pip Take Profit, 34,729 pips in less than 48 hours has to be a record somewhere. I guess I should give some credit to the employment numbers that caused the jump too...

Files:
pic6.jpg  116 kb
 

Thank you for sharing! This is such an eye-opening system, I must say. I used to test the arbitrages. I thought the spreads will ruin such opportunities. Of course, that would happen only if you open multiple positions. I totally forgot the market equilibrium. If we can determine the equilibrium of a pair using the other pairs, we'll know what that pair will be heading to. But something is very odd here. I don't get it why the market allows the prices to deviate so far to create such arbitrages. It is as if the market is unaware of it. This could be a problem. If the market is unaware of the arbitrages, it will not move the pair to the equilibrium. Maybe the market needs some time to react? Or maybe different banks quote the pairs differently?

I can't wait to try this on Monday. I'll get back with some scripts if possible.

 

Sometimes it will hold a position for a few extra pips if the market consensus is pulling that pair in a particular direction. The consensus price is simply a validation price for the pair based on triangular relationships with other currency's. These are not true arbitrage opportunities, the purpose is to determine the short term direction of a pair based on a broader market picture. The logic is that the market will always correct itself. These are the same kind of calculations that banks use to determine the pricing that they are going to offer liquidity at (+- commissions/spread). You still need to know what is moving the market at a particular time. Example during the NY session the USD is going typically move first so you would use these calculations to follow USD movements, but during the asian session you might want to trade USD following JPY movements.

 

Ok so I changed the algos to calculate the consensus pricing based on MA's instead of real pricing. (High+Spread for Ask and Low for Bid) This basically widens the gap between overbought and oversold equilibrium pricing by a few pips resulting in fewer more profitable and less risky trades.

 

Remember that this is a M1 method that captures a minimum of 3 pips!

I wrote a Script that places arrows on the chart of the EURUSD when the Actual price is greater or less than the calculated price. The arrows are placed live in real market conditions at the correct Bid or Offer. 159 pips in a few hours is not to shabby.

I account for the spread using a Std deviation. I wrote a quick EA that buys EURUSD when its over priced and sell when its under priced. Testing cannot be accurate for this type of EA since it involves 1min data from 36 currency pairs (MT4 crashes after about 300 bars) but the results are impressive. Im thinking that if you determine the daily direction then turn a system like this on and just take positions in that direction all day you can do pretty well.


 

Here is the function that I use for orders

part1

void SendOrder(){
int ticket=0;
int err=0;
int c = 0;
int Attempts = 100;

for(c = Attempts ; c >= 0; c--){
HealthCheck();
RefreshRates();
ticket=OrderSend(O_Symbol,O_Type,O_Lots,O_OpenPrice,O_Slippage,O_StopLoss,O_TakeProfit,O_String,O_Magic,O_Exp,O_Color);
if (ticket > 0) {Print(" Order Symbol : "O_Symbol," Order Type : "O_Type," Lots : "O_Lots," Open Price : "O_OpenPrice," Slippage : "O_Slippage," Stop Loss : "O_StopLoss," Take Profit : "O_TakeProfit," "O_String," Order Magic : "O_Magic," Order Exp : "O_Exp," Order Color : "O_Color," Open Time : "OrderOpenTime()," EA Took ",GetTickCount() - TickStart," milliseconds" );break;}
err=GetLastError();
if(err==0 || err==2 || err==4 ||err==6 || err==8 || err==9 || err==64 || err==128 || err==132 || err==133 || err==137 || err==139 || err==141 || err==146){ //Sleep and retry errors
Print("....................... Sleep And Retry Error Code= ", err," "ErrorDescription(err));
Sleep(10);
continue;
}
if(err==135 || err==136 || err== 138){ // price change errors
Print ("..................Invalid Price " O_String + " ..............");
WindowScreenShot("S_REQUOTE_"+Month()+"_D"+Day()+"_H"+Hour()+"_M"+Minute()+"_S"+Seconds()+".gif",1440,900);
Print("....................... Price Error Code= ", err," "ErrorDescription(err));
start();//restart and make sure that new price meets our entry criteria
break;
}
else{ // other errors
Print(".......................Error Code= ", err," "ErrorDescription(err));
break;
}
}
}
void ModifyOrder(){
int ticket=0;
int err=0;
int c = 0;
int Attempts = 100;

for(c = Attempts ; c >= 0; c--){
HealthCheck();
RefreshRates();
ticket=OrderModify(M_Ticket,M_Price,M_StopLoss,M_TakeProfit,M_Exp,M_Color);
if (ticket > 0) { Print(" Ticket : ",M_Ticket," Price : ",M_Price, " Stop Loss : ",M_StopLoss," Take Profit : ",M_TakeProfit," Exp : ",M_Exp," EA Took ",GetTickCount() - TickStart," milliseconds");break;}
err=GetLastError();
if(err==0 || err==2 || err==4 ||err==6 || err==8 || err==9 || err==64 || err==128 || err==132 || err==133 || err==137 || err==139 || err==141 || err==146){ //Sleep and retry errors
Print("....................... Sleep And Retry Error Code= ", err," "ErrorDescription(err));
Sleep(10);
continue;
}
if(err==135 || err==136 || err== 138){ // price change errors
Print ("..................Invalid Price " O_String + " ..............");
WindowScreenShot("S_REQUOTE_"+Month()+"_D"+Day()+"_H"+Hour()+"_M"+Minute()+"_S"+Seconds()+".gif",1440,900);
Print("....................... Price Error Code= ", err," "ErrorDescription(err));
start();//restart and make sure that new price meets our entry criteria
break;
}
else{ // other errors
Print(".......................Error Code= ", err," "ErrorDescription(err));
break;
}
}


 

Part2

}
void CloseTicket(){
int ticket=0;
int err=0;
int c = 0;
int Attempts = 100;

for(c = Attempts ; c >= 0; c--){
HealthCheck();
RefreshRates();
ticket=OrderClose(C_Ticket,OrderLots(),C_Price,C_Slippage,White);
if (ticket > 0) {Print (CloseString);break;}
err=GetLastError();
if(err==0 || err==2 || err==4 ||err==6 || err==8 || err==9 || err==64 || err==128 || err==132 || err==133 || err==137 || err==139 || err==141 || err==146){ //Sleep and retry errors
Print("....................... Sleep And Retry Error Code= ", err," "ErrorDescription(err));
Sleep(10);
continue;
}
if(err==135 || err==136 || err== 138){ // price change errors
Print ("..................Invalid Price " CloseString + " ..............");
WindowScreenShot("S_REQUOTE_"+Month()+"_D"+Day()+"_H"+Hour()+"_M"+Minute()+"_S"+Seconds()+".gif",1440,900);
Print("....................... Price Error Code= ", err," "ErrorDescription(err));
start();//restart and make sure that new price meets our entry criteria
break;
}
else{ // other errors
Print(".......................Error Code= ", err," "ErrorDescription(err));
break;
}
}
}

it is in two parts becouse it cant be posted in one post, so simply add
part 2 to part1, and that is it.....

 

In an EA like this you have to use a continuous loop in order to have the correct pricing at any given time. I loop my Start function like this.. Just make sure that all your functions dont close the loop or return the start().

int start()
{
while(IsConnected()){
TickStart = GetTickCount(); //Count milliseconds for each loop for code optimization
CheckBid = Bid; // set Bid to correct value for calculations for upcoming cycle
MarketHours(); //Check to see what the market conditions are
if(OrdersTotal() > 0){ManageOrders();} // Look for open orders and manage them
Triggers();//Check to see if there are any new order opportunities
ChartComment();
Sleep(10);
}
return(0);
}

-----------------------------------------------

Also when considering Bid, Ask spread in your calculations you have to validate the price each way for the currency pair that you want.

Example if you looking for signals on EURUSD according to the AUD. a buy signal would use ASK("EURUSD") ASK("AUDUSD") * BID("EURAUD"). Hope that helps you out...

I am allowing a new position every time I get a signal. I want to see exactly how many signals I receive so that I can determine the best way to eliminate the bad ones. I will pventually change this to a stepped up averaging rule, allow 3-6 positions in one direction at different levels - say 3 pips apart.

Exits are now based on 1) end of a trend 2) scalping rules, 1-3 pips TP 3) support and resistance levels... I abandoned the reverse signal theory a while ago. I dont know why all my positions arent closing at the same time. Do you know how to make this happen (close multiple orders at once).

Also I am using a stop loss now based on a 4 hour support and resistance level. usually 50 or so pips.

Im also finding it allot more important to "weight" certain validation currencies during different times of day.

Reason: