NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 11-03-2010, 02:18 AM   #1
BillyRayValentine
Junior Member
 
Join Date: Sep 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 0 times in 0 posts
Default Obtain timeframe and instrument data within strategy

I did a forum search but couldnt find an answer to this....

Is there a way to obtain the timeframe and the type of instrument (forex pair) from within a strategy or indicator?
I want my strategy to use preset default values (for MA as an example) depending on the currency pair that the strategy has been applied to and also the timeframe (number of days or mins).

Thanks
Last edited by BillyRayValentine; 11-03-2010 at 02:23 AM.
BillyRayValentine is offline  
Reply With Quote
Old 11-03-2010, 03:39 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

BillyRayValentine, yes you can work with BarsPeriod Id and Value to access this info in your script - http://www.ninjatrader-support.com/H...arsPeriod.html

For the instrument, you can work with the properties of the Instrument Class then - http://www.ninjatrader-support.com/H...mentClass.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-03-2010, 04:04 AM   #3
BillyRayValentine
Junior Member
 
Join Date: Sep 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 0 times in 0 posts
Default

Excellent, thank you!

A question regarding BarsPeriod;
What is the difference between BarsPeriod.BasePeriodType and BarsPeriod.Id?
BillyRayValentine is offline  
Reply With Quote
Old 11-03-2010, 04:09 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

You're welcome - this would be relevant for NT7 as this denotes the PeriodType that the newly added chart types would be build from - http://www.ninjatrader.com/support/h...barsperiod.htm
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Tags
timeframe

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Instrument / Timeframe within Indicator r2kTrader Indicator Development 1 07-09-2010 11:40 AM
Multi-timeframe strategy skips lower timeframe bars at one point adamus Version 7 Beta General Questions & Bug Reports 13 07-03-2010 01:36 AM
Accessing Instrument on Different Timeframe FatCanary Strategy Development 18 05-10-2010 03:53 PM
Daily data - multi timeframe strategy drolles Strategy Development 1 06-02-2009 10:56 AM
How to get higher timeframe data to make entry decision at lower timeframe? cunparis Strategy Development 1 03-11-2009 12:41 PM


All times are GMT -6. The time now is 08:01 PM.