SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Oct 24, 2020 12:49 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu May 12, 2011 8:11 pm 
Offline

Joined: Tue May 10, 2011 2:14 am
Posts: 23
Hello,
I am embarrassed to ask this but here it goes. How can I take a simple moving average of a particular instrument? My program uses multiple instruments but I only want the SMA of a single instrument.

SMA(Bars.name.MSFT, Period5, Color5)

I know the above code wont work but how can I reference only the MSFT bar when 5 other bars are also in the strategy? I use that study to trade other instruments. I dont trade MSFT

Thank you very much!


Top
 Profile  
 
PostPosted: Thu May 12, 2011 8:46 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

I think Strategy.GetBars(Instrument, ...) should help (check API refs).

Something like

Code:
Instrument MSFT = Instruments["MSFT"];

SMA sma = new SMA(GetBars(MSFT, ...),  ..., ...);


Regards,
Anton


Top
 Profile  
 
PostPosted: Thu May 12, 2011 9:34 pm 
Offline

Joined: Tue May 10, 2011 2:14 am
Posts: 23
That is exactly what I was looking for! Thank you so much!


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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