Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post Reply
Jonah
Trader
Posts: 46
Joined: Sat May 11, 2013 4:13 pm
Location: Las Vegas

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by Jonah »

cozybooks » Fri Apr 12, 2019 11:12 am wrote:Hey Lonnie,

Hope all is well with you. I did some additional testing today. All testing done with live Oanda accounts using 1.2.8 Ditto.

Ditto set to 12%.
GBPNZD - Had two buy trades already open for 121 and 124 units.
added one new buy trade. Opened at 120 units, which was correct.
added one more new buy trade. Opened at 121 units, which was incorrect since I already had an open buy trade with 121 units.

Changed Ditto to 6%. Opened up brand new trades on AUDCAD. I chose this pair because I had no existing trades open on AUDCAD at all.
1st sell trade - Opened at 60 units.
2nd sell trade - opened at 61 units.
3rd sell trade - opened at 62 units. All good - three trades in a row correct.
Closed 2nd trade. I now had open sell trades of 60 and 62 units.
4th sell trade - opened at 61 units - correct because this was the open slot.
5th sell trade - also opened at 61 units. incorrect because Ditto had just opened a trade at 61 units.

Not quite sure what to make of all that, but hopefully it will point you in one direction vs. another. Not sure that it makes a difference, but I was entering the trades manually and checking the unit size as I added each trade, so the 4th and 5th trades were entered 5-10 seconds apart.

Best to you and the jobs! :smile:

Steve
Thanks for the update. This is likely because the orders are being placed too quickly. When I have the time, I need to set up a delay between Ditto and DittoLink to prevent this from happening. I will test more next week when the market reopens.
-- Lonnie.

"Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime." (Muhammad Waseem)
Jonah
Trader
Posts: 46
Joined: Sat May 11, 2013 4:13 pm
Location: Las Vegas

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by Jonah »

Foreverforex » Fri Apr 12, 2019 11:24 am wrote:A little more performance intel from this week... was a slow week overall.

manual trades raised incrementally, but this morning, while EA had generated a first AUD/JPY position earlier in the week, a pending was sent for a second AUD/JPY trade. The first trade was 250 units (25% of .01 lots on Empty4), but the second pending order was sent as 500 units, instead of 251.

Other than this, Ditto seems to be dutifully copying everything else like a wizard.

Thanks!
Thank you for the update! I will see if I can replicate this behavior when the market reopens.
-- Lonnie.

"Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime." (Muhammad Waseem)
User avatar
cozybooks
Trader
Posts: 299
Joined: Wed Mar 27, 2013 1:33 am

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by cozybooks »

Hi Lonnie,

I will test this further with more time between manual trades and get back to you. on AUDUSD, I trade six different EA's on the pair with different strategies and timeframes, but of course, there are times that two of the EA's will issue a sell or buy trade at the same time.

With Ditto allowing me to use tiny lot sizes, eventually I'm hoping to run a total of twelve EA's running different strategies/timeframes on just three or four pairs. Half the EA's are trend based, and half are reversal based. It takes longer to generate profit, because when the trend strategy is doing well, the reversal strategy usually isn't and vice-versa, but the idea is that short term it reduces risk and long term it will still bring in the profits.

If necessary, however, if dictated by the Ditto and Ditto Link connection, I can do this using different sub-accounts on Oanda to avoid the timing issues.

Best to you!

Steve
Jonah
Trader
Posts: 46
Joined: Sat May 11, 2013 4:13 pm
Location: Las Vegas

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by Jonah »

cozybooks » Sat Apr 13, 2019 2:46 am wrote:...If necessary, however, if dictated by the Ditto and Ditto Link connection, I can do this using different sub-accounts on Oanda to avoid the timing issues...
Trade speed is only an issue with the lot calculations of an individual account. To better understand why, here are the steps that take place when a trade is made:
  1. Ditto recognizes that there is an Empty4 trade open without a corresponding Oanda trade.
  2. Ditto gets a list of active Oanda trades for the same pair from DittoLink
  3. Ditto uses the list of active trades to determine the next lot size
  4. Ditto sends a message to DittoLink to open a trade with the given lot size
  5. DittoLink opens the trade with Oanda
  6. DittoLink sends a message to Ditto that the new trade was opened
  7. DittoLink updates the list of active trades for the pair
