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 (Quad, aliswee), 835 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
How to use end of data in live trading #466612
06/23/17 16:45
06/23/17 16:45
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline OP
Newbie
stephane97490  Offline OP
Newbie
S

Joined: Jun 2016
Posts: 30
france
Hi everybody ,
I have some difficulty for implementing a live trading. I have a solution to the problem but It requires to use R. So It's not a efficient solution. First of all, suppose you have the the strategy below :
function run()
{
StartDate = 20110101;
EndDate = 20171231;
BarPeriod = 60*24; //
LookBack = 600;

set(PRELOAD|LOGFILE|PLOTNOW);
assetHistory("^GSPC",FROM_AV);
asset("^GSPC");
PlotHeight1 = 800; // height of the chart with results
PlotWidth = 2000;

/////////////////////////////////
vars Price = series(priceClose());
vars high=series(priceHigh());
vars low=series(priceLow());
vars zerolag=series(KAMA(Price,10));
vars fastema = series(EMA(Price,50));
vars slowema = series(EMA(Price,80));

asset("SPX500");
if(fastema[0]>slowema[0])
{
enterLong();

}

if(fastema[0]<slowema[0])
{
exitLong();

}


}


I use it for backtest, and it's working but It's not the case in live trading (no asset data for ^GSPC).
I've said that , there is a solution to solve it : the use of R. I call R via the script and I do all calculation in R, and I retrieve the signal for trading. In real case, if I have a lot of calculation, and multiple account to manage. It's became hard to do this.

So can you give me some advise or suggestion to solve my problems without using R .
THANKS FOR YOUR HELP !! :-)

Re: How to use end of data in live trading [Re: stephane97490] #466630
06/24/17 14:46
06/24/17 14:46
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Is ^GSPC in your asset list?

Re: How to use end of data in live trading [Re: Spirit] #466662
06/26/17 19:09
06/26/17 19:09
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline OP
Newbie
stephane97490  Offline OP
Newbie
S

Joined: Jun 2016
Posts: 30
france
i added ^GSPC in my asset list : it says :
Error 53 : ^GSPC is not unavailable at this time

But Zorro says that is possible to use external data to trade asset in the borker's user.

Re: How to use end of data in live trading [Re: stephane97490] #466684
06/27/17 12:38
06/27/17 12:38
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
^GSPC is most likely not available from IB. IB assets don't begin with a '^' character. Check if IB has that asset at all, and if so, with which name. Otherwise you could download it from Quandl, with the dataFromQuandl function. If neither IB nor Quandl have it, then we've got a problem.

Re: How to use end of data in live trading [Re: jcl] #466689
06/27/17 16:18
06/27/17 16:18
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline OP
Newbie
stephane97490  Offline OP
Newbie
S

Joined: Jun 2016
Posts: 30
france
Hi,
In fact, ^ GSPC is the ticker of the SP500 on the alpha vantage data provider. As I said, my algorithms works better with external data rather than from the broker. The best choice for me is alpha vantage. The main problem I have is to use the external data (sp500 from alpha vantage) I use to trade the fxcm sp500.
Zorro says that is possible but I don't know how to code it, I've try to use set(PRELOAD), but It isn't woking :-(

Re: How to use end of data in live trading [Re: stephane97490] #466717
06/28/17 17:23
06/28/17 17:23
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
AlphaVantage delivers historical EOD data. If you want to use that for live trading, you must download it once per day. This is a bit tricky. Call assetHistory with FROM_AV|IMMEDIATE - this works at any call and not only at trading start. Then load the resulting .t1 file into a database and get the current price from the last record.

Re: How to use end of data in live trading [Re: jcl] #466729
06/29/17 14:39
06/29/17 14:39
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline OP
Newbie
stephane97490  Offline OP
Newbie
S

Joined: Jun 2016
Posts: 30
france
Thanks,
May be, it will require more tricky , but i'd like to use 1000 records on the open, high, low and close in the data. Can i store them in priceHigh or else for example , and do the calculation ?

Re: How to use end of data in live trading [Re: stephane97490] #466741
06/30/17 08:31
06/30/17 08:31
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, with the priceSet() function, but you normally need only to set the prices of the current day. The prices of the previous days have then already been set.

Re: How to use end of data in live trading [Re: jcl] #466754
06/30/17 16:51
06/30/17 16:51
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline OP
Newbie
stephane97490  Offline OP
Newbie
S

Joined: Jun 2016
Posts: 30
france
thnaks for your help. I've looked up on the data download by alpha vantage. So it return the daily data and the last record. I've tried to use priceSet, but in live mode it returns :
Trade: model2 2017-06-30
Lookback period (145 bars)
Error 030: asset ^GSPC missing in INITRUN
Error 011: Function KAMA called with invalid parameters (no price)
Error 011: Function EMA called with invalid parameters (no price)

It seems the script won't charge the database ^GSPC.t6 in live mode.


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