Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Loop through option chain #482347
01/29/21 03:04
01/29/21 03:04
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline OP
Newbie
strimp099  Offline OP
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
Greetings,

I'm trying to loop through every contract in a chain for a given bar.

Code
void run()
{
    	// load today's contract chain
	if(!contractUpdate(Asset,0,CALL|PUT)) return;
	
	int i;
	for (i = 0; i <= NumContracts; i++)
	{
		CONTRACT* C = &Contracts[i];
		
		contractPrice(C);

		printf("\n%f",ContractAsk);
	}

}


This just prints 0.00000. I've already confirmed my .t8 file contains the chain data by exporting to CSV and munally checking.

What is the proper way to iterate through the options chain?

Re: Loop through option chain [Re: strimp099] #482351
01/29/21 07:38
01/29/21 07:38
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline OP
Newbie
strimp099  Offline OP
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
Per usual immediately after posting a question, I sorted it. Need to select the contract first so can do it a few ways

Code
	int i;
	for (i = 1; i <= NumContracts; i++)
	{
		
		contract(i);
		
		printf("\n%f - %f",ContractBid,ContractAsk);
	}


or

Code
	int i;
	for (i = 0; i < NumContracts; i++)
	{
		CONTRACT* C = &Contracts[i];
		
		contract(C);
		
		printf("\n%f - %f",ContractBid,ContractAsk);
	}


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1