Jump to content
Sign in to follow this  
downloadz

Triangular Arbitrage - Simple, High-Profit, Low-Drawdown

Recommended Posts

This POST #1 will always be updated with the most recent information.
So, if you don't have time to read all of the posts, skip to this one.

I'll keep the EAs informed as well.

The remaining posts are intriguing, and I enjoy flame wars.


*******************************
***********************************************************************************************************************************
1) Purchase 1 GBPJPY unit; 2) Sell 1 GBPUSD unit
3) To balance everything out, sell?? units in USDJPY using the USD from point (2).

Purchase at a low price and sell at a high price.
Rinse and repeat as needed.

Is this feasible, and if so, what are the potential pitfalls?


******************************* \sDetail \s*******************************
OK I'm still new to this, but triangular arbitrage appears to be intriguing.
I created an EA to trade the GBPUSB, GBPJPY, and USDJPY currencies.

Basically
1) Purchase one GBPJPY unit.
2) Sell 1 GBPUSD unit
3) To balance everything out, sell?? units in USDJPY using the USD from point (2).

This effectively ZEROES your position after subtracting spread, commission, and swap.
Simply hold on to this until you make a profit.
The ZERO point will be the center of oscillation.

Once I've made a profit, I'll switch the 123 points above to Sell, Buy, Buy.

My entry can be random and then go from there, but since I started, I've changed it to calculating the low and high points and using those figures as entry points.

Now, sometimes you do get in at the wrong time by accident.
Essentially, you are buying at the highest point and it will never return to that level.

I found it 9 times over the course of two years.
The load spikes at the bottom of the graph demonstrate this.

A minor grid is used to solve this problem.
Basically, if you buy at the highest point, you'll be stuck, but don't worry because it can only fall so far before returning, but never past that point, so just wait a bit and let it fall, and once it's fallen far enough, buy the same amount again and leave it for a guaranteed profit a little more than halfway back, so just wait a bit.

As I previously stated, my area of expertise is math and programming, but I am new to the forex market.

The demo EA I created ran from June 23, 2015, to June 16, 2017.
I started with $1,000 and ended up with $2,725,839.38. My maximum drawdown was 25% of the account during this time.

I did have a safety catch in the system to prevent losses from exceeding 25%, which was hit twice during the two-year period, but this has no bearing on the EA because it will adjust to the next balance as needed.
The weekend gaps on Monday were the cause of the 25% drawdown spikes.
I tried to avoid Friday trades, which reduced the maximum drawdown to 15%, but the overall profit fell to around $1,800,000.00.

Other things to note were that after the one-year mark, around 2016-06-28, I was maxing out my Metatrader 5 back test lot size at 99 lots, and from there it stopped growing exponentially and began a slower sequential growth.
You can split your account into multiple accounts in the live environment long before it reaches the limit for even more profit.

If you can keep the exponential growth growing from 2 hits to about 4 hits, maybe 5 at most, the 25 percent drawdown hits will probably increase as well, but the EA is designed for it and can handle about 20 times 25 percent hist before showing a loss, because the growth rate is about 100 percent every 2 months and at worst it hit the 25 percent drawdown twice in a year.

I don't have the funds to test this live, but demo testing appears to be quite effective.

Any suggestions would be greatly appreciated.

I even found it profitable with a $100 starting capital, but at this price, all three pairs will start at 0.01 lots, which is a little off-balance given that the USDJPY cannot be the same as the others, but once it breaks the $1000 profit mark, it works well, and the $10,000 mark is just rocket fuel for it.

The upward spikes in the charts should be ignored.
The EA is instructed to begin selling the most profitable item first.
What interests me is the equity and how far it drops after a three-pair group is opened.

Because the 2 pair 25% drawdown occurred at the start of the chart, it is almost imperceptible when compared to the rest of the chart's profit.


*******************************************************************************
UPDATE ON THE RULE: 2017-09-23
*******************************************************************************
This is a MAJOR update, so pay attention.

The rules have changed slightly.
The three symbols are still triangular.

But.
I now calculate the average profit from a BUY, SELL, SELL as well as a SELL,BUY,BUY.
I get two lines as a result of this.
The higher line is referred to as the ASK line, while the lower line is referred to as the BUY line.

Between the two lines is a calculated average line over a period of time, which is mostly a straight line because the buy and sell lines cancel each other out there.

