Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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