NinjaTrader Support Forum  

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

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-28-2011, 05:47 AM   #16
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Thanks for you reply Ryan. To clarify the erratic behaviour please take a look at these pics. Pic 1 zoomes in with a blue circle marking the indicator ray, just under the peak. At Pic 2 Iīve zoomed out. Now the ray is ABOVE the peak and far out the blue marking circle!

Pic 3 is to show the ray gets its MAX(Highs[0], lookback)[0] from the second peak. The ray placement from Pic 2 zoom remains. The blue cirkle marks to area zoomed in Pic 1 and 2.

Do you still think this is a matter of the ray ancors? All same settings, only a zooming made?!

Edit: Iīve used the code you returned, but /* excluded to mid and low rays. My question at this point isnīt the lines not beeing parallel at times.








Last edited by FREEN; 07-28-2011 at 08:16 AM.
FREEN is offline  
Reply With Quote
Old 07-28-2011, 08:35 AM   #17
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

FREEN, I tried to reproduce your issue seen here but was unfortunately unable to - when I draw a simple ray programmatically like attached zooming / changing the scale would not impact it's anchor points used for me. You can also doubleclick on the draw object and checks it's points used in the 'data' section. Would you see issues with this script as well? I was testing here for example on today's ES 09-11 1 Minute chart on the ETH sessions.

Thanks,
Attached Files
File Type: cs DrawRayTest.cs (5.0 KB, 3 views)
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-28-2011, 09:53 AM   #18
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,354
Thanks: 24
Thanked 1,304 times in 1,067 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by FREEN View Post
Thanks for your reply koganam,

Not sure I got your point. The ancorpoints derives from [y = kx + m] in wich all lines in a x/y diagram are parallel. As you say, the horizontal distances (the x value) will vary. But that wonīt affect the gradient of the rays given the same k value.

As stated in my comment #11 even one line behaves erratically when looking in different zooms and time frames. That makes me think the calculations done are right, but the chart drawing behaves strangely.

Kindly, Fredrik
Not quite correct. Take some graph paper and plot the 4 coordinates of the lines, and you will see why they cannot be parallel.

I cannot seem to be able to create a table in this editor, so I have attached a picture showing the calculations.

It would be nice if someone would show me how to create a table. My HTML did not seem to do it right.
Attached Images
File Type: png LineSlopes.png (15.1 KB, 12 views)
Last edited by koganam; 07-28-2011 at 11:17 AM.
koganam is offline  
Reply With Quote
Old 07-28-2011, 01:23 PM   #19
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Thanks Bertrand,

Well, if I remove the if statement your "DrawRayTest.cs" plots. But you pretty much hardcoded the ancorpoints, so I donīt get you point here.

I might give up on this one, but please look at this video. Iīm simply zooming in/out with [alt-up/down arrows]. Still 30 min bars on TNA.

http://www.workplanner.se/nt.wmv

As you say, [Start Y] ray properties changes at this zooming. See bellow:








So, I guess my question boils down to: Why does the anchorpoints change when the screen is redrawn (ie: at zooming)?!
Last edited by FREEN; 07-28-2011 at 01:56 PM.
FREEN is offline  
Reply With Quote
Old 07-29-2011, 09:05 AM   #20
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

FREEN, I was not able to exactly reproduce this with your script - if you print the anchors used and calc'ed by your script > would you see the same change? If you use for example a line with the same anchors same issue for you?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-29-2011, 04:01 PM   #21
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
FREEN, I was not able to exactly reproduce this with your script - if you print the anchors used and calc'ed by your script > would you see the same change? If you use for example a line with the same anchors same issue for you?
Bertrand, this video and the bellow steps answeres your question. Didnīt try the DrawLine() yet however. Are the MAX() and HighestBar() methods buggy??? It seems theyīre fed with different arrays at different zoom levels.

In video indicator is green hashed ray:

Step 1: Outzoomed - indicator loaded
Step 2: Variable anchor points confirmed in Output window
Step 3: Zoom in on second highest peak
Step 4: Step zooming -> ray jumps (changes anchorpoints in ray properties)
Step 5: Look in output window -> no changes (since indicator not reloaded)
Step 6: Reload indicator when zoomed in -> anchorpoints changes and indicator finds zoomed high instead!!!
Step 7: New anchorpoints confirmed in output window
Step 8: Zoom out -> anchorpoints changes back

Screen video on the above steps: http://www.workplanner.se/nt2.wmv
FREEN is offline  
Reply With Quote
Old 07-29-2011, 04:07 PM   #22
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

Freen, thanks for the update. We'll look into and get back to you, most likely on Monday.
NinjaTrader_Austin is offline  
Reply With Quote
Old 08-01-2011, 12:01 PM   #23
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

FREEN, at which point do you exactly apply your script to the 30 min chart you use?

Single series script would process up to the last seen bar on the chart, and only process further if you scroll ahead up to the last bar, which could influence then in turn finding of your anchor points used.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-02-2011, 10:18 AM   #24
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
FREEN, at which point do you exactly apply your script to the 30 min chart you use?
As seen in the video the indicator script is loaded first at outzoom, then reapplied at zoom in, the reapplied again when zoomed out.

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Single series script would process up to the last seen bar on the chart, and only process further if you scroll ahead up to the last bar, which could influence then in turn finding of your anchor points used.
Arenīt the script ran on the total bars loaded rather than on the bars in view?! I know thereīs methods for adapting the indicator to the bars in view, but no such methods are used in my code. Hence I expect it to run on all bars loaded.

1. Is what you see in the video expected behaviour?
2. Are you able to reproduce?
FREEN is offline  
Reply With Quote
Old 08-02-2011, 10:30 AM   #25
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

FREEN, I could unfortunately not debug your anchor point selection for you - I suggest you simplify your script to identify the point where it breaks for you - the bars loading for a single series indicator is like I mentioned : the bars are processed until the last visible data point only, as such scolling and zooming will likely change your lookback results as new data is used.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-04-2011, 04:53 AM   #26
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post

...the bars are processed until the last visible data point only, as such scolling and zooming will likely change your lookback results as new data is used.
Thanks for you patience Bertrand. That pretty much explains everything. I was convinced all bars were processed until last loaded datapoint.

Q: Is there a way to force NT to have all bars loaded processed rather than all bars up to current visible point?

Elsewise itīs pretty hard to make a reliable indicator working in retrospect rather than prospect, as most indicators do.

//Fredrik
Last edited by FREEN; 08-04-2011 at 04:55 AM.
FREEN is offline  
Reply With Quote
Old 08-04-2011, 05:07 AM   #27
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

What you can do is add another series to make this a MultiSeries script and then just return out of processing anything for this additional series. MultiSeries indicators would process all bars up to the last bar.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following 2 users say thank you to NinjaTrader_Bertrand for this post:
Old 08-04-2011, 05:12 PM   #28
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,354
Thanks: 24
Thanked 1,304 times in 1,067 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
What you can do is add another series to make this a MultiSeries script and then just return out of processing anything for this additional series. MultiSeries indicators would process all bars up to the last bar.
Nice trick. I did not know that one.
koganam is offline  
Reply With Quote
Old 08-05-2011, 09:56 PM   #29
FREEN
Senior Member
 
Join Date: Mar 2010
Location: Sweden
Posts: 123
Thanks: 6
Thanked 4 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
MultiSeries indicators would process all bars up to the last bar.
Great Bertrand, thatīs what I needed. Vielen dank und shönes wochenende!

//FREEN
FREEN 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
Horizontal Rays? ephilip Charting 3 03-01-2011 07:40 PM
Need some help with drawing rays kaywai Indicator Development 4 02-05-2011 01:33 PM
Parallel optimization jjmmg Strategy Development 1 11-12-2010 05:20 AM
re:fractal rays,shadowtraders laredo NinjaScript File Sharing Discussion 3 05-06-2010 05:37 PM
Limit the number or rays drawn pstiles Indicator Development 3 02-25-2009 05:43 AM


All times are GMT -6. The time now is 12:49 AM.