Now and then, the ASK line will cross the average line, and this is when you should open a Buy(Sell, Buy, Buy) order to profit from the inevitable uptrend.
Once the SELL line crosses the average line, the open buy is closed.
In order to start a sale, do the opposite (Buy,Sell,Sell).

Furthermore, I do not simply open when it crosses the middle average line; rather, I wait until it crosses the average line for a significant distance before opening.

Okay, I added a lot more checks and stuff to the EA, but that's the gist of it.

Keep in mind that I tested this on MyFxchoice with a leverage of 1:200, so stick to those settings.
I may work on other settings, and I attempted to build in intelligence to adapt to different brokers, but I only had so much time, and it may not work properly.
Before moving forward, run a backtest to ensure everything is working properly.

USE ON A LIVE ACCOUNT ONLY.

Other features of the EA include: 1) Avoid trading weekend gaps because Monday slippage can be significant.
2) Do not trade between the hours of 12 a.m. and 2 a.m. for the same reason (1).
3) To improve trade calculation performance, move all display and log coding after the system calculations.
4) Only use 50% of your account for trading, which means only 50% of your account must be converted to used margin.
The draw-down is about 5% at this point, but I'm afraid of getting a margin call if I increase it.
I'm not sure if 20% is better, but I'll give it a shot one day.

5) Look for any failed trades and kill them to restart.
6) To avoid system failure, look for weekend and inactive markets.
7) Use a single 0.01 lot trade to check commissions.
😎 A large number of logs and graph code to show what's going on.
This consumes a lot of memory, so I'll probably move it to another EA just for display purposes. It's not necessary for trading, but it looks nice and you can see why the EA does what it does.
Then you can have one EA for trading and another for displaying the results, without the display EA interfering with the trade processing.

1) Slippage and trade delays are issues.
When I open three trades for three symbols at once, I'm getting close to 500 milliseconds of lag.
This can result in significant slippage, particularly on the third trade, but I still make money on most trades because the EA allows for some slippage.
I'm still looking for ways to reduce the time delay, but it appears to be a limitation of Metatrader's functionality.

1.1) Using four metatrader terminals, I might be able to improve trade speed, and I've already written programs to allow EAs to communicate with the outside world in less than one millisecond, but a single trade still takes about 300 milliseconds to start.

On the bright side I have now developed a driver that can connect an EA to anything else from other EAs to other terminals or even outside programs like java and even to other PCs in other countries or any other device for that matter or even making a metatrader EA use things like the FIX api.
For this driver, the possibilities are endless.

1.2) Delayed trade starts appear to be caused by the terminal logging out if no trade action has occurred for a period of time, and when a new trade is required, the terminal must log back in before the trade can be opened or closed.
Except for sending dummy trades or impossible pending trades or trade modifications every 20 to 30 seconds, I couldn't find a way to prevent logout.
The issue here is that your broker may not appreciate receiving so many trade signals.

1.3) The FIX API
I have been playing around with FIX api and it might be a solution to this trade delay, but I need to test it first and .... well... time is not on my side

 

******************************************************************************* RUNNING THE EA *******************************************************************************
Do not run on live account.

Just attach the EA to a chart ....... That is it

Some more details.
The EA is made to run with symbols GBPUSD, GBPJPY, USDJPY
Exactly and it is case sensitive.
If those symbols is not in your market watch or trade able then it will not work, UNLESS...

There are a couple of parameters in the EA you can set.
Mostly the trade symbols.
Keep in mind the EA is only made for GBPUSD, GBPJPY, USDJPY BUT if your broker contains symbols like GBPUSD#e ex.. then you can use the parameters to change the EA to use your broker's symbols.
Keep in mind it is case sensitive and therefore if your broker lists GBPUSD#e and you put in GBPUSD#E then the EA will not work.

Share this post


Link to post
Share on other sites

appears to be impressive
On a real-world basis, one thing that comes to mind is a problem with the execution times of your orders.
They execute instantly in the demo, but you may experience drawdowns due to lag on real accounts.
I'm guessing this strategy should be tested on a live demo account first.

Share this post


Link to post
Share on other sites

@gabelime
I may have calculated it incorrectly, but I follow the following procedure:
GBPJPY is equal to lotSize GBPUSD is equal to lotSize USDJPY is equal to lotSize * GBPUSD.

