![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#16 |
|
Member
Join Date: Oct 2011
Posts: 40
Thanks: 14
Thanked 4 times in 4 posts
|
Adam/Ryan,
need to know two things: 1. As I explained above about my MA/indicator , If I've 10 stocks (rows) and 5 columns (5m/15m...) how many instances of my indicator will be runing ?. 2. I need to run the pivot check to do a calculation but only once I need to do this, how do I control this in onBarUpdate() only once per session, if possible. here is the code I'm using as a call in the onBarUpdate() private void getPivotValue(){ if (Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP.ContainsValue(0)) { // Prints the current pivot point value pivotPP = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0]; Print(Instrument.MasterInstrument.Name+"pivot is " + pivotPP.ToString()); } }// end |
|
|
|
|
|
#17 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
1) A separate instance will be created for each instrument and interval. Looks like 50 in your case.
2) Any calculations that you need done only once per session could be done during Bars.FirstBarOfSession http://www.ninjatrader.com/support/h...rofsession.htm
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 06-13-2012 at 12:31 PM.
|
|
|
|
|
|
#18 |
|
Member
Join Date: Oct 2011
Posts: 40
Thanks: 14
Thanked 4 times in 4 posts
|
need a little help with the multi-time coding:
instead of accessing/checking with BarsInProgress flag can I use BarsPeriod.Value flag to check and process ?. |
|
|
|
|
|
#19 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Unfortunately BarsInProgress can't be substituted by checks to the BarsPeriod - you would need to know which series triggered the OnBarUpdate() call and this feedback is received with BarsInProgress.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#20 |
|
Member
Join Date: Oct 2011
Posts: 40
Thanks: 14
Thanked 4 times in 4 posts
|
all i have in my strategy to draw an arrow if it is an end of session bar. but it is only drawing for last 30 days where i have 44 days loaded in my chart.I set the lookback period to infinite, must be missing a simple thing. help
|
|
|
|
|
|
#21 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
kinshin9 - Sorry not sure. Please feel free to post a screenshot of your chart and a simple code snippet showing what you're trying to do.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#22 |
|
Member
Join Date: Oct 2011
Posts: 40
Thanks: 14
Thanked 4 times in 4 posts
|
Ryan,
here is the simple code and attached is the image, drawing Magenta down arrow at every end of the session bar starting from 7/8 until 6/21 and ignoring the earlier days. I even made look back to infinite in my strategy. here is the code: if(Bars.LastBarOfSession) DrawArrowDown("dwnarrow"+ CurrentBar , false, 0, High[0]+0.3, Color.Magenta); |
|
|
|
|
|
#23 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello kinshin9,
Please change the BarsRequired property to say 0 (zero) from the default 20 and see if you are still getting the same result or not. Please refer to our help guide to know more about it. http://www.ninjatrader.com/support/h...rsrequired.htm
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Joydeep for this post: |
|
|
|
#24 |
|
Member
Join Date: Oct 2011
Posts: 40
Thanks: 14
Thanked 4 times in 4 posts
|
thought missing something simple. thanks, it worked.
|
|
|
|
|
The following user says thank you to kinshin9 for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| high of the most recent bars | gotet0 | Automated Trading | 2 | 10-20-2011 08:37 PM |
| Best way to get PnL of most recent trade? | mgbloomfield | Automated Trading | 2 | 05-05-2008 08:26 PM |
| most recent Beta | nicko9 | Installation and Licensing | 1 | 01-24-2008 03:08 AM |
| Most recent trade | Jim-Boulder | Strategy Development | 2 | 07-16-2007 07:15 PM |
| Most Recent Occurence | NinjaTrader_Ray | General Programming | 3 | 02-19-2007 08:34 AM |