![]() |
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
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#31 |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
while not entirely intuitive, this makes sense...
and so now i would need to do the math for all of s1, r1, s2 and r2.... where can i find these formulae, either in math or in code, as NT calculates them, as I know that there are certain different methods of doing this. |
|
|
|
|
|
#32 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Andrew,
There are several ways to calculate the Pivot values. Please refer to the below site which describes the most common method to calculate the pivot points http://www.mypivots.com/articles/art...aspx?artnum=36
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#33 |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
Uing the methodology described, I went about creating my own metrics.
Day bars are indexed as 1 Variables are doubles protected override void OnBarUpdate() { high = Highs[1][0]; low = Lows[1][0]; close = Closes[1][0]; range = high - low; myPP = ((high + low + close) / 3); myR1 = (2 * myPP) - low; myR2 = myPP + range; myS1 = (2 * myPP) - high; myS2 = myPP - range; //Returns PP value pivotPoint = ((this.PriorDayOHLC().PriorClose[0] + this.PriorDayOHLC().PriorHigh[0] + this.PriorDayOHLC().PriorLow[0]) / 3); //Returns R1 value resistance1 = ((2 * pivotPoint) - this.PriorDayOHLC().PriorLow[0]); //Returns R2 value resistance2 = pivotPoint + (this.PriorDayOHLC().PriorHigh[0] - this.PriorDayOHLC().PriorLow[0]); //Returns S1 value support1 = ((2 * pivotPoint) - this.PriorDayOHLC().PriorHigh[0]); //Returns S2 value support2 = pivotPoint - (this.PriorDayOHLC().PriorHigh[0] -this.PriorDayOHLC().PriorLow[0]); Print(Time[0].ToString() + " R2: " + resistance2.ToString() + " R1: " + resistance1.ToString() + " PP: " + pivotPoint.ToString() + " S1: " + support1.ToString() + " S2: " + support2.ToString()); Print(Time[0].ToString() + "myR2: " + myR2.ToString() + "myR1: " + myR1.ToString() + "myPP: " + myPP.ToString() + "myS1: " + myS1.ToString() + "myS2: " + myS2.ToString()); ____________________________________________ these numbers do not yield identical same pivot/support/resist numbers. at this point i am having issues with the amount of time I have spent, because I keep coding and I can not get a the numbers to match based on the manner inw hich I have been advised. This is not a complicated piece of code, please advise. Thanks, Andrew |
|
|
|
|
|
#34 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,777
Thanks: 158
Thanked 565 times in 556 posts
|
Can you please clarify who you connect to for data? This is displayed in the bottom left hand corner of the NinjaTrader Control Center.
If you disconnect from your data provider, and connect the Kinetick End of Day connection, do you get the results you are looking for?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#35 |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
I am using kinetick at all times.
|
|
|
|
|
|
#36 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello alabell,
The below code calculates the pivots based on daily bars Code:
pivotPoint = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0]; Code:
pivotPoint = ((this.PriorDayOHLC().PriorClose[0] + this.PriorDayOHLC().PriorHigh[0] + this.PriorDayOHLC().PriorLow[0]) / 3); Also please refer to this post which discusses this in details http://www.ninjatrader.com/support/f...ead.php?t=4676
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#37 |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
so now we are back to the original formulae which were quoted to me a week or two ago, so please answer this question for me:
-- If a daily bar is, as it sounds, a one day bar, with a high, low open and close like I might see in a 2 year daily chart that would have aprox. 500 bars: what is the proper definition of an intraday bar? Thank you kindly. |
|
|
|
|
|
#38 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Andrew,
Intraday bars will be the bars built from either tick data or minute data.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#39 |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
pivotPoint = ((this.PriorDayOHLC().PriorClose[0] + this.PriorDayOHLC().PriorHigh[0] + this.PriorDayOHLC().PriorLow[0]) / 3);
If the above code is built from intraday bars (minute or tick bars), are these bars then scanned to find a day's high, low and close from which to build your pivot point? alternatively, a day bar simply records a H,L,O,C for the specific date in question? is this the difference? If yes, I suppose I get it, but shouldn't they be the same? if no, then I don't understand how the above code would work to calculate "yesterday's pivot point". Thanks as always. |
|
|
|
|
|
#40 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Andrew,
OHLC calculated from intraday bar can differ from Daily bars. There are several factors like: Daily bars are generally based on RTH session while OHLC built from intraday data uses the charts session template (which can be RTH or ETH or any other custom template) to calculate the OHLC. The closing price of a daily bar is based on the volume weighted average price of the last 30 minutes. In case of intraday data it is the last traded price. The pivots will be calculated anyway, based on what data you provide. If the data set differs the pivot values too will differ.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Joydeep for this post: |
|
|
|
#41 | |
|
Senior Member
Join Date: Jun 2011
Posts: 214
Thanks: 34
Thanked 10 times in 10 posts
|
Quote:
The Close of a daily bar is the VWAP of the last half hour? I had no idea. This surprised me greatly. |
|
|
|
|
|
|
#42 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello Andrew,
To be more specific, closing price is the Settlement price in a daily bar.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pivot indicator | imagineer | Indicator Development | 1 | 06-07-2010 12:56 PM |
| pivot indicator | andrew100 | Strategy Development | 18 | 02-17-2010 07:42 AM |
| Pivot indicator | saeed | Charting | 3 | 12-22-2009 08:03 AM |
| Best pivot indicator | blazer | Indicator Development | 2 | 10-11-2009 04:12 AM |
| Pivot indicator | mballagan | Indicator Development | 6 | 10-01-2009 10:44 AM |