SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Dec 02, 2020 3:18 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Aug 07, 2020 5:00 am 
Offline

Joined: Wed Jul 01, 2020 7:19 am
Posts: 14
I have some difficulty accessing the other instrument data. Here is what I would like to do with

Using data

@ES 5 sec past
@NQ 5 sec past data

Run the strategy based on the @ES but refer the @NQ 5 sec ago data (close) to comes out with the lead-lag

Hopefully community can help me to solve this.


Top
 Profile  
 
PostPosted: Fri Aug 07, 2020 11:14 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 580
Hi takumisasakura,
I don't understand what you mean, can you please provide more details?

I think in your case you would better to use 'Strategy' type of strategy instead of 'InstrumentStrategy'. (if you want access bars of other instruments).
When you subscribe to both instruments you will receive both bars OnBar.
Then you can store them in their own BarSeries and access bars as you wish (eg: barSeries.Ago(5).Close)
You can take a look at Rebalance strategy for example.


Top
 Profile  
 
PostPosted: Fri Aug 07, 2020 5:56 pm 
Offline

Joined: Wed Jul 01, 2020 7:19 am
Posts: 14
What basically I would like to do is simply just refer some other instrument historical data (bar) to make trade decision in the instrument I am going to trade, not trading 2 instrument in the once, just I need to access the other instrument series historical data.

Example only trades @ES but use @NQ historical bar price as indicator to trade.

So what I need is the way of accessing the other instrument data during running some once instrument in scenario.
Is the "Strategy" can use as this usage as I mentioned? within the scenario putting two instrument, then it will send the 2 bar series in once, so the strategy can receive two bar data in the same event handler?

P.S
Is there any examples about FX Hedging trades? If it doesn't have please ignore.


Top
 Profile  
 
PostPosted: Mon Aug 10, 2020 10:01 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 580
You can use the method that I advised you.
However, it depends on how you use the historical data.
It may be better to direct access of necessary historical data:
Code:
DataSeries dataSeries = DataManager.GetDataSeries(instrument, DataObjectType.Bar, BarType.Time, 300);


Code:
int index1 = dataSeries.GetIndex(FirstDateTime, IndexOption.Prev);
int index2 = dataSeries.GetIndex(LastDateTime, IndexOption.Next);

            for (int i = Index1; i <= Index2; i++)
            {
                Bar bar = dataSeries[i];
            }


Top
 Profile  
 
PostPosted: Mon Aug 10, 2020 11:35 am 
Offline

Joined: Wed Jul 01, 2020 7:19 am
Posts: 14
Thank you very much for your help.
Really appreciate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group