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 10-07-2007, 12:38 AM   #1
ts888
Member
 
Join Date: Jun 2007
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default Keltner channel offset

is there a reason the offset in the default NT Keltner channel cannot be set to <1 ? I know it does decimals because I've tried 1.25, 1.5, etc. I'm looking to have a tighter channel and would to try offsets such as .75 and .6

I assume this should be possible unless it's something in the calculation of the Keltner channel that I'm not understanding. Any suggestions on how to accomplish this? thanks
ts888 is offline  
Reply With Quote
Old 10-07-2007, 01:12 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Hi ts888,

You are correct that the default Keltner channel can take doubles as the input for the offset. The reason the default Keltner channel indicator only allows numbers greater than one is attributed to this code segment here (located in the Properties region of the code):
Code:
[Description("How much to expand the upper and lower band from the normal offset")]
[Category("Parameters")]
[Gui.Design.DisplayNameAttribute("Offset multiplier")]
public double OffsetMultiplier
{
    get { return offsetMultiplier; }
    set { offsetMultiplier = Math.Max(1, value); }
}
Notice on the 'set' line the offsetMultiplier is equal to a minimum of 1. To change the indicator to accept smaller decimals I suggest you change the 1 to a 0.
Code:
[Description("How much to expand the upper and lower band from the normal offset")]
[Category("Parameters")]
[Gui.Design.DisplayNameAttribute("Offset multiplier")]
public double OffsetMultiplier
{
    get { return offsetMultiplier; }
    set { offsetMultiplier = Math.Max(0, value); }
}
You are going to need to save the indicator as a different indicator name because the Keltner channel is a system indicator that does not allow for modifications.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-07-2007, 08:37 AM   #3
ts888
Member
 
Join Date: Jun 2007
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by Josh View Post
Hi ts888,

You are correct that the default Keltner channel can take doubles as the input for the offset. The reason the default Keltner channel indicator only allows numbers greater than one is attributed to this code segment here (located in the Properties region of the code):
Code:
[Description("How much to expand the upper and lower band from the normal offset")]
[Category("Parameters")]
[Gui.Design.DisplayNameAttribute("Offset multiplier")]
public double OffsetMultiplier
{
    get { return offsetMultiplier; }
    set { offsetMultiplier = Math.Max(1, value); }
}
Notice on the 'set' line the offsetMultiplier is equal to a minimum of 1. To change the indicator to accept smaller decimals I suggest you change the 1 to a 0.
Code:
[Description("How much to expand the upper and lower band from the normal offset")]
[Category("Parameters")]
[Gui.Design.DisplayNameAttribute("Offset multiplier")]
public double OffsetMultiplier
{
    get { return offsetMultiplier; }
    set { offsetMultiplier = Math.Max(0, value); }
}
You are going to need to save the indicator as a different indicator name because the Keltner channel is a system indicator that does not allow for modifications.
thanks Josh !! really appreciate it. Have to ask a follow up question though because I'm almost worthless in ninjascript.......how do I save it as a different indicator? I found the line in the code and assumed I'd do a "Save As" or similar to get a different name but the save icon is grayed out because of being a system indicator like you say.
ts888 is offline  
Reply With Quote
Old 10-07-2007, 08:38 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Open the indicator, right click and press "Save As..."
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-07-2007, 08:46 AM   #5
ts888
Member
 
Join Date: Jun 2007
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Open the indicator, right click and press "Save As..."
I did that and gave it new name. I then compiled and got successful message. However, I can't seem to access it in the indicators list to apply it to a chart. It is not there. Have looked through entire list. When I got back into "edit ninjascript" I can see it but for some reason it doesn't come up in the list to apply it to a chart. Is there another step I'm missing? Thanks.

I do know see 2 Keltner Channel indicators but not the one I named and neither of them allow the offset under 1 so those can't be them.
Last edited by ts888; 10-07-2007 at 08:49 AM.
ts888 is offline  
Reply With Quote
Old 10-07-2007, 08:55 AM   #6
ts888
Member
 
Join Date: Jun 2007
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by ts888 View Post
I did that and gave it new name. I then compiled and got successful message. However, I can't seem to access it in the indicators list to apply it to a chart. It is not there. Have looked through entire list. When I got back into "edit ninjascript" I can see it but for some reason it doesn't come up in the list to apply it to a chart. Is there another step I'm missing? Thanks.

I do know see 2 Keltner Channel indicators but not the one I named and neither of them allow the offset under 1 so those can't be them.
ok, apparently it is in there but only shows the new name when I add the indicator so that was the confusion.

However, the change to the code didn't appear to accomplish the task as it still forces it back to a minimum value of 1 for the offset.
ts888 is offline  
Reply With Quote
Old 10-07-2007, 09:03 AM   #7
ts888
Member
 
Join Date: Jun 2007
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by ts888 View Post
ok, apparently it is in there but only shows the new name when I add the indicator so that was the confusion.

However, the change to the code didn't appear to accomplish the task as it still forces it back to a minimum value of 1 for the offset.

actually everything working perfect now. Sorry for all the posts. Thanks for your help.
ts888 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
Keltner Channel With Shaded between the Channel prostyle NinjaScript File Sharing Discussion 9 12-28-2007 05:40 AM
2 ticks offset strategy alex12lad Automated Trading 14 08-13-2007 06:22 AM
2 ticks offset strategy alex12lad Strategy Development 1 07-22-2007 11:30 PM
Regression Channel indicator enhancement suggestion Greg1 Charting 7 07-16-2007 04:51 AM
Trend Channel rtrader Suggestions And Feedback 6 04-19-2007 05:55 AM


All times are GMT -6. The time now is 02:33 AM.