@c
Yes, I am aware of this and would welcome the opportunity to put it to the test.
I'm currently testing it out on a demo account, but I'm experiencing a 400ms lag.
Still profitable (albeit slightly less so), but with a high rate of requotes and slippage.
I do intend to incorporate slippages and requotes, which should be straightforward programming, but my issue is a lack of time and funds to complete the development and possibly acquire a VPS to improve my forex connection, which will cost me about $40 per month..... That is a substantial sum of money in South African rands and is well beyond my financial means.
It took me a few months to get it where it is now, and another two months to make it bomb proof.

@noahcosIN ADDITION TO @HurryK
I've included the EA with this message, but PLEASE DO NOT USE IT ON LIVE.
Rather on a demo account that is faster than mine.
Reasoning is the functionality I have not yet included in it.
As @amazingjuly stated, there are aspects of a live account that are not included in back tests.
To mention a few:
1) Quotations are repeated.
EA should still profit, but with further development, it will profit much closer to back test profit if it knows how to look for and cater for it, which I am capable of programming.... Will take some time.... and at the moment, I am unable to afford additional work time.
2) Sliding.
EA should still profit, but with further development, it will profit much closer to back test profit if it knows how to look for and cater for it, which I am capable of programming.... Will take some time.... and at the moment, I am unable to afford additional work time.
3) COLLISION
Currently, the EA exists in a fantasy world of perfect internet and metatrader programs.
Isn't that lovely?
3.1) At the moment, the EA does not check for existing positions upon startup, which means that if there are any, they will cause the EA's head and calculations to malfunction.
3.2) If Metatrader is restarted, it will also fail to look for trades that have been left open since the last time it was run, causing the future to be incorrectly calculated.
3.3) Electronic Arts Freeze.
I have not seen this, but it is a possibility that I would like to incorporate a remote connection to my cellphone or email or something similar to alert me to any problems so I can jump in and save it from gremlins.
3.4) Check for existing positions and process them, or warn the user and terminate the process if the position is not part of the system.
3.5) Check for multiple EAs that may cause it to malfunction.
3.6) The EA is also available in a Metatrader 4 version.
(Completed but not yet tested.)
3.7) I still require a method of profit extraction that does not interfere with the EA.
This can be accomplished through the use of user settings that can be activated mid-run to instruct the EA to ignore a user-specified amount and then notify the user when the amount is exhausted, allowing her to extract it without affecting the EA.
You can extract any amount at any time in-between trades, assuming there is no open position, which is difficult given the EA's ability to open another trade immediately.
3.8) Numerous other potential issues must also be investigated....

All of these CRASH points in the program are easily resolved.... Will take some time.... and at the moment, I am unable to afford additional work time.

To operate the EA.
1) Verify that you have NO OPEN POSITIONS ON YOUR ENTIRE ACCOUNT.
2) Connect it to a chart of the GBPUSB, GBPJPY, or USDJPY.
NOT MORE THAN ONE CHART.
Any time period.
It simply needs to be active and capable of receiving tick signals from any location.
You can actually attach it to any chart, but the tick signal timing will vary, making one of the top three pairs the best choice.
3) I recommend starting with a $10,000 account, but it should work with less.
As stated previously, it worked on a $100 account, but it is risky with whiskey due to the USDJPY pair being out of balance at the time.
4) That is all.
Nothing is required in terms of settings or anything else.
It does monitor spreads and will refuse to open trades if they are too wide.
I recommend an ENC/commission broker with competitive spreads.
It will take approximately six months for it to average out and begin to generate real profits.
Or sooner if you're fortunate.
It executes some trades once every three days on average, but can execute several per minute if the market is extremely volatile.
Bear in mind that this version of the EA is set to an EXTREMELY aggressive level of aggression.
I can configure it in a more conservative manner and still earn approximately 500 percent profit per year, but hey, I AM A DAREDEVIL. Or I was smacked too hard on the head.

Share this post


Link to post
Share on other sites

If you are not adding or closing trade sizes while positions are floating, you are essentially trading price changes, which can be positive or negative.

So far, the initial lot size calculation appears to be correct, but what about the actual prices? When you open an arbitrage trio and let it run for 4 days or weeks, the pricing will change, so lot sizes should be adjusted by adding or closing partially. If not, you are essentially trading the distortion of price change, which can be positive or negative.

Share this post


Link to post
Share on other sites
Just now, MiSt_Lix said:

