Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Nymphodora, Quad, TipmyPip, Imhotep), 852 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Options trading questions [Re: jcl] #474080
09/18/18 16:23
09/18/18 16:23
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Yes, I got a message on that from support after posting the reminder above. And with v 1.88.5 somehow contractPrice() got live pricing data correctly.
With 1.88.3 - as should be clear from my message - I could obtain EUR option chain and some prices.

Re: Options trading questions [Re: Zheka] #474083
09/18/18 16:43
09/18/18 16:43
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The only change of the IB plugin between 1.88 and 1.83 was with the SET_PRICETYPE broker command, so maybe your options had a different price type, although I have not yet heard about such an issue. Anyway, glad that the problem disappeared.

Re: Options trading questions [Re: jcl] #474140
09/24/18 14:40
09/24/18 14:40
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Quote:
For loading a chain from a file while live trading, use dataLoad()

JCL,
HAving loaded a custom chain with dataLoad(), I would like to use standard contract() search functions for looking up a desired contract.
However, doing
Quote:
Contracts = (CONTRACT*) dataStr(2,0,0); //with or without typecast
C=contract(CALL,3,priceClose());
print(TO_WINDOW,"n Option price=%f",contractPrice(C));
generates:
Quote:
Error 016: Invalid date 0

Is there a workaround?
Or would it be possible to add handle as input to all contract() functions?

Re: Options trading questions [Re: Zheka] #474142
09/24/18 14:49
09/24/18 14:49
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Was this while live trading, or in backtest mode? If in backtest, check the dates of the contracts - maybe a date is really wrong.

Re: Options trading questions [Re: jcl] #474144
09/24/18 15:11
09/24/18 15:11
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
This is in Trade mode following contract chain 'trimming':
Quote:
for (ii=0;ii<NumContracts;ii++)
{
C=Contracts+ii;

if (strstr((string)C,incClass))
contractPrint(C,TO_CSV);
}

int sNumContracts=dataParse(2,Format,"C:ZorroLogEA_TradeOptions.csv");

Re: Options trading questions [Re: Zheka] #474155
09/25/18 15:36
09/25/18 15:36
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
I got this to (somewhat) work. The problem has been that contractPrint() exported a text field and i parsed it as such, while proper CONTRACT struct needs an int in this place.

So, the trick with assigning a ptr to the dataset to Contracts works.

However,
Quote:
C=contract(CALL,3,priceClose())

still generates
Quote:
Error 016: Invalid date 0

And then selects some arbitrary contract strike.

Does contract() make any assumption on the order of expiries (or something else) in the option chain?

Re: Options trading questions [Re: Zheka] #474164
09/26/18 07:17
09/26/18 07:17
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, but the error is probably not about expiration, but about the first field, which is a union of a date in historical data and a text string in live data. Check that field.

Re: Options trading questions [Re: jcl] #474311
10/05/18 13:34
10/05/18 13:34
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
JCL,

I have a problem with obtaining a contractPrice() in Trade Mode for a correctly selected Contract - when I load a chain from a dataset, rather then when using a contractUpdate().
(actually, occasionally also when i DO use contractUpdate()).

The difference between cases when it works and when it doesn't comes down to this.

Quote:
BrokerAsset ??? - FOP-20181109-1.16-C-GLOBEX: : 0.0000 0.004145 ms
BrokerAsset EUR-FOP-20181109-1.16-C-GLOBEX: : 0.0118 6983.145685 ms
i.e. the underlying "string" is not recognized ("EUR" is dropped from the symbol string).

I of course do call asset ("EUR") before contractUpdate() and contractPrice().

I got this reply from support:
Quote:
the part "EUR" of the contract symbol is stored by contractUpdate(). asset() is for selecting an asset, not for storing a contract symbol. Since the "EUR" is sometimes missing in your symbol, we suspect that the first argument to the previous contractUpdate call was wrong. For testing that, please print the first argument of contractUpdate() to the log. If it turns out that "EUR" was correctly set but is still missing in the symbol, then we have to look elsewhere.

To which I have 2 questions:

1) Which variable in an Asset struct - or anywhere else - that holds this value - and so could be set?

- I thought this should be taken by Zorro from the very first part of the SYMBOL string.

2) Is it possible at all to NOT call contractUpdate() in a script?

Answer from support suggests it is not possible, but you earlier wrote that it is indeed possible to load a chain from a file.

I think it should be made possible.

Re: Options trading questions [Re: Zheka] #474312
10/05/18 14:47
10/05/18 14:47
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
I don't know the symbol variable, but know that you can load the chain by script from a file, because some users did that too. But in live trading you must always call contractUpdate even when you load the chain otherwise. In the backtest it is probably not necessary.

Page 2 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1