All communication between Ditto and DittoLink is file based in order to prevent any future Empty4 updates breaking the connection. Because of this, communication is not instant. So, if a second trade for the same pair (in the same account) hits step 2 before the first trade hits step 7, the lot calculation will be off. I have methods in place within both Ditto and DittoLink to prevent this from occurring, but I see now that I need to add another restriction in DittoLink to fully remove any trade requests made by Ditto until step 7 is reached.
-- Lonnie.

"Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime." (Muhammad Waseem)
User avatar
cozybooks
Trader
Posts: 299
Joined: Wed Mar 27, 2013 1:33 am

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by cozybooks »

Hi Lonnie,

Thanks for the very detailed explanation, which of course all makes sense when you see it laid out like that.

I will keep you apprised if I see anything outside this scope. If you do have time at some point to put something further into Ditto in this regard, let us know and I'll be happy to give it a test run.

Thanks!
Steve
Jonah
Trader
Posts: 46
Joined: Sat May 11, 2013 4:13 pm
Location: Las Vegas

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by Jonah »

I have uploaded a new version that implements a 5 second delay between trades in order to minimize the occurrence of incorrect lot size calculations until I can get to implementing a more permanent fix within DittoLink.
-- Lonnie.

"Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime." (Muhammad Waseem)
BigRunner
Trader
Posts: 10
Joined: Sat Dec 15, 2012 3:41 am

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by BigRunner »

I'm catching up on this thread. I hope my responses are not too out of place 3 weeks later.
Foreverforex » April 5th, 2019, 11:51 am wrote:...

cozybooks & BigRunner - have you given it a spin yet?
Not yet. I shut down my grid trading on OANDA before going out of town several weeks ago, but I have not fired them back up yet using the latest version.

Thomas asked, "Does this problem mainly occur on VPS's?"

No, not in my experience. All of my problems occurred while using my personal computer for my OANDA account that uses Ditto. I have two VPS accounts, but I use my personal computer since it is closer to the OANDA server than my VPS servers.
richard96816
Posts: 8
Joined: Fri Apr 27, 2018 9:23 am

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by richard96816 »

Has anyone tried using Ditto with the Wine Windows emulator?

Edit: Any thoughts to releasing source so others can contribute and expand on the original?
richard96816
Posts: 8
Joined: Fri Apr 27, 2018 9:23 am

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by richard96816 »

Jonah » Sat Apr 13, 2019 4:24 am wrote:
cozybooks » Sat Apr 13, 2019 2:46 am wrote:...If necessary, however, if dictated by the Ditto and Ditto Link connection, I can do this using different sub-accounts on Oanda to avoid the timing issues...
Trade speed is only an issue with the lot calculations of an individual account. To better understand why, here are the steps that take place when a trade is made:
  1. Ditto recognizes that there is an Empty4 trade open without a corresponding Oanda trade.
  2. Ditto gets a list of active Oanda trades for the same pair from DittoLink
  3. Ditto uses the list of active trades to determine the next lot size
  4. Ditto sends a message to DittoLink to open a trade with the given lot size
  5. DittoLink opens the trade with Oanda
  6. DittoLink sends a message to Ditto that the new trade was opened
  7. DittoLink updates the list of active trades for the pair
All communication between Ditto and DittoLink is file based in order to prevent any future Empty4 updates breaking the connection. Because of this, communication is not instant. So, if a second trade for the same pair (in the same account) hits step 2 before the first trade hits step 7, the lot calculation will be off. I have methods in place within both Ditto and DittoLink to prevent this from occurring, but I see now that I need to add another restriction in DittoLink to fully remove any trade requests made by Ditto until step 7 is reached.
I would think you could do away with various delays, etc., just by assuming that all trades are being placed by DittoLink. Then you don't have to rely on querying Oanda for current trades, simply have DittoLink maintain its own history of trades and work from there.

Also (or alternatively), if you don't reuse trade sizes as frequently you'll have less chance of a duplicate. When a trade closes don't re-use its size right away. Then long delays become unnecessary.

Thanks!
Jonah
Trader
Posts: 46
Joined: Sat May 11, 2013 4:13 pm
Location: Las Vegas

Ditto - Empty4 to Oanda Trade Copier - As Low as 0.00001

Post by Jonah »

New versions of Ditto and DittoLink have been uploaded. Incremental lot size calculation has been removed from Ditto altogether. DittoLink now handles this calculation on every order by querying the open Oanda trades prior to every new trade. In addition, the extra delay between trades has been changed from 5 seconds to 1 second and the expiration has been updated.
-- Lonnie.

"Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime." (Muhammad Waseem)
Post Reply

Return to “Automated trading systems”