Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Indicator values from different time frames
Collapse
X
-
Hello m96gran,
Thank you for writing in.
It is possible for your script to reference the Stochastic value of two different series.
You will need to ensure that you add the desired time frames to your script. You can then pass them into the Stochastics indicator.
More information about working with multi-series scripts can be found here: https://ninjatrader.com/support/help...nstruments.htm
Here's an example:
Code:protected override void Initialize() { // adding a 10 minute series of the same instrument to the script Add(PeriodType.Minute, 10); } protected override void OnBarUpdate() { // make sure that all series contain enough bars before beginning // this is checking to see that each series contains at least one bar if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return; // in my example, I just want the stochastics D value of the primary series to be printed if the primary series is calling OnBarUpdate() and the stochastics D value of the secondary series to be printed if the secondary series is calling OnBarUpdate() if (BarsInProgress == 0) Print(Stochastics(BarsArray[0], 3, 14, 7).K[0]; if (BarsInProgress == 1) Print(Stochastics(BarsArray[1], 3, 14, 7).K[0]; }
Zachary G.NinjaTrader Customer Service
-
Hello m96gran,
We do have resources to help you begin creating NinjaScript Strategies/Indicators.
The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.
I'm also providing a link to a pre-recorded set of videos 'Strategy Wizard 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
Strategy Wizard 301
NinjaScript Editor 401
There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)
We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
Click here to see our NinjaScript Reference Samples
Click here to see our NinjaScript Tips
These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.
Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
Alphabetical Reference
We also have a few tutorials in our help guide for both Indicators and Strategies.
Indicator tutorials
Strategy tutorialsZachary G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by samish18, Today, 08:31 AM
|
1 response
1 view
0 likes
|
Last Post Today, 08:49 AM | ||
Started by Creamers, 09-08-2023, 10:26 AM
|
6 responses
157 views
0 likes
|
Last Post
by JonyGurt
Today, 08:48 AM
|
||
Started by funk10101, Today, 08:14 AM
|
1 response
2 views
0 likes
|
Last Post Today, 08:44 AM | ||
Started by trilliantrader, Today, 08:16 AM
|
2 responses
6 views
0 likes
|
Last Post Today, 08:51 AM | ||
Started by bill2023, Yesterday, 08:51 AM
|
3 responses
22 views
0 likes
|
Last Post
by bltdavid
Today, 08:42 AM
|
Comment