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
2 registered members (degenerate_762, Nymphodora), 1,012 guests, and 3 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 1 of 2 1 2
Creating/using a synthetic asset #485140
01/27/22 01:06
01/27/22 01:06
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
I would like to create several synthetic assets, say, a Dollar index, Euro index, etc - and do so as:
Code
assetAdd("USD");

var prc;

while(asset(of("EUR/USD", "GBP/USD", "AUD/USD")) {
   prc+=priceC();
}

asset("USD");
priceSet(0, prc, prc,prc,prc);
This - as is - doesn't work, as Zorro requires some valid price history for "USD" (zero-length files or using #USD are not useful).

So, 2 questions:

1) is there a way to create such 'assets' on the fly without having to pre-generate some dummy t6 files? (and if not at the moment - can such a way be provided)

2) how to avoid such synthetic 'assets' being 'subscribed to' by Zorro in Live trading?

Thank you.

Re: Creating/using a synthetic asset [Re: Zheka] #485144
01/27/22 13:22
01/27/22 13:22
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
For assets with no data, use 3 empty symbols, like "!!!", in the asset list.

But if the price is completely synthetic, you need no asset at all. Just the price series.

Re: Creating/using a synthetic asset [Re: Zheka] #485147
01/27/22 14:42
01/27/22 14:42
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
I would like to use 'asset structs' for storing such synthetic price series for all the out-of-the-box convenience and seamless interface of the usual 'named' assets: accessing prices, AssetVars, etc..

I added "USD" explicitly to the asset list with "!!!" for Symbols : Zorro complains of no prices in the init run and then ignores such asset.

- I tried to create some dummy t6 files with 1 record per year -> 'not enough ticks', says Zorro, and ignores the asset

- put "!!!EUR/USD" in the Symbols field - > Zorro - for some reason - returns "USD" as SymbolHist -> and ignores such asset (i.e. the last used asset remains 'active')

Re: Creating/using a synthetic asset [Re: Zheka] #485150
01/28/22 14:01
01/28/22 14:01
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
The history symbol is the third, so it would be "!!EUR/USD" for loading the history of EUR/USD.

I think there is no symbol that can prevent a history of an asset, otherwise probably the price functions would crash when that asset is selected. "!!!" prevents live prices.

Re: Creating/using a synthetic asset [Re: Zheka] #485153
01/29/22 10:51
01/29/22 10:51
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
I believe asset("#USD") creates an asset with no history. I don't have this in the documentation so no guarantee, but I've seen it in some scripts. Try it. Otherwise, asset("") creates a dummy asset with artificial history.

Re: Creating/using a synthetic asset [Re: Zheka] #485155
01/29/22 12:13
01/29/22 12:13
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
This is mentioned in the manual and I tried it. Unfortunately, priceSet() will then not work.

@Spirit: !!EUR/USD does not work. Probably a bug because EUR/USD!! correctly recognizes SymbolTrade as EUR/USD and ! EUR/USD ! correctly gives SymbolLive as EUR/USD, but with !!EUR/USD - all 3 Symbolxx are just USD.

Also:
Quote
Symbol - Symbol(s) of the asset. Up to 3 sources and symbols can be entered for trading, live prices, and historical prices, separated by '!' exclamation marks (!trade!live!history).
seems incorrect: there should be no ! prior to the very first symbol

Quote
If several symbols are used and one of them is blank or empty (f.i. "AAPL! !"), the prices of that asset are not downloaded or retrieved from the broker. This can be used in special cases when no market data was subscribed or prices are retrieved by other means, f.i. with the assetHistory or priceQuote functions.
So, is it several or one (as in the example)?

Re: Creating/using a synthetic asset [Re: Zheka] #485156
01/29/22 13:56
01/29/22 13:56
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
A symbol "!!EUR/USD" will not trade, not get live prices, and get "EUR/USD" history from the broker. Look here:

https://manual.zorro-project.com/symbol.htm

Symbols are for brokers in live trading. Not for files on your PC. That has maybe confused you? The history files on your PC are always expected with the asset name. There is no extra symbol for "PC file names".

priceSet cannot work when an asset has no history because its purpose is to store prices in the history.

What you probably need is a dummy asset, like asset(""). A dummy asset has a history filled with default prices. You can then overwrite them.

Look in the manual, there was an example of dummy assets for the "genSine" function for artificial price curves.



Re: Creating/using a synthetic asset [Re: Zheka] #485157
01/29/22 15:51
01/29/22 15:51
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Ah, ok, i see (but !!EUR/USD still does not set SymbolHist to EUR/USD).

There can only be one 'dummy' asset, and I would like to have 5-6 'indices', for majors...Such capability should come very handy for creating bespoke stock sectors, indicators,etc.

Last edited by Zheka; 01/29/22 16:00.
Re: Creating/using a synthetic asset [Re: Zheka] #485164
01/30/22 14:10
01/30/22 14:10
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Makes sense. I've forwarded it to the developers. The undocumented "#..." asset names will become dummy assets and we will also check the SymbolHist issue.

Re: Creating/using a synthetic asset [Re: Zheka] #485165
01/30/22 16:42
01/30/22 16:42
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
"#name" does seem to be documented:
asset():
Quote
Name - The name of the asset, as in the asset list or the [Asset] selector. An empty string "" creates a dummy asset, a name beginning with '#' prevents loading price history.
Asset Lists:
Quote
The asset is ignored when the name begins with a hash character "#".
This also requires a clarification:
Quote
If several symbols are used and one of them is blank or empty (f.i. "AAPL! !"), the prices of that asset are not downloaded or retrieved from the broker.
(..is it one or several??)

Last edited by Zheka; 01/30/22 16:49.
Page 1 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