Sari la conținut

TheEconomist

Traders
  • Număr mesaje

    204
  • Înregistrat

  • Ultima Vizită

  • Zile Câștigate

    1

Orice postat de TheEconomist

  1. Allright, thats what I asked. e.g. Crownforex in Switzerland are not allowing to enter lot but full lotsize. When attaching your EA to it, it does nothing, because of this difference. Could you please explain why you are excluding FXDD, InterbankFX and FXLQ? Greetings, Andi. The correction I suggested would make it work under Crown ; Crown does not want full lots; it requires minilots , such as 0.1, 0.2...; no microlots, neither microlot adjustments (no 0.09 nor 0.11 are permitted). The function UnitsToLots handles the transformations of the volumes to the lotsizes agreed by broker. (However, be very careful about this, as microlots are important, as I demonstrated in my Intercross Arbitrage article). Now I'm asking: why do you need Crown for ? Crown has swap free regime. FXLQ is different from FXDD and InterbankFX. The swap type 3 that I saw with FXDD and InterbankFX is very unstable. For example, if you run the script 20 minutes later you have another best ring. FXLQ on the other hand may change overnight even the swap types. I was waiting to trap swap type 1 on a trade in order to get the interest calculation formula for embedding in BcLib ; however, the next day, there were no pairs with swap type 1 and this thing was the most ockward to see: broker changing not only the swaps, but the swap types. If you want to use the script , cancel the line correction I told earlier ( "volumes=units" ) as the original version is better.
  2. Hi Andi, I don't understand exactly what you mean: If you're thinking about how much of the available funds is used, modify the MarginUsed parameter. However, now it's at 90% of available leverage, further increase might make impossible closing the ring. If you want to use Volumes, instead of lots, check this: volumes=UnitsToLots(units,contracts)*MarketInfo(contracts,MODE_LOTSIZE); Where they are, the volumes are already calculated. The purpose of these lines is to round volumes to nearby lot size: for example 11900 in volume is rounded to 0.1 lots of 100000 Lotsize and final volume resulted is 10000. Just replace them with volumes=units; the result of the volumes[] would be intact, exactly how it gets out of the calculation (I didn't check out the SwapButterfly, this is the way it might do it - volumes are rounded after) Anyway, all MetaTrader brokers are using lots. Different implementations of lotsizes, but lots, not volumes, on any of them. The script will not be working on brokers that are non MT-compatible, but the algorithm remains usable. As a correction to the script, where I see it now needed to be done, would be on the OrderSend() line: this is now : OrderSend(Contracts,Ops,NormalizeDouble(Volumes/1000*0.01,2),price,Slippage,0,0,"RING "+DoubleToStr(Magic,0),Magic,0,Blue); needs to be: OrderSend(Contracts,Ops,UnitsToLots(Volumes,Contracts),price,Slippage,0,0,"RING "+DoubleToStr(Magic,0),Magic,0,Blue);
  3. Salut, O sa incerc sa-ti raspund eu. Nu mai sunt obisnuit demult cu lucrul manual, iar cont cu Gain Capital (forex.com) si FXCM nu mi-as deschide nici daca ar fi ultimii brokeri de pe pamant. Prima fereastra e cea de piata cu contractul selectat (USD/JPY). Perechea de cotatii se traduce ca 115.791 si 115.821. Primul pret este BID, cel la care poti sa vinzi USD/JPY iar celalalt ASK, la care poti sa cumperi. 1 e scris mai mic, pentru ca e o fractiune de pip (punct). Pipul este unitatea minima de incrementare a pretului. Este egal cu o unitate pe ultima zecimala. De exemplu EUR/USD are 4 zecimale, iar intre 1.3310 si 1.3311 e o diferenta de un pip. USD/JPY are doua zecimale, iar 1 acolo apare pe a treia pozitie (unde sunt deja zecimile de pip). La lots puteai sa modifici volumul tranzactiei (era trecut 1 lot), ca valoare 100000 USD. La acest volum, orice fluctuatie de 1 pip (o unitate pe zecimala a doua) aduce un profit/pierdere de cam 8$. Exemplu de calcul pentru 1 lot: cumperi la 115.821 si vinzi la 115.837 (castig de 1.6 pipsi) . Se considera asa: cumparat 100.000 USD x 115.821 = 11582100 JPY vandut 100.000 USD x 115.837 = 11583700 JPY profit = 1600 JPY. Ca sa aflam cati dolari face, impartim la USD/JPY = 13.81 USD (adica, daca impartim la 1.6 pipsi = 8.63 $/pip, cam cat am zis initial). Calculul este facut permanent si reflectat in Margin Balance . Se pare ca modificarile din Margin Balance se reflecta in Account Balance in anumite momente (probabil cand toate tranzactiile sunt inchise) Dupa cum vad situatia de la Deal Blotter, el arata numai tranzactiile deschise, pentru ca niciunul din numerele de tichet (alea de pe coloana Confirmation) nu se regaseste de doua ori. Daca o tranzactie ar fi inchisa, atunci, depinde de cum l-au facut ei, ori apare de doua ori, ori nu mai apare de loc. Margin Balance este soldul contului. In alte statii, si aici pe forum, el este referit ca si "capital" sau "equity". Account Balance este o "versiune" mai veche a soldului, care nu contine toate modificarile operate. Fie Realised Gain/Loss semnifica profit/pierdere pe tranzactii inchise iar Unrealised pe tranzactii deschise, fie Realised Gain/Loss semnifica profit/pierdere pe tranzactii compensate iar celalat pe tranzactii necompensate. Daca te uiti mai atent la Open Position ai 200.000 USD (partea necompensata), caci daca aduni toate cele 5 tranzactii (la Amount) iti da 200.000 . Putem sa spunem ca ai tranzactionat in total 600.000 USD, dar 400.000 s-au compensat, si ai ramas Long (adica cu net cumparat) de 200.000 USD. Asa cum am spus, Margin Balance e soldul real al contului (numit "marja"). Imagineaza-ti ca e o garantie. Dupa ce depui banii si deschizi contul acolo apare valoarea depusa. Total Available Position arata cat poti avea in pozitii deschise. Raportul dintre el si Margin Balance este levierul maxim admis de broker (in acest caz 100, adica poti avea tranzactii deschise de 100 de ori mai mari decat marja)
  4. It would have been cool to be daily swap... I found this on ATC Brokers... There are also others where it works. InterbankFX, FXDD, FXLQ are excluded. By the way it looks now, needs 15 days.
  5. No, you're wrong. Monday to Tuesday is a normal night... 1.59 is the daily swap, calculated as SWAP TODAY - SWAP YESTERDAY. The digits in the 'swap' column does not indicate this is gonna come every day, but it's the accumulated swap. That is the "spread absorbtion" per calendar day, not 8 USD per calendar day. How did you get that 8 USD / day anyway ? And what's that 23 USD x 2 = 46 USD supposed to mean ? I remember spread costs were about 30 USD...
  6. Well, just to have an idea about how many calendaristic days (not working days) remain to the full absorbtion of the spread...
  7. The idea is to get out as far as possible, and when the rings change, to try keep as much of the ring intact as possible in order to minimize spread costs (of the closed trades , which become effective, and of the new opened ones, which become virtual). Now it makes 1.6 a day...if it would have been 2 , would have been better.
  8. TheEconomist

    Exista asa ceva ?

    MQL4 este propriul lui limbaj, iar MetaEditor e propriul lui IDE. Exista si API, dar nu si pentru noi. Numai brokerii primesc MT4 API si e treaba lor daca il dau clientilor sau nu. Iar pentru tradelover...nu ai scris gresit, scoate si swapul. Nu pot sa-ti raspund exact in legatura cu stopul . Din cate stiu eu, stopul nu e automat trailing. Tu il modifici cu OrderModify(), deci tu sa-l pui sa scrie in log cand a modificat. Care loguri sunt pe calculatorul de la servici....E mai complicat, nici eu nu stiu sa fac. Daca ai IP extern la servici poti sa folosesti un client VNC si sa intri de acasa pe calculatorul de la servici. Daca ai IP de LAN la servici, ma depaseste. Poate doar sa-l pui sa-ti trimita mail cu SendMail() in cazul asta. O alta solutie, mai hardcore, dar nici pe asta n-o stiu, ar fi sa-l organizezi pe ala ca pe un server si sa intri de acasa cu http://...ip...\experts\logs....log sau cu ftp:// P.S. Pentru care ma mai intreaba ceva si eu nu raspund, sa-mi dea PM. De cand lucrez la afurisitul asta de blog parca nu mai am liniste...
  9. This is a picture of the ring taken August 27, 23:50 Romania time: http://img260.imageshack.us/img260/3476/ringpicturetakenaug2723wf5.jpg And this picture is taken 10 minutes later, August 28, 00:00 Romania time: http://img265.imageshack.us/img265/4416/ringpicturetakenaug2800ju7.jpg Now we calculate what Juan wanted earlier: the daily swap: Swaps late Monday : 3.52 + 6.10 - 1.78 = 7.84 Swaps early Tuesday : 4.23 + 7.34 - 2.14 = 9.43 Daily swap : 9.43 - 7.84 = 1.59 meaning about 0.318% of the original $500 account equity
  10. 1. Not 6.25 a day (I couldn't see exactly if it took the Wednesday night, when the swaps are calculated for 3 days). 2. ATC Brokers (Velocity) is one of the most stable. 3. The pairs are hedged in big moments. However, if one the broker datafeed is damaged, you won't be hedged any longer. I have seen it going in the profit/loss territory about 30% of account equity. After the big moves the hedge was reestablished like nothing happened, although the rates were significantly altered. And by big moves I don't mean Friday moves, but fundamental shifts that criple broker's datafeed. Because, when the hedge pushes result at +/- 30% equity, one of the pairs is damaged. Otherwise, it would that the market would stay in triangular arbitrage opportunity for hours, which is impossible, triangular arbitrage opportunity lasts up to 10 seconds, so you are unhedged because of the broker, not because of the market. My answer is "no", you don't have to alter the trades after fundamental shifts.
  11. TheEconomist

    Exista asa ceva ?

    Poate extrage evolutia stopului si a targetului, pentru ca sunt programatice si poate fi trecut in log cand sunt mutate...
  12. The explosion of brokerage firms on the Internet leads to an ever increasing competition among them ; one of the ways to have a better offer than the competitors is offering more markets to the trader , broadening his trading horizons from the narrowness of random forex; and since we're talking about MetaTrader, the most easy to automate and yet free platform of this kind, this is done by non-NFA regulated brokers, since NFA forbids the implementation of other contracts as CFDs (futures , stocks and bonds can't be implemented on MetaTrader the way they are). Ultimately, this is what traders wanted from the beginning: a single automated platform usable for trading many markets , in order to deploy logical and profitable strategies, not only indicator-hunting strategies... Perhaps NFA has its reasons for banning CFDs, however, if technical solutions are not found to this problem, US brokers will be effectively wiped out by the competition abroad on the retail segment where MetaTrader is the backbone of traders strategies. There must be a way to solve the fractional trading of futures. Thirty years ago when forex was Zurich centered and trades made by phone minilots and microlots were considered science fiction and these are a reality today. Futures must follow the same path and become sizable for very small accounts... Traders consider NFA no longer to be a "trademark". Exactly how "wireless broadband" grew more important than "Intel inside", the same way "futures inside" has become more important than "NFA-regulated". Think about how much cash the forex retail traders lost just because they couldn't access the contracts they really wanted and were forced to trade markets they didn't understood well... If NFA considers as its duty to protect the traders from fraudulent brokers it should have banned retail forex too : misleading advertising to cover up a casino-like trading environment (no arbitrageable assets). Among the "new" assets introduced by non-NFA regulated brokers (that's the irony of the fate, we must use russian or Middle East brokers to trade american assets) there are the currency futures (I will speak about them in another article), but also commodities. Similar commodities are traded on different markets, so arbitrage opportunities appear. Real and frequent, and not so easy to be manipulated by the broker (as FPI / Intercross Arbitrage with forex , where arbitrage opportunities are so easy to remove as slapping the fingers). Many brokers offer, of course, many have seen this already, Gold and Silver. However, since there are not at least two gold contracts and two silver contracts it's easy to understand these are not arbitrageable. The single broker supporting the commodities below: WHC forex (the most extensive datafeed) . Since it's not too regulated, you'd better wait for others to follow them! A brief look at the commodities contracts possibly to be used for arbitrage: Oil contracts: WTI = West Texas Intermediate (InterContinentalExchange) ; download contract specification: WTI Contract Specifications on ICE CL = Crude Light oil (New York Mercantile EXchange) CL Contract Specifications on NYMEX BRN = BReNt oil (InterContinentalExchange) ; download contract specification: BRN Contract Specifications on ICE (ICE acquired IPE - International Petroleum Exchange) QM = miNY Light Sweet Crude Oil (New York Mercantile EXchange) QM Contract Specifications on NYMEX Natural gas contracts: NG = Henry Hub Natural Gas Futures (New York Mercantile Exchange) NG Contract Specifications on NYMEX QG = Natural Gas (New York Mercantile Exchange) QG Contract Specifications on NYMEX Gold contracts: ZG = 100 oz Gold Futures (Chicago Board of Trade) ZG Contract Specifications on CBOT GC = Gold Futures (COMEX) GC Contract Specifications on COMEX (division of NYMEX) Silver contracts: ZI = Silver 5000 oz (Chicago Board of Trade) ZI Contract Specifications on CBOT SI = Silver Futures (COMEX) SI Contract Specifications on COMEX (division of NYMEX) Wheat contracts: KW = Kansas Wheat (Kansas City Board of Trade , open outcry) KE = Kansas Wheat (Kansas City Board of Trade , electronic) KW Contract Specification on KBOT Cocoa: C = Cocoa (Euronext) C Contract Specifications on Euronext CC = Cocoa (New York Board Of Trade) CC Contract Specifications on NYBOT I did not make an extensive analysis of this arbitrage, but I looked upon a few assets and strategies: 1. Cocoa ======= Most time I'd tried to trade them I got "Trade is disabled". They move in a similar way, however, their values are way different. A statistical arbitrage strategy may be deployed, however, a version of Intercross could be applied, since CC is quoted in USD while C is quoted in GBP. 2. Wheat ======= http://img441.imageshack.us/img441/8058/keandkwik6.jpg The two versions of the Kansas Wheat are very closely correlated, moving almost parallel. However, commissions drain out the arbitrage possibilities. 3. Oil ==== The variety of oil contracts make possible a large variety of arbitrage strategies. 3.a. CL to QM =========== Almost impossible to work out. It's necessary to trade a volume of QM 20 times more than CL to equal pip value. At this ratio, commissions are so high, that breakthru is somewhere at 70-80 CL pips (cents/barrel) difference... 3.b. BRN to CL =========== Brent and Crude Light have different fundamentals behind. On a range of 500 daily bars, BRN / CL fluctuates +/- 500 pips. Statistical arbitrage may be deployed. However, a normal arbitrage strategy aiming to pyramidize positions at each 100 pips difference may, or not, work. It may work if both BRN and CL are implemented as continuous futures, the trader having unlimited time to wait for them to come together (this point is where they are not equal, but BRN quoted 100 pips above CL). Otherwise, arbitrage is impossible. Futures have too close expiries compared to the BRN - CL divergence - convergence cycle. An expiry in loss damages account equity and reduces available funds. Even worse, the positions can't be reconstructed from the place they were before expiry because prices are jumpy (new expiry, new interest to expiry embedded). Difference in USD trading Short BRN , Long CL one lot each (for pips, divide by 10) courtesy Matt Trigwell (comprises ~500 daily bars) http://img178.imageshack.us/img178/2497/oilspreadtradebr7.jpg 3.c. BRN to WTI ============ It's almost the same as BRN to CL, as WTI floats very close to CL. Which is very useful in the next arbitrage strategy, 3.d. CL to WTI =========== This is the most interesting arbitrage strategy with oil. It is quite fast, the strategy could trade one time a day. Usually WTI and CL are on a close range, however arbitrage opportunities appear pretty often. Both trade with 10 pip spread and 1 pip commission. If you would consider mid prices (between bid and ask), trade them when the difference is about 15 pips between mid prices and close when it's reversed. Results are pretty amazing, however execution errors may criple it a little. http://img212.imageshack.us/img212/8590/wtitoclarbitrageaq9.jpg Probably the Gold and Silver contracts hide also other "golden" arbitrage opportunities. My source proposed for this article is WTI2CLsimpleArbitrageScript (see attachment). Please run it a while and report here problems encountered (the initial version was pyramiding trades, but I removed this because I considered it not necessary).
  13. Have you ever considered that a large amount of brokers work as online casinos trading against their clients and getting not only the spreads, but also their money? What makes them "play the house" in this game? Newbie traders greed and confidence? They know that the traders that make money are only the 10%, why not taking the money of the rest... Let's think for a moment: what kind of money management do you need to have in order to see the broker as a player, while you have the house? How to make the a large number of losses not affect you and boost up equity during small gain series? Let's consider the market as a binary stream of situations that are equal (as a huge stream of 0 and 1 digits). Let the 0's be the loss situations and 1's the win situations. How not to lose to much cash? Don't play too much on each situation. Suppose you divide your capital in 256 parts, and play each part to be won or lost. That means that after a huge number of say 20 consecutive losses, you lost 20 units from 256. The broker, on the other side, what did it win? Small gains "pip wise". Now pretty many times the randomness of market will put you in win situations. A played unit that is won remains and generates a unit of profit. So now on the next trade you have available 2 units from the previous trade + 1 unit (the one allocated for the trade). If the next trade is won, it will double the played units, which will be 6. You already have 6 units and play for the next one. That means 7 units available. You win this one, thus making 14 units. If you win the next one, it will be (14+1)*2 = 30 units. After a series of 4 wins you already recovered the 20 units and made 10 as profit. Did the broker lost 30 units in just 4 trades ? Yes. Did it play stupidly trading against you ? Yes. Was it "pound foolish" ? Yes again. Of course if you lose the last trade, you lose 4 units of the original 256 making the equity. Another version of this would be not adding an unit every won trade. Once the first wins another unit, play these 2 units and so on. On the loss moment, only the original unit is lost from equity. It is up to you to decide how many consecutive wons will be doubled. After N predefined wons, you may consider breaking up the series and redefining the unit size, then start from the beginning. However, wons will be from a lot smaller to slightly smaller that losses. Because of the spread. From 10 pips, 3 pips spread is 30%, but from 50 pips, 3 pips spread is just 6%, so you could consider a binary "fair" distribution of 53% losses to 47% wins, more similar to roulette distribution (remember they have the 0 and 00 numbers that reduce the win ratio). Isn't this a form of statistically arbitraging the win chances by taking advantage in small series of wins and losing a little during larger series of consecutive losses?
  14. Oh...forgot to put the table head http://img46.imageshack.us/img46/3060/swapringfk3.jpg and click where it says "Click to view full image"...you'll get the point then.
  15. Hi, This is a currency ring placed on august 22: http://img490.imageshack.us/img490/728/swapringrq6.jpg The picture was taken august 24, about 15:30 server time. I can't tell for sure if it took the big swaps Wednesday night (on Romania time swaps are wired exactly on midnight) Now, as you can see, the swaps are net positive : 2.81 + 4.86 - 1.42 = 6.25 The result is contains mainly the spread cost, the pairs being hedged : 35.36 + 318.27 - 383.38 = -29.75 However, there is displayed -23.50 , which shows that 6.25 acquired from swaps are embedded in the result. The days pass, the cost fluctuates a little around a fixed value, but the swaps accumulate, absorb the costs and make profit.
  16. Hi there, Well, there is no download link on their website. They are on the "God" level, and have access to real market quotes from several providers. Their platforms are never available for download. You gotta have a lot of cash available, it works by mail contact, its not as easy as a "download our trading platform and trade in minutes". As for the FPI, I didn't test it directly. I made an EA at that time (FPITrader), I think it is still available for download on the forum (and I recommend that you look upon it, it was a hard piece of code at that time). It has several bugs, and I was able to correct them with the indications that I've got on forum. However, in one of the days that I was calculating swaps I realised the FPITrader had a systhemic error. It was not hedged. Michal told us about the Buy-Sell-Sell and Sell-Buy-Buy rings. Given his examples of FPI calculation, I made a math checker of the FPI formulas, which is embedded in FPITrader. I set the criteria for each currency to be, one time at the numerator and one time at denominator. Once this condition was accomplished their product was to give me the FPI. However, it didn't check the hedge criteria, so that EVERY CURRENCY TO BE EQUALLY BOUGHT AND EQUALLY SOLD. When I realised this, I sent FPI to the trashcan (only its math side) and then I came up with the Intercross idea. Even the Potential, Required and Costs have been added more than a month later after I implemented it in MetaTrader and Coder from the forum took some parts from my data (already made crosslists) and made implementations of it on EFX and later on InteractiveBrokers. He was actually hoping for a "currency aggregation" on these brokers in order to do real triangular-style arbitrage with it... He still says that EFX has too great slippage, but I've seen problems on MetaTrader brokers too... Now, to answer your other questions: i) precise FPI calculation method: for every possible ring, there is a different FPI calculation method (this without me mentioning that every ring has two FPIs, like my virtual bids and asks) ii, iii) Michal always teached us to trade FPI swings. However, this was supposed to make profit in almost lab conditions : "impeccable hedge" and no slippage , which are very far from real market conditions or even worse, MT4 brokers conditions... So profit was a result of the FPI swing, and just it: no other calculations of costs and possible results (I think the real result of Intercross is the difference of potential on close and its realtime costs at that time; the virtual bid - virtual ask difference is more a pale reflection of what should be the final result; it should show you that X difference on virtuals means Y potential and closing at a similar Y potential will get you a profit of Y - Costs). Intercross Arbitrage is not necesarilly more interesting than FPI. It's another view on the same strategy, the difference is the one from a flashlight to a projector: at least it helps not trading blind FPI swings. I didn't have the cash to trade and frankly I don't like it too much; there are other arbitrage strategies, and I will post the Swap Arbitrage in a few days; If I'd have cash I'd trade either Oil arbitrage or Cash-to-futures arbitrage in conditions of swap free account; Now about microlots: If you're poor, it's vital to use microlots; if you're loaded with cash, it would be no difference. Michal himself pointed on several pages to use Neoticker or EFX, in order to avoid MetaTrader's lots. It's obvious why, and I demonstrated it by my calculus. One thing is to be unhedged with a few hundred units per contract, that move less than 10 cents/pip each of them (possibly around 20 cents/pip total movement), and another thing is to be unhedged several thousand units per contract, that move a lot more probably $2/pip total movement. Let's consider an overall 100 pip disbalance from open to close: the microlots solution would drain by $20, while the minilots solution would drain by $200. And both versions are possible if you have $500 equity. So, which broker would you choose? (However, I have a friend that ran it on Crown Forex demo some time, and it showed profits when the feed was working well). I don't recommend any broker for FPI, although...let's say EFX/MB Trading or InteractiveBrokers. No MT4 broker.Another good solution to recommend, that would be Strategy Runner based on Currenex datafeed. I have a broker friend that swear he saw direct arbs (bids>asks) on fridays. In the days to come I will post the next strategy, the Swap Arbitrage (I am working on the article). The others, at their time. P.S. Now correcting the graph of the Intercross, seems I swapped the blue virtuals on screen.
  17. First of all, for who doesn't know what swaps are, they are implementation of differential interest rates. We aren't going to present here the implementation of swaps starting from the differentials, but the purpose of the article is to show how the swaps may be used to make money with a small amount of risk. Swap Arbitrage, as a hedging for interest technique, is another application of Kreslik currency rings: this time there is no need for FPI calculation or generation of virtuals. All it matters is that the currency ring to be correctly placed, and to generate interest by its simple existence. I called it "Swap Arbitrage", because, if we cut out the forex impact, which is usually fixed due to hedging, it's like buying lower and selling higher swaps. The tinier the results, the more risky Swap Arbitrage is, because the swaps need longer time to recover spread loss, time in which fundamental events may alter the interest rates. 1. Generating all the possible versions of available Kreslik rings on a broker ====================================================== In my previous article about the Intercross Arbitrage I covered some BcLib functions helpful in reading MetaTrader content. The first function that needs to be called is GetSymbolsAppendix() to retrieve the symbols appendix, then the GetCurrenciesAndPairs() to get available currencies and pairs. The think pattern of this strategy is the one from Triangular or N-angular Arbitrage. We suppose that we have funds denominated in a currency, that we sell for the next proposed one, and so on, until the ring is completed. This would be hard to implement if we'd use directly the pairs. So we start using the currency list available in UsedCurrencies[] . Suppose we have n currencies (in fact, CurrenciesNo). Every one of them may be , or be not, in a currency ring. Thus we have 2^n combinations. Of course the 2^n include invalid rings, such as 0 , which includes no currency, and others with one or two currencies inside. These are sent to scrapyard and we focus on almost valid currency rings with at least three currencies. I said almost because at the time of their generation we don't know that the pairs to link up the currencies exist for real. Generation is simple, by using a simple cycle from 0 to (2^n)-1 and converting the number to binary, then completing the result with leading zeros. Say for example UsedCurrencies[] has EUR, USD, GBP, JPY and CHF (only these five). Then for example 13 would be translated to binary as 1101, completed with leading zeros to 01101 (to be five digits length), and then we can read the what the 1s mean: USD, GBP and CHF. Once that we have this combination, we could then permutate it to generate the same ring from all possible directions. Then we test each resulted ring for validity (if all pairs exist (of course, if the ring has three currencies, a test on original combination is enough, if it has more, there must be a test on each permuted combination). Once valid, we calculate the overall swap, and, if posible, we keep its combination and permutation numbers on hand (I couldn't generate arrangements, nor combinations directly ; arrangements are nothing more than permuted combinations). After studying all possible combinations or only some of them (say only 3-currency rings) we may have already a best ring, which is the maximum that can be got in given conditions. If there is no best ring, swap arbitrage is impossible. Powerful BcLib functions to achieve this: string ConvertTo(int base,int number) The function converts the number in given base. It's reverse function is int ReconvertFrom(int base,string number) that converts back to base 10. string Padl(string s,int total,string fillwith) The function fills string <s> with <fillwith> strings (intended to be chars) to fill up the total length; similar functions: Padr and Padc. These functions originate from FoxPro. void GenPermutation(int n,int elem,int &perm[]) Generates the permutation <n> (0 - based) of <elem> elements inside array perm. Array will contain numbers from 1 to n. The opposite of this function is int FindPermutation(int elem,int perm[]) , which will return given's permutation index. bool ContractExists(string symbol) Returns true if given symbol exists in the datafeed. It's runtime based, doesn't look up the UsedPairs[] as it can be used for any symbol, not only forex pairs. bool ContractIsTraded(string symbol) This is an older function, written by me before I realised MarketInfo(...,MODE_TRADEALLOWED) is available. Now the function will ultimately return MODE_TRADEALLOWED inquiry, however this aspect is a bit controversial, although MODE_TRADEALLOWED inquiry may return False when trade context is busy, so when the contract is really traded. This is a code excerpt from the SwapFinder (one of the first implementations of this algorithm): for (icomb=maxim;icomb>=0;icomb--) { image=Padl(ConvertTo(2,icomb),CurrenciesNo,"0"); crrcies=Occurs("1",image); valid=false; if (crrcies>=3&&crrcies<=maxcrrcies) { maxperm=Factorial(crrcies)-1; combimg=""; for (iimg=0;iimg<CurrenciesNo;iimg++) { if (StringElement(image,iimg)=="1") combimg=StringConcatenate(combimg,UsableCurrencies[iimg]," "); } WriteLn(StringConcatenate("Studying ",combimg," having ",DoubleToStr(maxperm+1,0)," permutations")); for (iperm=0;iperm<=maxperm;iperm++) { ROA=-1; ROE=-1; valid=IsConfigValid(image,iperm,crrcies,Contracts,Ops); if (valid==True) { EstablishRing(crrcies,Contracts,Ops,Volumes,Usage,TotalUsed,Swaps,Interests,NormalROA,WeightedROA,ROA,ROE,FXResult,FinalROE,False); As you see, the code is not complete, as none of the for cycles is completed; See how <image> is made up by ConvertTo() and Padl() , number of currencies is counted in <crrcies>, then currencies are extracted in the <iimg> cycle (only to be displayed), then permutations are being generated inside the <iperm> cycle, upon validation by IsConfigValid() function, and finally ring is being constructed by the EstablishRing procedure. 2. The mysterious realm of the swaps ============================ The swaps implementation in MetaTrader was always a mystery: the OrderSwap() function works ex-post, it retrieves the total interest cashed/payed on a order. The only way of knowing before is by using MarketInfo's MODE_SWAPLONG and MODE_SWAPSHORT. However, what it gives is a mysterious "swap". Is it an interest rate ? NO. Is it an interest ? NO. Ok. Enough fooling around with "Let's twist again". Let's see what it really is. First of all, the result meaning is given by MODE_SWAPTYPE inquiry: MODE_SWAPTYPE inquiry answer : 0 Metaquotes documentation : in points; BcLib coverage: Yes; Meaning: In pips; Behaviour: the most stable ever seen; Broker examples: ATC Brokers, Finex, FXLQ ============================================== MODE_SWAPTYPE inquiry answer : 1 Metaquotes documentation : In the symbol base currency BcLib coverage: No* Meaning: In the first currency of the pair Behaviour: Unknown, but probably jumpy due to needed conversion in that currency Broker examples: FXLQ recently (yes they have them different) ============================================== MODE_SWAPTYPE inquiry answer : 2 Metaquotes documentation : by interest BcLib coverage: No Meaning: Unknown Behaviour: Unknown Broker examples: Never reported in wild ============================================== MODE_SWAPTYPE inquiry answer : 3 Metaquotes documentation : In the margin currency BcLib coverage: Yes Meaning: In pips of the account currency Behaviour: Very unstable Broker examples: InterbankFX, FXDD ============================================== The Swap2Interest_Volume from BcLib converts the swap to interest on a given volume (not lot). Useful when building swap strategies because you can find the actual swap before it would come. *Not in the last version of BcLib. Find and replace the Swap2Interest_Volume function with the next body for this swap type to be included: double Swap2Interest_Volume(double volume,int swapmode,string contract,string appendix) { double m_tick; double m_lotsize; double swap; double gc; double res; if (PairsNo==0) GetCurrenciesAndPairs(appendix); string contractf=StringConcatenate(contract,appendix); int swt=MarketInfo(contractf,MODE_SWAPTYPE); if (swt!=0&&swt!=1&&swt!=3) { if (BcLibAlerts==True) Alert("Swap2Interest***** : swap type "+DoubleToStr(swt,0)+" not implemented !"); return(0); } if (swapmode==MODE_SWAPLONG||swapmode==OP_BUY||swapmode==OP_BUYLIMIT||swapmode==OP_BUYSTOP) swap=MarketInfo(contractf,MODE_SWAPLONG); else swap=MarketInfo(contractf,MODE_SWAPSHORT); if (swt==0) { m_tick=MarketInfo(contractf,MODE_TICKVALUE); m_lotsize=MarketInfo(contractf,MODE_LOTSIZE); return(swap*m_tick*(volume/m_lotsize)); } if (swt==1) { m_lotsize=MarketInfo(contractf,MODE_LOTSIZE); gc=GetCurrency(StringSubstr(contractf,0,3),AccountCurrency(),appendix); res=swap*gc*(volume/m_lotsize); if (gc==0) { if (BcLibAlerts==True) Alert("Swap2Interest***** : could not convert swap type 1 for "+contractf+" as GetCurrency() failed! Check contract and appendix!"); } return(res); } if (swt==3) { m_lotsize=MarketInfo(contractf,MODE_LOTSIZE); return((volume*swap)/m_lotsize); } } You can easily see in the code how the swap types were implemented: Type 0: swap*m_tick*(volume/m_lotsize) Type 1: swap*gc*(volume/m_lotsize), where gc is the first currency of the pair converted to account currency Type 3: (volume*swap)/m_lotsize , similar to type 0 but without multiplicating with the tick value; Picture of the SwapFinder_script running on ATC Brokers: http://img222.imageshack.us/img222/2171/pictureofswapfinderscricm4.jpg SwapFinder parameters: extern int MarginUsage=90; extern int MaxCurrenciesUsed=3; extern bool JustTesting=False; extern int Slippage=3; extern bool ShowNegatives=False; MarginUsage - the percent of the margin (or the leverage) that's used for the trades altogether; MaxCurrenciesUsed - for 0, scans all the combinations (from 3 to n) currencies; for another value, scans combinations having from 3 to that value; JustTesting - is a safety measure; it will trade only when the script is allowed to trade from the properties and JustTesting is set to True; Slippage - trading slippage admitted; ShowNegatives - if true, will display financial data gathered on negative swap rings too. Again, be cautious about the MarginUsage. Don't set it too to near 100%, as your effective margin during initiation of trades might get under the required margin and you would run out of funds before completion of trades. Also, be careful that in dangerous situations broker's datafeed may be damaged (the problem I've been talking on the Intercross Arbitrage article) and you won't be fully hedged, your trades being placed in profit/loss territory until the issue being solved. How to read the SwapFinder window Usage - the volume , in account currency , of the trade. Under the usages there is their sum, interpreted as Total Assets % - the weight of the trade volume in total traded. The trades must be hedged, so the % value must be almost the same at them all equal to (1/no. of trades)*100 Op. - trade direction Volume - the volume of the trade, in units of the first currency of the pair Lots - the volume, in lots Contract - the pair symbol Swap - the exact swaps for one lot, as answered by MODE_SWAPLONG and MODE_SWAPSHORT inquiries Interest - the real interest earned/payed on the trade NormalROA - the ROA (Return on Assets) of the trade as (Interest/Usage * 100) * 365 (later edited) WeightedROA - the Normal ROA as weighted (by the percent occupied in Total Assets) ROA is the sum of Weighted ROAs. ROE (Return on Equity) calculated as ((ROA * Total Assets) / Account Equity) * 100 Forex result = costs of spreads Final ROE = ROE - Forex result 3. Butterfly : a nonlinear hedge ======================= Some time ago, as I was playing with pencil on paper drawing currency rings and trying to imagine a different kind of hedge that could make more swaps, I came up with the idea of a butterfly hedge ( because two currency rings with a common currency (common tip) look like the wings of a butterfly). However, two completed currency rings, with or without a common tip, are independant rings. They cannot produce more swaps, as one would be , say the best ring, and the other one, a lesser ring. However, this measure could add more safety to swap arbitrage, as it produces a slight diversification of the "investments" (the two currency rings). If we link up N currencies we obtain a simple , linear , currency ring, where EVERY CURRENCY IS EQUALLY BOUGHT AND SOLD. However, noone says it must be bought and sold once! http://img166.imageshack.us/img166/8964/butterflyfm1.jpg This was the first version of the butterfly hedge. The points are currencies. Among them O is mirrored (the two O represent the same currency). Features: - the Z currency is bought 3 times (OZ, YZ, XZ) and sold 3 times (ZO, ZP, ZQ). - the O currency is bought 3 times (PO, QO, ZO) and sold 3 times (OZ, OY, OX). A better version of this hedge would be one without the needless ZO and OZ relationships and still the hedge would be a butterfly, since the "wings" could not work seperately. Each model has a mirror. Just like any atom from Intercross Arbitrage could have played the role of bid or ask, similar any butterfly can be mirrorized simply by reversing the direction of the arrows. This model doesn't look like a butterfly at all but it respects the same principles. Looks like electronic circuitry huh? http://img514.imageshack.us/img514/2331/rectanglehedgeoe2.jpg (The double arrowed edges mean that volume , in account currency, is double than the one used on the other edges). Now I don't say the butterfly hedges are necesarilly better than the currency rings. It may be worse in many situations, but tt's a different way of thinking hedge. SwapButterfly's parameter list is similar to SwapFinder's. However, in the start(), you must assign UseModel to one of the preexistent models defined, or to a new one. *TIP ABOUT BROKERS: If you find a swap hole in the broker's datafeed (meaning for one pair the cashed swap is bigger than the payed swap, don't just go long and short simultaneously, as this will alert the broker to repair the datafeed. Better place it as a ring or a butterfly, sure this opportunity will be included in the best provided solution).
  18. After discussions with Stefan we decided to open this thread for Intercross Arbitrage discussion. The strategy can be viewed here: Evolution and principles of the Intercross Arbitrage
  19. Hi there, Interesting username...reminds me "Wall Street"'s Gordon Gecko... FPI is the root of my strategy, I just modified the perception over it. As about trading different accounts, I'd give it a NO... You can't arbitrage if you don't have the accounts unified somehow. Even if you find a way to control trading , open and close trades simultaneously , you still need to wire the money from the winner to the loser, and this means fees. And even if you find that forex transfer provider that's mentioned somewhere on the GoldenMoneyTree forum, this is still gonna be done by hand. So I'd stick with Interactive Brokers and that IDEALPRO if I were you. Did you check that Reuters/CME platform link on the last page of FPI thread? Hope to find you around later, I will soon start posting the other strategies, as the forex landscape is changing and brokers hungryness for clients is opening arbitrage doors...
  20. I. Evolution towards Intercross Arbitrage 1. Triangular Arbitrage ================ It is perhaps one of the most known arbitrage strategies learned in finance school. It consists in converting a given amount of cash in a currency thru some other currencies and back to original currency and getting profit, thus completing a currency ring transformation. It can be applied as an N-angular Arbitrage, when it has N currencies to deal with, but usually it's about three and this is why it's called Triangular Arbitrage. So, if we'd have some USD and market rates would allow arbitrage, it would mean, for example, to convert it to EUR, then to JPY and back to USD and have profit. Example: we have $500 Market Rates: EURUSD 1.3700/03 EURJPY 162.09/12 USDJPY 118.18/20 So we decide to: 1. sell USD to buy EUR (LONG EURUSD @ 1.3703) : 500 USD/1.3703 = 364.8836 EUR 2. sell EUR to buy JPY (SHORT EURJPY @ 162.09) : 364.8836 EUR * 162.09 = 59143.9827 JPY 3. sell JPY to buy USD (LONG USDJPY @ 118.20) : 59143.9827 / 118.20 = 500.37 USD So, by making a conversion thru all the 3 currencies, we won 37 cents, meaning a ROE (Return on Equity) of 0.074%. Seems simple, huh? The problem of Triangular Arbitrage is that it works only in EXCHANGE ENVIRONMENTS, where amounts of money are EFFECTIVELY EXCHANGED. Banks work in an EXCHANGE ENVIRONMENT. They are simultaneously in excess and need of liquidity. For example a bank has USD and needs EUR. It would then wire USD to another bank and get EUR wired back. It won't do a forex style LONG EURUSD, as it doesn't need a position on EURUSD, but the real EUR to make payments. Exchange houses are an example of an exchange environment. But, different than the one of the banks, they don't provide: tight spreads, electronic market and leverage. Going back to the trade example, when a bank finishes the three trades, it would have the profit in it's account, as every trade would cancel the previous trade result. One of the works that treats Triangular Arbitrage as Yukihiro Aiba's master thesis, "Triangular Arbitrage as an Interaction among Foreign Exchange Rates". However we forex traders don't have access to such an environment. We trade in the FOREX MARKET ENVIRONMENT and we can't do the Triangular Arbitrage as in theory, which remains only a simple theoretical base : our trades are independant, don't close each other. Once opened, we have the spread loss in our account. We must find the point where to close them. And this lead to step 2, the Fractional Products Inneficiency strategy. 2. Fractional Products Inneficiency ========================= Fractional Products Inneficiency, as it was designed by its author, Michal Kreslik, on the end of 2006, beginning of 2007, is the application on FOREX of the Triangular or N-angular Arbitrage. Trade decisions of entry and exit are made on the Fractional Products Inneficiency (on short, FPI) swing. On the earlier example, we could calculate a FPI like this FPI = 1.3703 / 162.09 * 118.20 = 0.99925. The no-arbitrage relationship would mean that FPI to be equal to 1. FPI less than 1, we can trade. In order to get profit we should wait for the FPI (CALCULATED THE SAME WAY, not changing bids with asks and vice-versa) to go to 1.0003 and so. Michal's explanation of FPI strategy lacked: a. a precise FPI calculation method as well as a precise ring establishment method (confusion between Buy-Sell-Sell and Sell-Buy-Buy currency rings almost last on all forum pages) b. a link between FPI swing and results c. embedding of spread costs in strategy The most important things learned from Michal's FPI are: a. hedging principle: each currency must be EQUALLY BOUGHT AND SOLD (by his words, "The Impeccable Hedge", although hedging in MetaTrader may be only good at its best); b. the volume calculations for each operations, which is the pinnacle of his achievement. Trying to overcome the mysteries and paradoxes of FPI explanation (as Michal said, "I hid the gold in many places for friends to find it"), I redesigned his strategy under the Intercross Arbitrage name. 3. Intercross Arbitrage ================ Before jumping to Intercross Arbitrage, let's first correct the ring confusion : which pairs should be bought and which pairs should be sold in a Kreslik currency ring ? I consider the following: Once the currencies are established (say EUR, USD, JPY), we imagine we are transforming the currency from one to the other We have EUR. 1. We sell EUR to gain USD. EURUSD exists, we sell it. 2. We sell USD to gain JPY. USDJPY exists, we sell it. 3. We sell JPY to gain EUR. JPYEUR does not exist to sell it. EURJPY exists, and since we reversed the pair, we buy. This can be done with n currencies. If one of the transformations cannot be done, for example neither PLNNOK nor NOKPLN exists, the entire ring is scrap, going to another combination. More about this on the Swap Arbitrage topic. So, what's arbitrage? A simple answer would be (for the complicated stuff, go see Wikipedia): "Simultaneously buying and selling the same asset at different prices to get immediate profit". Well, we don't have a New York EURUSD to arbitrage against a London EURUSD. So , how do we do it? Let's return to the earlier example: 1. LONG EURUSD 2. SHORT EURJPY 3. LONG USDJPY Let's translate it: 1. LONG EUR, SHORT USD 2. SHORT EUR, LONG JPY 3. LONG USD, SHORT JPY We can see clearly that bought JPY in (2) is sold in (3) so JPY clears out, and what we have now is: 1. LONG EUR, SHORT USD 2. SHORT EUR 3. LONG USD or: 1. LONG EUR, SHORT USD 2,3: SHORT EUR, LONG USD So operations 2 and 3 are practically a virtual SHORT EURUSD. Now we have a secondary EURUSD to arbitrage against main, real EURUSD. Not only the traded forex pairs have virtual counterparts, but also conceptual pairs may have only virtuals. For example, let's say a broker doesn't trade GBPCHF at all. GBPCHF could be made by: GBPUSD & USDCHF, but also by: GBPJPY & CHFJPY We could actually have an arbitrage of "Virtual GBPCHF ask" against a "Virtual GBPCHF bid" Market rates: GBPUSD 2.0250/53 USDCHF 1.1988/91 GBPJPY 239.64/70 CHFJPY 98.78/83 Virtual GBPCHF ask means that we buy GBPCHF, so we must have: LONG GBP, SHORT CHF , given by: LONG GBP / SHORT XXX LONG XXX / SHORT CHF Similar, Virtual GBPCHF bid means that we sell GBPCHF: SHORT GBP / LONG XXX SHORT XXX / LONG CHF By looking at the rates, we can spot the Virtual GBPCHF bid and ask: Virtual GBPCHF ask: LONG GBPJPY @ 239.70 (LONG GBP, SHORT JPY) SHORT CHFJPY @ 98.78 (LONG JPY, SHORT CHF) Virtual GBPCHF ask = 239.70 / 98.78 = 2.4266 as GBP/JPY / CHF/JPY = GBP/JPY * JPY/CHF = GBP/CHF Virtual GBPCHF bid: SHORT GBPUSD @ 2.0250 (SHORT GBP, LONG USD) SHORT USDCHF @ 1.1988 (SHORT USD, LONG CHF) Virtual GBPCHF bid = 2.0250 * 1.1988 = 2.4275 as GBP/USD * USD/CHF = GBP/CHF So, this should mean we buy GBPCHF @ 2.4266 and sell it @ 2.4275 for 9 small CHF-sized pips as a potential. We should wait for the market to swing this and get our profit. But, how much do we pay for it? First of all, let's calculate lotsizing to know exactly how much to trade. The most remarcable of Michal Kreslik's achievements is lotsizing, how much to trade out of each pairs to keep hedging. Suppositions: 1. USD 500 account equity 2. Maximum leverage : 200 3. Broker allows microlots (0.01) . I will explain later why microlots are important and how much they make the difference in hedging for the small guy. 4. We use 85% of available leverage . We allow a window of risk to cover for spreads and broker datafeed damage. 5. Size of a standard lot : 100000 units for USD and CHF denominated pairs, 70000 units for GBP denominated pairs Calculus: Total funds = 500 x 200 = 100000 USD Available funds = 100000 x 85% = 85000 USD We make 4 trades, so each one would be allocated around 85000/4 = 21250 USD: The trades are: LONG GBPJPY @ 239.70 (LONG GBP, SHORT JPY) SHORT CHFJPY @ 98.78 (LONG JPY, SHORT CHF) SHORT GBPUSD @ 2.0250 (SHORT GBP, LONG USD) SHORT USDCHF @ 1.1988 (SHORT USD, LONG CHF) One of the most difficult aspects is the one of the first trade. We must have a start point, so we must know how much is the first currency of the first trade in the account currency. It's simple now, as we must know how much is GBP in USD, but what if we'd had PLN or another exotic? GBPUSD trades 2.0250/53, so we consider a rough GBP/USD = 2.02515 We have allocated 21250 USD for the trade, so this means 21250/2.02515=10,493.05 GBP. For a lotsize of 70000 GBP, we have 0.149 lots, rounded at two decimals 0.15 (normally not advisable to round up, but in this case the difference is very small) . 1. LONG 0.15 GBPJPY @ 239.70 (LONG GBP, SHORT JPY) BOUGHT 10500 GBP = 0.15 x 70000 10500 GBP x 239.70 = 2516850 JPY SOLD 2. Now we don't know how much CHF to short for the 2nd operation, but we know how much JPY to buy. 2516850 JPY / 98.78 = 25479.35 CHF. 25479.35/100,000 CHF = 0.2548 lots Now we can use: 0.25 lots or 0.26 lots, depending on how much unhedged JPY may have: a. SHORT 0.25 CHFJPY @ 98.78 (LONG JPY, SHORT CHF) SOLD 25000 CHF = 0.25 x 100000 25000 CHF x 98.78 = 2469500 JPY BOUGHT (47350 JPY NET SOLD) b. SHORT 0.26 CHFJPY @ 98.78 (LONG JPY, SHORT CHF) SOLD 26000 CHF = 0.26 x 100000 26000 CHF x 98.78 = 2568280 JPY BOUGHT (51430 JPY NET BOUGHT) So the a) version is better, as JPY unhedged side is smaller. Since Virtual bids and asks calculations are independent, we could consider a new currency ring and start calculation from the beginning for the virtual ask, like we did before. Or we could use the GBP exposure and continue calculation. I am writing the 2nd version here to accustom readers with currency ring calculations. 10500 GBP / 70000 = 0.15 lots 3. SHORT 0.15 GBPUSD @ 2.0250 (SHORT GBP, LONG USD) SOLD 10500 GBP = 0.15 x 70000 10500 x 2.0250 = 21262.5 USD BOUGHT (GBP completely hedged) 1417.5 USD / 100000 = 0.01 lots 4. 21262.5 USD / 100000 = 0.212 lots a. SHORT 0.21 USDCHF @ 1.1988 (SHORT USD, LONG CHF) SOLD 21000 USD = 0.21 x 100000 21000 x 1.1988 = 25174.8 CHF BOUGHT (262.5 USD NET BOUGHT, 174.8 CHF NET BOUGHT) ; TOTAL UNHEDGED AMOUNT = (47350 JPY / 118.38 as USDJPY rate = 399.98) + 262.5 USD + (174.8 CHF = 145.81 USD) = 808.29 USD b. SHORT 0.22 USDCHF @ 1.1988 (SHORT USD, LONG CHF) SOLD 22000 USD = 0.22 x 100000 22000 x 1.1988 = 26373.6 CHF BOUGHT (737.5 USD NET SOLD, 1,373.6 CHF NET BOUGHT) ; TOTAL UNHEDGED AMOUNT = (47350 JPY / 118.38 as USDJPY rate = 399.98) + 737.5 USD + (1373.6 CHF = 1145.81 USD) = 2283,29 USD So the a) trade is chosen. Still, the example shows a 808.29 USD unhedged volume, which slips with a 0.08 USD/pip on total position fluctuation II. Exposure under assumptions of using and not using microlots Exposure is generated from the simple fact that currencies obtained or sold during SELL and BUY operations cannot be offset due to the fact that the lotsize cannot mimic this value. For example we want to hedge USD in the following example by buying USDJPY. BUY 0.2 EURUSD @ 1.33 We are LONG 20000 EUR, SHORT 26600 USD 1.Using microlots (0.01) We could: a. LONG 0.26 USDJPY @ 121 We are SHORT 13000 USD, LONG 3146000 JPY USD exposure: SHORT 26600-26000 = 600 USD b. LONG 0.27 USDJPY @ 121, LONG 3267000 JPY We are LONG 27000-26600 = 400 USD Given the fact we always choose for hedging the appropriate lotsize, the maximal unhedged volume may go up to 500* units (500 USD, 500 EUR, 500 GBP and so on), being also the indifference point where it doesn?t matter if you hedge by choosing upper or lower volume. 2. Using mini lots (0.1) We could: a. LONG 0.2 USDJPY @ 121 We are SHORT 20000 USD, LONG 2420000 JPY USD exposure: SHORT 26600-20000 = 6600 USD b. LONG 0.3 USDJPY @ 121, LONG 3630000 JPY We are LONG 30000-26600 = 3400 USD Given the fact we always choose for hedging the appropriate lotsize, the maximal unhedged volume may go up to 5000* units (5000 USD, 5000 EUR, 5000 GBP and so on), being also the indifference point where it doesn?t matter if you hedge by choosing upper or lower volume. *Note: 500 or 5000 on the assumption that a full lot is 100000 units. 1. Unhedged volume is also a function of contracts traded and pair configuration. If there are 3 contracts traded, one currency will be completely hedged, 2 incompletely hedged. Example 1: EURUSD EURGBP GBPUSD EUR will be completely hedged, GBP and USD not completely. If there are 4 contracts, 2 or 3 currencies may be incompletely hedged: Example 1: USDGBP USDJPY EURGBP EURJPY Only GBP and JPY not completely hedged. Example 2: EURGBP EURCHF GBPUSD USDCHF GBP, CHF and USD not completely hedged. The hedged currencies are the ones that are being bought and sold being the first currency in the involved pairs. 2. Proportional unhedged volume, proportional equity Say a $500 account trades at 200 leverage, using 80% of available margin, USING MICROLOTS. Used funds = 500x200x80% = 80.000 USD. Say we have 4 trades. Maximum exposure is 500 units each. We would have exposure of 500 GBP, 500 EUR, 500 USD (wouldn?t happen in practice, only in theory; I considered the 3 currencies starting from GBP, the most expensive). So ~1500 EUR unhedged currency, about 1,875% of total volume Say the arb is 4 USD pip high. The unhedged part of 1500 EUR values ~ 2000 USD. The 4 pips correspond to 80000 USD, meaning a profit of 8 x 4 = 32 USD There would be needed a bad luck of 160 USD pips on the aggregated volume of the 3 unhedged currencies to wipe out the profit. WITHOUT MICROLOTS, maximal exposures would be 5000 GBP, 5000 EUR, 5000 USD ..~15000 EUR = 18,75% Unhedged part, ~ 20000 USD Only 16 USD pips bad movement on the 3 currencies needed to wipe out profit. But if the account is $5000, maximal exposure is the same as before. Profit comes on 800000 USD = 320 USD So 160 pips needed to wipe out profit. Without microlots, risks can be brought down from $5000 in account equity? Sorry, that?s it. III. Completing the Fractional Product Inneficiency : Potential, Costs and Required One of the greatest FPI drawbacks was the fact you had to rely only on FPI value to initiate trade or close. There was no way to know it was enough except for closing when you could have watched the total profit. But how about the entry point ? Would just a fixed value of FPI 0.9997 be enough as entry criteria ? Being given the fact that we are virtually long and short on the same pair, we know that these "assets" can't stay forever on this position. Having the same meaning as the pair they represent, they have to be, randomly, on both sides of it, so, what gives now a virtual bid will make a virtual ask in the days to come and vice versa. We have to answer the following questions: 1. How much is for real for the gap between virtual bid and virtual ask ? Created gap is in the Virtual pair secondary currency. We must convert it to account currency for correct comparison. 2. How much do we pay for this stuff? Different trade results are in different currencies, costs must be brought to a single currency. 3. How much potential needs a trade group in order to cover spreads, slippage and have decent profit? 1. How much is the real gap between virtual bid and virtual ask? ============================================== Even if the synthetic pair has a virtual/real bid and a virtual/real ask, the atoms, meaning the trade subgroups that create the buy-side and the sell-side have also another real/virtual of their own. Like in the GBP/CHF example earlier, looking at the buyside atom: LONG GBPJPY @ 239.70 (LONG GBP, SHORT JPY) SHORT CHFJPY @ 98.78 (LONG JPY, SHORT CHF) It's true that traded prices make up the Virtual ask, but the close prices for each trade make up the bid of the entire group. Let the TakenBid and TakenAsk be the Virtual bid and ask prices; if aask and abid being the mirror (close prices), CrossPair the pair you arb on; then you can write: Pips = (TakenBid-aask) * multiplicator + (abid - TakenAsk) * multiplicator , where multiplicator is usually 10000 or 100 for JPY ended pairs (10^n , where n is the number of decimals) Now the pips are denominated in the second currency, meaning CHF. We want to convert it to our account currency, USD, and we'd better do that via USDCHF rate. 2. How much do we pay for this stuff ? ============================ And I'm asking here: How much is a tick of the account currency on a standard lot? With MarketInfo you can find out how much is a tick on a given currency pair: MarketInfo(contract, MODE_TICKVALUE) , and , for a USD account on EURUSD test gives 10, because you have 10 USD/pip trading EURUSD. What if you have the account denominated in EUR? Because your account currency is EUR, applying the same MarketInfo("EURUSD",MODE_TICKVALUE) won't give you that 10 again... and if you don't have any XXXEUR pair on hand, what you could do is multiply the MarketInfo result by EURUSD, cancelling the correction embedded in MarketInfo. A short route to appendix now: Appendix is what some MetaTrader brokers add to currency pairs. For example, mini InterbankFX accounts have that "m" appended to the end of currency pair, like EURUSDm. To get the appendix, use BcLib function GetSymbolsAppendix(). Just a simple call like appendix=GetSymbolsAppendix() and your strategy would then run on any broker without other modifications due of this. Call it once per EA, in the init(), takes some time! Now, the implementation of tick of the account currency in BcLib is this: double GetTickDenominator(string appendix) { string acctcurrency=AccountCurrency(); double res=0; if (acctcurrency=="USD") res=MarketInfo(StringConcatenate("EURUSD",appendix),MODE_TICKVALUE); if (acctcurrency=="EUR") res=MarketInfo(StringConcatenate("EURUSD",appendix),MODE_TICKVALUE)*MedPrice(StringConcatenate("EURUSD",appendix)); if (acctcurrency=="GBP") res=MarketInfo(StringConcatenate("EURGBP",appendix),MODE_TICKVALUE)*MedPrice(StringConcatenate("EURGBP",appendix)); if (acctcurrency=="CHF") res=MarketInfo(StringConcatenate("GBPCHF",appendix),MODE_TICKVALUE); if (acctcurrency=="JPY") res=MarketInfo(StringConcatenate("USDJPY",appendix),MODE_TICKVALUE); return(res); } *Note: the MedPrice function just returns a simple (bid+ask)/2 Now let's head back to our account currency evaluation: For each contract traded inside, we calculate it like this: pipcost=MarketInfo(contract,MODE_SPREAD)*MarketInfo(contract,MODE_TICKVALUE)/GetTickDenominator(appendix); the volumes are equivalent, no need to think about them! Now we can see that the implementation of GetTickDenominator was correct. Supposing our contract was EURUSD trading at about 1.37. GetTickDenominator would give us a 10, since 10 EUR won on a EUR account is the same as 10 USD won on a USD account. MarketInfo("EURUSD",MODE_TICKVALUE) would return about 7.2 (would have been 10 if account would have been USD denominated) ; GetTickDenominator would return 10, so the result would be around 2.16, or 3/1.3700 . 3. How much potential needs a trade group in order to cover spreads, slippage and have decent profit? ========================================================================= Problem of the costs is that the costs are dynamic. The spread is fluctuating, and the costs once with it. Here there is freedom of choice. We could calculate the Required potential to include the costs + a percent of the costs + a fixed amount of pips to compensate for slippage and spread fluctuations... http://img402.imageshack.us/img402/3323/virtualbidsandaskstg1.jpg IV. Implementation MetaTrader or Reuters Dealing ? http://img77.imageshack.us/img77/1440/arbtraderfigtingthemarkcn4.jpg *Note that the displayed bids and asks will be the ones on the best bids and asks, even if a trade group is placed and old "lesser" bid and ask atoms are now the best ones. 1. How are the pairs generated ======================= MetaTrader doesn't have a function to enumerate available currencies and pairs. This is overcome in BcLib by the following mechanism: The TestCurrencies[] , which includes 15 currencies: "EUR","USD","GBP","JPY","CHF","AUD","CAD","NZD","HKD","THB","NOK","SEK","DKK","PLN","TRY". If you want to add more currencies to be tested, just use AddCurrencyToTest(currency) , before going further. By calling GetCurrenciesAndPairs(Appendix) you get the used currencies and used pairs in UsableCurrencies[] and UsablePairs[] ; the numbers of currencies and pairs are indicated in CurrenciesNo and PairsNo integers. This procedure will test the currencies of the TestCurrencies[] agains each other. When one currency pair exists, it is aded to UsablePairs[], and the two currencies that make it are added, if not already there, in UsableCurrencies[]. In order to know exactly what rates appear on screen and how are they calculated, BcArb creates a series of crosslists, by combining every 2 currencies with a 3rd-one. What it gets, is, all the atoms that can be used for buy or sell that emulate a currency pair (this example is generated on WHC's Metatrader): EUR/USD EURUSD GBP21 JPY22 CHF22 AUD21 CAD22 NZD21 EUR/GBP EURGBP USD22 JPY22 CHF22 AUD22 CAD22 EUR/JPY EURJPY USD21 GBP21 CHF21 AUD21 CAD21 NZD21 EUR/CHF EURCHF USD21 GBP21 JPY22 AUD21 CAD21 NZD21 EUR/AUD EURAUD USD22 GBP21 JPY22 CHF22 CAD22 NZD22 EUR/CAD EURCAD USD21 GBP21 JPY22 CHF22 AUD21 NZD21 EUR/NZD EURNZD USD22 JPY22 CHF22 AUD21 CAD22 GBP/USD GBPUSD EUR11 JPY22 CHF22 AUD21 CAD22 USD/JPY USDJPY EUR11 GBP11 CHF21 AUD11 CAD21 NZD11 USD/CHF USDCHF EUR11 GBP11 JPY22 AUD11 CAD21 NZD11 AUD/USD AUDUSD EUR11 GBP11 JPY22 CHF22 CAD22 NZD21 USD/CAD USDCAD EUR11 GBP11 JPY22 CHF22 AUD11 NZD11 NZD/USD NZDUSD EUR11 JPY22 CHF22 AUD11 CAD22 GBP/JPY GBPJPY EUR11 USD21 CHF21 AUD21 CAD21 GBP/CHF GBPCHF EUR11 USD21 JPY22 AUD21 CAD21 GBP/AUD GBPAUD EUR11 USD22 JPY22 CHF22 CAD22 GBP/CAD GBPCAD EUR11 USD21 JPY22 CHF22 AUD21 GBP/NZD EUR11 USD22 JPY22 CHF22 AUD21 CAD22 CHF/JPY CHFJPY EUR11 USD11 GBP11 AUD11 CAD11 NZD11 AUD/JPY AUDJPY EUR11 USD21 GBP11 CHF21 CAD21 NZD21 CAD/JPY CADJPY EUR11 USD11 GBP11 CHF21 AUD11 NZD11 NZD/JPY NZDJPY EUR11 USD21 CHF21 AUD11 CAD21 AUD/CHF AUDCHF EUR11 USD21 GBP11 JPY22 CAD21 NZD21 CAD/CHF CADCHF EUR11 USD11 GBP11 JPY22 AUD11 NZD11 NZD/CHF NZDCHF EUR11 USD21 JPY22 AUD11 CAD21 AUD/CAD AUDCAD EUR11 USD21 GBP11 JPY22 CHF22 NZD21 AUD/NZD AUDNZD EUR11 USD22 JPY22 CHF22 CAD22 NZD/CAD NZDCAD EUR11 USD21 JPY22 CHF22 AUD11 In order to obtain the list, just call CreateCrosslistsTable(Appendix) from BcArb. The list is contained in CrosslistsTable[] and its length is specified by the CrosslistsNo integer. Note that, if one pair has only one atom, it won't appear in the list, as one atom does not have a counterpart to be arbitraged to. Let's analyse a line: EUR/USD EURUSD GBP21 JPY22 CHF22 AUD21 CAD22 NZD21 The first word of the line specifies the cross: EUR/USD The atom which contains the pair itself is the real one; the others are virtuals; GBP21 = EURGBP & GBPUSD; In combination with the first currency of the cross (EUR), the combined currency (GBP) appears on the 2nd position In combination with the second currency of the cross (USD), the combined currency (GBP) appears on the 1st position In this example, EURGBP is Pair1 and GBPUSD is Pair2. Calculating cross virtual bid and ask =========================== If the atom is a real pair, virtual bid and ask are pair's bid and ask. If not: 1. We analyse the indexes (what comes after the currency, e.g. 2 and 1 after GBP), and we establish buy and sell prices for Pair1 and Pair2. a. First index Case 1: Pair1.buy=bid; Choice for buy : Short; Pair1.sell=ask; Choice for sell : Long; Case 2: Pair1.buy=ask; Choice for buy : Long; Pair1.ask=bid; Choice for sell : Short; b. Second index Case 1: Pair2.buy=ask; Choice for buy : Long; Pair2.sell=bid; Choice for sell : Short; Case 2: Pair2.buy=bid; Choice for buy : Short; Pair2.sell=ask; Choice for sell : Long; Now, once we established the prices for both pairs upon what we want to do with the cross, we calculate the cross price: Case 11: cross bid=(1/Pair1.sell)*Pair2.sell; cross ask=(1/Pair1.buy)*Pair2.buy; Case 12: cross bid=(1/Pair1.sell)/Pair2.sell; cross ask=(1/Pair1.buy)/Pair2.buy; Case 21: cross bid=Pair1.sell*Pair2.sell; cross ask=Pair1.buy*Pair2.buy; Case 22: cross bid=Pair1.sell/Pair2.sell; cross ask=Pair1.buy/Pair2.buy; This job is automatically done by BcArb's GetAtomData()... Transforming units to lots =================== Lotsize calculations are based on volume calculations on bought and sold amounts of currency. DO NOT PRESUME LOTS ARE 100000 FOR EACH CONTRACT! Use always the UnitsToLots function, as it is implemented in BcLib. As it is implemented now, it will always choose the appropriate volume, except for 0, which will never be chosen, if it may be appropriate volume (for example on a broker that doesn't allow microlots we transform 3000 units on EURUSD. Appropriate volume is 0, yet answer will be 0.1 (for 10000). double UnitsToLots(double units,string contract) { double dlotsize=MarketInfo(contract,MODE_LOTSIZE); double mag=MarketInfo(contract,MODE_LOTSTEP); double mini=MarketInfo(contract,MODE_MINLOT); double big=1/mag; double size=dlotsize/big; double dlots0,dlots1,back0,back1; dlots0=NormalizeDouble(units/size,0)*mag; dlots1=dlots0+mag; back0=dlots0*big*size; back1=dlots1*big*size; if (back1-units<units-back0) { if (dlots1<mini) return(mini); else return(dlots1); } else { if (dlots0==0) return(mini); else { if (dlots0<mini) return(mini); else return(dlots0); }//else if (dlots0==0) }//else if if (back1-units<units-back0) } 2. Implementation details =================== These are ArbTrader_script's working parameters (it is a script, put it in the \scripts folder) extern int DisplaySetup=2; extern int Tryouts=5; //0 for unlimited tryouts, don't put that! extern int MarginUsed=85; extern int Slippage=100; extern int MaxTickDelay=30; extern double TakePipsRatio=50; extern double TakePipsFixed=2; extern double TakePipsCloseRatio=50; extern double TakePipsCloseFixed=2; extern bool EnableFreshness=true; extern bool EnableLiveTest=false; extern int DontRepeatLiveTestForSecs=300; extern bool AllBips=False; Do not change the display type; 1 may work, but not tested. Tryouts means how many times it will try opening a trade. MarginUsed is the used ratio from available leverage; Slippage is very high; I set it like that in order to leave some space for opening last trade; it's not good to remain unhedged while losing time trying to open last; MaxTickDelay works if Freshness is enabled; All the pairs last quotes must be fresher than MaxTickDelay, otherwise trade won't be triggered; TakePipsRatio and TakePipsFixed establish the Potential for opening ; TakePipsClose and TakePipsCloseFixed establish the Potential for closing (close moment is calculated like a potential, too); EnableFreshness enables Freshness test; EnableLiveTest is good to be on false; if not, before triggering trades at full scale , it will do them at the smallest tradable amount and close them. If one crashes, the big trades won't be triggered; The program remembers last arb data ; so if a new test is to come, generating further account drainage, this will be prevented if it comes in DontRepeatLiveTestForSecs seconds; AllBips is an older setting; On previous MetaTrader versions, using a sound (from dll) that didn't exist, a system error bip was produced; This bip was to be enabled on all yellow lightings if AllBips was true; Otherwise, Cepstral Amy's voice should to be heared when arbitrages where entered and closed. (place ArbEnter.wav and ArbClose.wav in C:\Windows) V. Conclusions Both FPI and Intercross Arbitrage are versions of the hardest strategy to understand or implement. Problem is, the result doesn't seem to cover the huge effort for understanding and implementing it. The strategy is cripled by one of the pairs going off quotes... It stays behind the others, generates arbitrage, then can't be traded for minutes. When it's traded, it's already on loss... Plus that trading occurs rarer than seldom. But, despite this, the strategy remains practically the single arbitrage strategy that can be applied with forex alone, without using futures.
  21. Place BcLib and BcArb in experts\include folder Place BcTools.Dll and BcWin.exe in experts\libraries folder First compile BcLib then BcArb.
  22. This is, indeed, the first decision that you have to make. We have two categories of brokers (I mean only from MetaTrader brokers here): 1. US, trusted, NFA-regulated, USELESS brokers. 2. Non-US, controversial, FSA or other regulation authority, USELESS or USEFUL brokers. The term "arbitrage" from the title has its initial meaning : choice. Except for the Intercross Arbitrage and the Swap Arbitrage, which work with forex only, all the other arbitrage strategies, which are also the "normal" arbitrage strategies found in books, require futures contracts implementation in MetaTrader. It seems they can only be implemented as CFDs. And NFA is against this. So if we choose a US broker, we are left with: a. Intercross Arbitrage b. Swap Arbitrage The Intercross Arbitrage relies on broker delivering not only small spread contracts, but real, not "engineered" quotes that can be used to arbitrage different versions of the same currency crosses. The Swap Arbitrage relies on small swap spreads combined with stability in time, which can't be forecast... The second type of brokers may be USELESS or USEFUL. If their datafeed is as poor as the first kind, it's stupid to even think opening the account. You can get the same datafeed from a trusted broker. But if they come with currency futures, commodities, even swap free feed on forex, they are USEFUL as arbitrage techniques may be applied with success. However, GETTING THE MONEY OUT of there may be an issue, but as long as they are regulated, is a risk worth to be taken...
  23. I was looking over the oil arbitrage script making money on my friend Billy's server these days, and I thought to myself that the forum might benefit out of this. I am seeing that losses, that are a rule for forex traders, are accidents in arbitrage, and I said to myself "Enough with regular trading. People must know." We must never ever take abuse from regular trading again, and finally break down the old saying "You don't risk, you don't win". So I decided for the first time to release full code and documentation on the arbitrage strategies that I have on hand now (Intercross Arbitrage, Swap Arbitrage, Oil Arbitrage, and the following Cash/Futures Arbitrage), after the blog categories will be ready. Also decided to make it in english to increase website traffic.
  24. Ambele? http://forum.vamist.ro/public/style_emoticons/default/question.gif La NF am asa: #CLN7 (July 2007 Light, Sweet Crude Oil Future) #CLQ7 (August 2007 Light, Sweet Crude Oil Future) Cred ca la astea te-ai referit cand ai scris "ambele" daca nu, imi pare rau dar eu nu tranzactionez petrol. In momentul asta #CLN7 (July 2007 Light, Sweet Crude Oil Future) are la bid 68.50 #CLQ7 (August 2007 Light, Sweet Crude Oil Future) iar asta are la bid 68.62 Hmm...o luna diferenta la scadenta, ceea ce insemna ca atunci cand raman descoperit (cu o luna inainte) apare un nou activ , cu o noua scadenta, care sigur n-o sa aiba acelasi pret cu cel care expira (punct de discontinuitate). Astea de la WHC au si diferente care urca pana la 400 de pipsi, adica vreo 4$/baril (am vazut graficul comparativ pe 500 de zile)... Eu imi mut toate jucariile pe arbitrajul cu petrol (imi desfiintez pana si contul uitat la OANDA). Vroiam sa fac arbitraj intermarket de cand eram in facultate, dar nu mi s-au oferit nici platforma si nici activele... Pentru mine e de neinteles sa ma gandesc macar sa aleg intre speculatie si arbitraj. "Forecasting exchange rates has a success rate no better than that of forecasting the outcome of a coin toss” - Alan Greenspan, Nov 2004...Spune totul. Arbitrajul e solid. Nu e "arbitrajul fals" in care ne imaginam ca USDCHF e un fel de 1/EURUSD... petrol = petrol. Acelasi activ, de o parte, si de alta... Divergenta si convergenta, ca acelasi lichid negru care misca economia mondiala n-are cum sa se distanteze nedeterminat de el insusi... Trebuie doar un regim adecvat de money management care sa ma ajute sa fac fata riscului unor divergente mai puternice. Dar in orice caz, sunt convins ca vine si convergenta, spre deosebire de forex, unde nimic nu trebuie sa convearga cu nimic, un continuu random walk, in care micile "inexactitati" in uzul indicatorilor duc la pierderi sigure intrerupte de castiguri arbitrare (pentru incurajare)...
  25. Apropo de SAXO...circula zvonul ca or sa bage MT...dar e doar un zvon.. SAXO are o gama de activa mai mare decat OANDA... Care or fi "facilitatile" OANDA nici nu prea inteleg, din moment ce automatizarea costa bani. Iar BoxOption are un pricing super scump, mai nasol decat cel de dinainte de lansarea serviciului.
×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui.