NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-15-2009, 10:51 PM   #1
epcompany
Member
 
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Default Difference Between Indicator Values Calculated in Strategy vs. Painted On Chart

Can someone please explain why I see value differences between a value returned when an indicator is called inside of a strategy and the value that can be seen when the same indicator is drawn on a chart?

Here's the code in the strategy:
psar = ParabolicSAR(psar_front,psar_middle,psar_back).Val ue[1];

I use the fist bar back as I'm calling this from the First Tick of Bar. (the [0] bar returns "0")

The values returned in this example are (see File1):

ToTime Vstrat ~Vchart
10000 3859.88 3875.0
10500 3863.71 3879.5
11000 3867.35 3883.0

11500 3870.81 3887.0
12000 3874.09 3890.5
12500 3877.21 3894.5

13000 3880.18 3892.0

The value calculated in the strategy (Vstrat) seems like it is shifted in value to the value shown in the chart (~Vchart) or the other way around.

Funny thing is if I stop running the strategy and open the indicator dialog box and hit "apply" the chart goes to the strategy-calculated values shifted by one bar. See File2.

I have the same problem with other indicators: the value returned to my strategy is different than what is simultaneously drawn on a chart. This obviously makes building strategy logic difficult as the painted indicator is not what is being internalized in the strategy.

Thanks!

Larry
Attached Images
File Type: jpg File1.jpg (89.2 KB, 12 views)
File Type: jpg File2.jpg (83.0 KB, 10 views)
Last edited by epcompany; 06-15-2009 at 10:53 PM.
epcompany is offline  
Reply With Quote
Old 06-16-2009, 05:53 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Larry, thanks for the post - please make sure you run the latest 6.5.1000.11 release version of NinjaTrader - this also contains the fixed ParabolicSAR indicator ('ParabolicSARFixed'), I would suggest retrying your strategies with this one then.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-16-2009, 12:58 PM   #3
epcompany
Member
 
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Default

Bertrand,
Thanks for the advice.

However, I was using version 1000.9 and updated to both versions 1000.10 and 1000.11. The file you reference, ParabolicSARFixed, was not in either the .10 or .11 release. The file, @ParabolicSAR.cs dated 4/27/09, was identical in all three versions. I even discarded the NinjaTader folder and did a completely new install with the old file being the one that showed up.

I noted that the release notes say that the new ParabolicSAR was released with 1000.10. It doesn't seem to be.

Is there an alternate place where NT keeps these files, like somewhere on the forum?

Thanks,

Larry
epcompany is offline  
Reply With Quote
Old 06-16-2009, 01:05 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Larry,

As you reinstall have you tried deleting your My Documents\NinjaTrader 6.5 folder? You will lose everything when you do that and you will get a fresh reinstall. Please beware that it clears everything out when you do this so backup anything you want to keep beforehand.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-16-2009, 02:43 PM   #5
epcompany
Member
 
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Default

Josh,
As I said in the previous response to Bertrand, "I even discarded the NinjaTader folder and did a completely new install with the old file being the one that showed up."

So, yes I have done what you suggest. As the problem seems to be nothing more than my needing the new .cs file for the ParabolicSAR, where else might I get it.

Thanks,

Larry
epcompany is offline  
Reply With Quote
Old 06-16-2009, 02:50 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Larry,

You have the new file if you have installed NinjaTrader 6.5.1000.10 or up. I have attached it here again for you anyways. Please replace your file and see if it works.
Attached Files
File Type: zip ParSAR.zip (6.0 KB, 11 views)
NinjaTrader_Josh is offline  
Reply With Quote
Reply

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
Difference btw Strategy on Charts & Strategy Tabs tjendra Automated Trading 5 05-13-2009 08:46 AM
How do I enable/disable order indication hanzahar Charting 1 12-20-2008 07:59 PM
hist. data difference chart vs strategy analyser nico_p Strategy Analyzer 3 03-26-2008 04:36 AM
Curious about difference loading data for chart vs strategy Pete S Historical NinjaTrader 6.5 Beta Threads 3 03-19-2008 12:43 AM
Difference between strategy run on Chart and one run from Control Center richa61416 Strategy Analyzer 6 09-23-2007 05:07 AM


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