NexusFi: Find Your Edge


Home Menu

 





How to programatically get value of Camarilla pivots from anaPivotZones indicator?


Discussion in NinjaTrader

Updated
    1. trending_up 3,829 views
    2. thumb_up 8 thanks given
    3. group 5 followers
    1. forum 8 posts
    2. attach_file 5 attachments




 
Search this Thread

How to programatically get value of Camarilla pivots from anaPivotZones indicator?

  #1 (permalink)
 approx 
mountain view, ca
 
Experience: Intermediate
Platform: multicharts, NT
Trading: 6E
Posts: 17 since Sep 2011
Thanks Given: 26
Thanks Received: 3

I have a hopefully straighforward question.

In NT strategy code, using Fat Tail's Pivot Zones indicator, how do I programatically get value for the various Camarilla pivot zones - R1High, R1Low, PPHigh, PPLow etc?
I can seem to plot it fine, but when I try to retrieve the values (for example, of R1High) progamatically in OnBarUpdate method, it gives me an error on the chart saying "no data found. Please reload daily data or use calcFromIntradayData"...


 
Code
 
private anaPivotZonesDailyV38 mycamarilla = null;
 
protectedoverridevoid Initialize()
{
mycamarilla = anaPivotZonesDailyV38(anaSessionCountPZD38.Second,anaPivotStylesPZD38.Camarilla,anaSessionTypePZD38.Custom,HLCCalculationMode.DailyBars,false,0,0,0); 
 
Add(mycamarilla);
}
 
protectedoverridevoid OnBarUpdate()
{
double R1High = mycamarilla.R1High[0];
}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Build trailing stop for micro index(s)
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
23 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


All pivot indicators - this includes the default pivot indicators supplied with NinjaTrader - load daily data asynchronously. If you access the pivots indicator in DailyBars mode, this asynchronous loading of daily data will not work.


This has been confirmed by NinjaTrader support, and you will find various threads on this subject in the Ninjatrader forum.


As a consequence you can only programmatically access the pivot indicators in CalcFromIntradayDatamode. I have attached a model indicator, which accesses the default pivots indicator of NinjaTrader. If you set it to DailyBars, it will display nothing. You need to set it to CalcFromIntradayData


An alternative way of loading daily data would be to use the Add() method. However, the heuristic used by NinjaTrader to add daily bars is flawed, so they will not be inserted at the correct place for all types of session templates. I have therefore not coded a pivots indicator, which use the Add() method.


Do not hesitate to come back, if you have any further questions.

Attached Files
Elite Membership required to download: PivotsAccess.zip
Reply With Quote
  #4 (permalink)
 approx 
mountain view, ca
 
Experience: Intermediate
Platform: multicharts, NT
Trading: 6E
Posts: 17 since Sep 2011
Thanks Given: 26
Thanks Received: 3

Thanks for your reply Fattails.

So, I tried changing Calculation Mode from DailyBars to CalcFromIntradayData, and you're right, I can access the Pivot info programatically.
However, the pivot values calculated using Dailybars vs CalcFromIntradayData seem way off. For example, R4High using dailybars is 1.2754 while, it is 1.2739 when using CalcFromIntradayData. Hmmm...



Started this thread Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


approx View Post
Thanks for your reply Fattails.

So, I tried changing Calculation Mode from DailyBars to CalcFromIntradayData, and you're right, I can access the Pivot info programatically.
However, the pivot values calculated using Dailybars vs CalcFromIntradayData seem way off. For example, R4High using dailybars is 1.2754 while, it is 1.2739 when using CalcFromIntradayData. Hmmm...


If the highs are different, it shows that you use a false session template. Highs and lows should be the same for daily data and intraday data, if an appropriate session template is used.

The only short coming of intraday data is that you cannot use the settlement price for futures. The settlement price cannot be retrieved from any intraday chart, because the information is simply not available. So you are limited to the use of the last traded price of the selected session.

Your high or low problem can be easily solved. Best you post a chart with the indicator applied and I will comment on it.

Reply With Quote
  #6 (permalink)
 approx 
mountain view, ca
 
Experience: Intermediate
Platform: multicharts, NT
Trading: 6E
Posts: 17 since Sep 2011
Thanks Given: 26
Thanks Received: 3

Hi FatTails,
I have attached the two screenshots. 1st is using DailyBars. 2nd is using CalcFromIntraday..
In the Dataseries for 6e, I have specified session template as "CME FX Futures ETH" - not sure if this is correct..

Attached Thumbnails
Click image for larger version

Name:	6E 03-12 (4 Range)  1_11_2012_DailyBars.jpg
Views:	204
Size:	175.2 KB
ID:	59424   Click image for larger version

Name:	6E 03-12 (4 Range)  1_11_2012_CalcIntraBar.jpg
Views:	169
Size:	175.6 KB
ID:	59425  
Started this thread Reply With Quote
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


approx View Post
Hi FatTails,
I have attached the two screenshots. 1st is using DailyBars. 2nd is using CalcFromIntraday..
In the Dataseries for 6e, I have specified session template as "CME FX Futures ETH" - not sure if this is correct..

Your templates are correct. The Camarilla pivots are calculated from prior day's high, low and close. In DailyBars the close is the settlement price (1.2700), whereas in CalcFromIntradayData mode it is the last traded price (1.2712).

The difference of 12 pips affects all Camarilla pivots. For example the level for R4 will be 1.2772 calculated from the settlement price, but 1.2784 calculated from the last traded price.

Also please update the indicator. Although I did not change the version number, I have made a few changes to the indicator

-> holidays entered for 2012
-> bug removed (one of the levels did not plot as range but as line, only affected Camarilla pivots)
-> bug removed (levels Y-PRL and Y-Mid, only affected Camarilla pivots)
-> 5th level added

Reply With Quote
Thanked by:
  #8 (permalink)
 approx 
mountain view, ca
 
Experience: Intermediate
Platform: multicharts, NT
Trading: 6E
Posts: 17 since Sep 2011
Thanks Given: 26
Thanks Received: 3

Thanks. I will download the latest indicator.

So then it seems the way to get accurate camarilla pivot values that uses settlement prices would be to Add a second dataseries (daily) to the strategy and use that second dataseries in the pivots indicator...

Started this thread Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


approx View Post
Thanks. I will download the latest indicator.

So then it seems the way to get accurate camarilla pivot values that uses settlement prices would be to Add a second dataseries (daily) to the strategy and use that second dataseries in the pivots indicator...

I have not yet found a satisfactory solution. I personally use segmented session templates for 6E which divide the session into 3 segments, as some of my indicators use the opening range and/or the volatility of a specific session.

The problem with daily data is that NinjaTrader does not add it at the beginning of the trading day, but in some cases earlier (with hindsight knowledge) and in some cases later, as shown in the chart below. So I do not trust in adding data synchronously via the Add() method.

That is the reason that the pivots indicator loads it asynchronously by using a cache.

You maybe more lucky if you use an ETH template.

Attached Thumbnails
Click image for larger version

Name:	6E 03-12 (15 Min)  13_01_2012.jpg
Views:	260
Size:	90.9 KB
ID:	59540  
Attached Files
Elite Membership required to download: PriorDaySettlementSync.zip
Reply With Quote
Thanked by:




Last Updated on January 13, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts