Sari la conținut
  • intrări
    29
  • comentarii
    230
  • citiri
    1.163.013

BcLib (and many others) update... discoveries, bugs and mistakes


TheEconomist

9.291 citiri

Last week our fellow TradeLover from the forum (who is also a contestant in MetaQuotes Automated Trading Championship 2007 - let's give him an =D> for that) made a shocking and very disturbing discovery: a tick is not quite a pip in forex (we even argued for that, but he was right - never take anything for granted)

 

Running a simple script like this:

 

int start()

{ Print("tick size= ",MarketInfo(Symbol(),MODE_TICKSIZE),

" - tick value= ",MarketInfo(Symbol(),MODE_TICKVALUE));

return(0);

}

 

what he got after some hours was this:

 

22:40:03 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:13 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:20 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:24 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:27 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:30 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:31 ticksize GBPCHF,M1: tick size= 0.0002 - tick value= 17.07

22:40:32 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

22:40:46 ticksize GBPCHF,M1: tick size= 0.0001 - tick value= 8.53

 

Now what if that tick value is caught in a hedge calculus that calculates lotsizing or results for months ahead ?

 

In order to settle this issue once and for all, I made the RealTickValue() function as follows:

 

double RealTickValue(string contract)

{

double res;

res= MarketInfo(contract,MODE_TICKVALUE) / (MarketInfo(contract,MODE_TICKSIZE)/MarketInfo(contract,MODE_POINT));

return(res);

}

 

The function now works as a proxy for MODE_TICKVALUE inquiries. Now both BcLib and BcArb call that first when dealing with MODE_TICKVALUE.

Found surprise bugs in ReliableOrderSend and ReliableOrderClose. Don't know how they got there, as they seem to work well.

Also corrected past scripts that use MODE_TICKVALUE. Discovered also mistakes in updated SwapFinder, that's why I corrected and updated again, along with SwapButterfly.

Inserted also a mechanism for calculating futures using London InterBank rates. It doesn't seem to be too much of use, as indicators are still wrong, but you can correct their parameters, so I added DiscountedFuturesLIB and DiscountedBasisLIB indicators.

Corrected bugs in Futures script. Now it's set up with a MarginUsage of 50% and a SwapFree regime set to True by default.

 

 

P.S.

I will keep you posted with my arbitrage trades working (Spot-to-Futures type A)

3 Comentarii


Comentarii Recomandate

Would you mind explaining what all these script do?

 

Ok Jeff, this is the explanation about the files:

 

bclib_update_oct_02_2007.zip

This is my MetaTrader functions library. This is an older version, the current one, which is perhaps one of the less buggy, is in my last post. It comprises BCLIB.MQ4 and BCARB.MQ4, as functions libraries, that must reside in experts\include folder; BCWIN.EXE and BCTOOLS.DLL are to give you the option of controlling EAs with an external application (they are for implementing menus). I will come back with explanations on these if I'm requested to do so, but they are usually not needed. In order to work, these must reside in the experts\libraries folder.

 

futures_script_repaired_021007.mq4

The futures script was a babe in its glory times! It is looking at forex rates and their futures counterparts. Supposing the broker won't charge you swap (you can get rid of that setting) it will calculate how much money you'd make keeping a spot and a futures trade at the same time. It can also trade the best combination found.

 

DiscountedFuturesLIB.mq4 and DiscountedBasisLIB.mq4

These are applications of the Discounted Futures and Discounted Basis indicators, using LIBID/LIBOR rates as input. Slightly different than the non-LIB versions of these indicators, and a bit worst. Discounted Futures is discounting a future (like 6E, 6A and so on). It is an overlay indicator. For example, drag it over EURUSD or USDJPY. Of course, it will work for the pairs that have a futures. Discounted Basis displays as a separate window and is Discounted Futures - Spot. Read more about the Discounted indicators and the Futures script here .

 

SwapFinder_script_repaired_021007.mq4 and SwapButterfly_script_repaired_021007.mq4

The SwapFinder is a swap arbitrage script. It will recognize the currency pairs and the currencies, then it will attempt to find out perfectly hedged currency rings that generate interest, while their forex rate movement is to stand still.

SwapButterfly has the same idea like the SwapFinder, but different applied. Both techniques are discussed here .

 

 

Regards,

Bogdan

Link spre comentariu
Would you mind explaining what all these script do?

 

Ok Jeff, this is the explanation about the files:

 

bclib_update_oct_02_2007.zip

This is my MetaTrader functions library. This is an older version, the current one, which is perhaps one of the less buggy, is in my last post. It comprises BCLIB.MQ4 and BCARB.MQ4, as functions libraries, that must reside in experts\include folder; BCWIN.EXE and BCTOOLS.DLL are to give you the option of controlling EAs with an external application (they are for implementing menus). I will come back with explanations on these if I'm requested to do so, but they are usually not needed. In order to work, these must reside in the experts\libraries folder.

 

futures_script_repaired_021007.mq4

The futures script was a babe in its glory times! It is looking at forex rates and their futures counterparts. Supposing the broker won't charge you swap (you can get rid of that setting) it will calculate how much money you'd make keeping a spot and a futures trade at the same time. It can also trade the best combination found.

 

DiscountedFuturesLIB.mq4 and DiscountedBasisLIB.mq4

These are applications of the Discounted Futures and Discounted Basis indicators, using LIBID/LIBOR rates as input. Slightly different than the non-LIB versions of these indicators, and a bit worst. Discounted Futures is discounting a future (like 6E, 6A and so on). It is an overlay indicator. For example, drag it over EURUSD or USDJPY. Of course, it will work for the pairs that have a futures. Discounted Basis displays as a separate window and is Discounted Futures - Spot. Read more about the Discounted indicators and the Futures script here .

 

SwapFinder_script_repaired_021007.mq4 and SwapButterfly_script_repaired_021007.mq4

The SwapFinder is a swap arbitrage script. It will recognize the currency pairs and the currencies, then it will attempt to find out perfectly hedged currency rings that generate interest, while their forex rate movement is to stand still.

SwapButterfly has the same idea like the SwapFinder, but different applied. Both techniques are discussed here .

 

 

Regards,

Bogdan

 

 

Hello Bogdan

 

I found your BLOG while googling for some MT4 stuff. Your work is very interesting, specialy the issues of futures on MT. Also since I'm a professional programmer I'm very curious about BCWIN.EXE and BCTOOLS.DLL. I understand these are for controling MT from external apps by implementing menus. Would you be so kind to release the code of these utils.

Thank you very much. You have a new reader.

Link spre comentariu
Vizitator
Adaugă un comentariu...

×   Alipit ca text avansat.   Alipește ca text simplu

  Doar 75 emoji sunt permise.

×   Linkul tău a fost încorporat automat.   Afișează ca link în schimb

×   Conținutul tău precedent a fost resetat.   Curăță editor

×   Nu poți lipi imagini direct. Încarcă sau inserează imagini din URL.

×
×
  • 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.