If you are not adding or closing trade sizes while positions are floating, you are essentially trading price changes, which can be positive or negative.

So far, the initial lot size calculation appears to be correct, but what about the actual prices? When you open an arbitrage trio and let it run for 4 days or weeks, the pricing will change, so lot sizes should be adjusted by adding or closing partially. If not, you are essentially trading the distortion of price change, which can be positive or negative.

n when trades floating swaps will kill, if u wanna test on real find a swap free account, just sayin

Share this post


Link to post
Share on other sites

@mist lix
Thank you for your input.
I'm not sure if I understand correctly, but here we go.

I actually haggle over price changes.
Except for the spread, swap, and commission, I would make no profit or loss if the price never changed.

The point at which I open the three pairs is known as the ZERO point.
Around this price, the price normally oscillates up and down (profit and loss).
BUT, every now and then (once a year or so), the ZERO point moves.
The ZERO point cannot move too far or the entire financial world system will collapse, but it can still affect you with leverage.
But there is one more snag in this case.
If I open a position and it remains open for more than 3 days, I will look for the lowest point in the last floating 3 days and, if it is hit again, I will open another position in the same direction to counter the ZERO point move.
This way, the price only needs to move half way back to profit and close the entire position.

This will be visible in the cart I added above on the bottom DEPOSIT LOAD.
There are spikes where my position has more than doubled.
I never go more than two full positions in, and if it does not recover by then, I have a final stop loss of 25%, which has been hit twice in two years, which is more than acceptable given the rate of growth.

My tests include SWAP, so it already supports swap.
The majority of my trades happen too quickly in one day to incur any swap.

Share this post


Link to post
Share on other sites
2 minutes ago, downloadz said:

@mist lix
Thank you for your input.
I'm not sure if I understand correctly, but here we go.

I actually haggle over price changes.
Except for the spread, swap, and commission, I would make no profit or loss if the price never changed.

The point at which I open the three pairs is known as the ZERO point.
Around this price, the price normally oscillates up and down (profit and loss).
BUT, every now and then (once a year or so), the ZERO point moves.
The ZERO point cannot move too far or the entire financial world system will collapse, but it can still affect you with leverage.
But there is one more snag in this case.
If I open a position and it remains open for more than 3 days, I will look for the lowest point in the last floating 3 days and, if it is hit again, I will open another position in the same direction to counter the ZERO point move.
This way, the price only needs to move half way back to profit and close the entire position.

This will be visible in the cart I added above on the bottom DEPOSIT LOAD.
There are spikes where my position has more than doubled.
I never go more than two full positions in, and if it does not recover by then, I have a final stop loss of 25%, which has been hit twice in two years, which is more than acceptable given the rate of growth.

My tests include SWAP, so it already supports swap.
The majority of my trades happen too quickly in one day to incur any swap.

If you use the initial price in your lot size calculation, such as "26.03" "26.03" and "37.01," then you should change the lot size as well, by partially closing or adding when the price changes. Is that correct?

PS: Are weekly double triple swaps taken into consideration?

Share this post


Link to post
Share on other sites

btw, I'm not trying to offend you; I tried triangular arbitrage years ago and can offer you some advice: use dll and use three platforms. When the same instance opens three trades at the same time, it queues them; if you use three platforms connected to the same broker server, three trades will be opened at the same time [milliseconds].

Hire a vps from the Mean Broker data center to get a latency of less than 2 milliseconds.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

FinanceHeaven

Info

Any opinions or market advice expressed in the community sections do not necessarily reflect the views of FinanceHeaven or its affiliates. The comments and opinions expressed are those of traders who are either inexperienced or inexperienced. FinanceHeaven.net or its affiliates do not review or research the comments. If you choose to base your decisions or trades on the comments, you do so at your own risk. FinanceHeaven and its affiliates are not liable for any losses incurred as a result of using the content provided.

WARNING

FOREX trading carries a high level of risk and may not be suitable for all investors. Leverage increases risk and loss exposure. Before you decide to trade foreign exchange, think about your investment goals, level of experience, and risk tolerance. Your initial investment may be lost in part or entirely. Do not put money into investments that you cannot afford to lose. Educate yourself on the risks of foreign exchange trading, and if you have any questions, seek advice from an independent financial or tax advisor. Any data and information is provided "as is" for informational purposes only and is not intended for trading or advice. Past performance is not a predictor of future outcomes.

×
×
  • Create New...