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
3 registered members (AndrewAMD, Nymphodora, Quad), 919 guests, and 6 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
Asset - open other #479874
05/02/20 12:53
05/02/20 12:53
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

I have this code:

Code
function run()
{
	//StartDate = EndDate = 2020;
	LookBack = 0;
	set(TICKS|LOGFILE|PLOTNOW);
	Hedge = 2;	
	setf(TradeMode,TR_PHANTOM);   // test, what is better
	resf(BarMode, BR_WEEKEND);    // bitfinex work 7/24
	//BarPeriod = 10./60.;
	BarPeriod = 1;	  // for chart - not working?
	MaxRequests = 10./60;
	History = ".t1";
	assetList("AssetsArb.csv");
	asset(ASSET_A);
	asset(ASSET_B);
	asset(ASSET_C);
	asset(ASSET_D);
}

Code
function tick()
{
	var PriceA,PriceB,PriceC,PriceD;
	var Threshold;
	asset(ASSET_A);
		PriceA = priceClose(); 
		
	asset(ASSET_B);
		PriceB = priceClose(); 

	asset(ASSET_C);
		PriceC = priceClose();

	asset(ASSET_D);
		PriceD = priceClose();
		
	Threshold = (PriceD-PriceC); // arbitrage threshold
	
	if (isMinute()){   // after enter trade - wait 10 minute for next trade

		algo("FORBC");
			forAlgoBC(Threshold);
		algo("FORCB");
			forAlgoCB(Threshold);
		algo("FORUP");
			forAlgoUP(Threshold);
		algo("FORDN");
			forAlgoDN(Threshold);
	}
	
}

and fce for open / one from four ( all is the same - never use ASSET_A
Code
function forAlgoCB(var Threshold){
	asset(ASSET_C);
		if (Threshold > OPEN_LONG){
			printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold);
			if(NumOpenLong < NUM_OPEN)
				enterLong();
			newOrder();
		}
		if (Threshold < OPEN_SHORT){
			printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold);
			if(NumOpenShort < NUM_OPEN)
			enterShort();
			newOrder();
		}

	asset(ASSET_B);
		if (Threshold > OPEN_LONG){
			printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold);
			if(NumOpenShort < NUM_OPEN)
			enterShort();
		}
		if (Threshold < OPEN_SHORT){
			printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold);
			if(NumOpenLong < NUM_OPEN)
			enterLong();
		}
		
}




I never open trade with asset ASSET_A nad ASSET_D. But after I stop the script, and run again, I se in the log this:

Quote

{EURUSD_A:FORBC:l00165} Long 1@1.09812 at 12:44:05TIME ALGO FORBC/EURUSD_A have 54
{EURUSD_A:FORBC:s00166} Short 1@1.09812 at 12:44:05OPEN FORCB/EURUSD_A have 1.0981


where I can found the bug in the script? Maybe I need wait for full ( in minute ) before test the conditions? I don't use the ASSET_A for open trade, but is opened

thanks Milan

Last edited by Grat; 05/02/20 13:01.
Re: Asset - open other [Re: Grat] #479909
05/04/20 13:43
05/04/20 13:43
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
From what I see at quick glance, your code snippet above indeed can only open ASSET_C or B. So the problem is somewhere in the rest of the code.

Re: Asset - open other [Re: Grat] #479912
05/04/20 16:58
05/04/20 16:58
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Is problem with version 2.25.x, with 2.26 beta is all OK.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1