Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Indicator Development

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

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 09-13-2017, 05:19 PM   #1
KennyK
Senior Member
 
Join Date: Apr 2013
Posts: 135
Thanks: 11
Thanked 8 times in 8 posts
Default Indicator to plot behind price?

Hi,
I am guessing it's a simple thing, but I just have not been able to work it out.
I want to know how to change an indicator to plot behind price rather than in front of price.
I have played around with the obvious, these 2 lines:
IsOverlay = true;
DrawOnPricePanel = true;
But didn't achieve the desired result.

So how is it done?

Cheers,
Ken.
KennyK is offline  
Reply With Quote
Old 09-14-2017, 03:03 AM   #2
fx.practic
Senior Member
 
Join Date: Dec 2008
Location: Ukraine
Posts: 422
Thanks: 95
Thanked 42 times in 33 posts
Default

this.ZOrder = 0;
Should help.
fx.practic is offline  
Reply With Quote
Old 09-14-2017, 06:53 AM   #3
NinjaTrader_Paul
NinjaTrader Customer Service
 
NinjaTrader_Paul's Avatar
 
Join Date: May 2014
Posts: 3,126
Thanks: 361
Thanked 748 times in 723 posts
Default

Hello KennyK,

Thanks for your post.

Please see the helpguide (and example) here: http://ninjatrader.com/support/helpG...?setzorder.htm
NinjaTrader_Paul is offline  
Reply With Quote
Old 09-14-2017, 05:41 PM   #4
KennyK
Senior Member
 
Join Date: Apr 2013
Posts: 135
Thanks: 11
Thanked 8 times in 8 posts
Default

Thanks Guys,
Paul I have done what you suggested and it has not changed any thing.
This is the "OnStateChange" section:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionDarvas;
Name = "DarvasKK";
IsOverlay = true;
DrawOnPricePanel = true;
Calculate = Calculate.OnBarClose;
if (State == State.Historical)
{
// Make sure our object plots behind the chart bars
SetZOrder(-1);
}

This indicator is a copy of the NT8 Darvas, the only change I am wanting to make is for it to plot behind the bars. So if you need to look at the rest of the code you know where to find it.
Cheers,
Ken.
KennyK is offline  
Reply With Quote
Old 09-15-2017, 06:23 AM   #5
NinjaTrader_Paul
NinjaTrader Customer Service
 
NinjaTrader_Paul's Avatar
 
Join Date: May 2014
Posts: 3,126
Thanks: 361
Thanked 748 times in 723 posts
Default

Hello KennyK,

Thanks for your reply.

Please review the helpguide link previously provided on SetZorder. The example in the helpguide link shows setting in State.Historical and the notes in the link specifically advise, " Assigning specific ZOrder indices to draw at should be done once the State has reached State.Historical"

Please set the Z-order in State.Historical
NinjaTrader_Paul is offline  
Reply With Quote
Old 09-15-2017, 04:29 PM   #6
KennyK
Senior Member
 
Join Date: Apr 2013
Posts: 135
Thanks: 11
Thanked 8 times in 8 posts
Default Isn't that what I did?

Quote:
Originally Posted by NinjaTrader_Paul View Post
Hello KennyK,

Thanks for your reply.

Please review the helpguide link previously provided on SetZorder. The example in the helpguide link shows setting in State.Historical and the notes in the link specifically advise, " Assigning specific ZOrder indices to draw at should be done once the State has reached State.Historical"

Please set the Z-order in State.Historical
Isn't that what I did? I did study the help guide first and did as instructed.
Please advise?

Cheers,
Ken.
KennyK is offline  
Reply With Quote
Old 09-18-2017, 07:31 AM   #7
NinjaTrader_Paul
NinjaTrader Customer Service
 
NinjaTrader_Paul's Avatar
 
Join Date: May 2014
Posts: 3,126
Thanks: 361
Thanked 748 times in 723 posts
Default

Hello KennyK,

Thanks for your reply.

In the OnStateChange() method there is the conditional statement of:
if (State == State.SetDefaults) and the action part is what is captured between { }. The statement you added has been placed in State.SetDefaults { }.

The condition statement for State.Historical would need to be outside of State.SetDefaults {}. For example

if (State == State.SetDefaults)
{
// all of the state default action statements
}

if (State == State.Historical)
{
SetZOrder(-1);
}
NinjaTrader_Paul is offline  
Reply With Quote
Old 09-18-2017, 04:51 PM   #8
KennyK
Senior Member
 
Join Date: Apr 2013
Posts: 135
Thanks: 11
Thanked 8 times in 8 posts
Default Thanks Paul

Hey thanks Paul, that made it clear.
Works a treat now.
KennyK is offline  
Reply With Quote
The following user says thank you to KennyK for this post:
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
Plot the same indicator on Price and indicator panes? kbellare Strategy Development 1 10-05-2015 10:12 AM
Indicator to plot a line x bars forward above and below the closing price skiguy Indicator Development 4 10-27-2014 04:21 AM
Indicator plot value in a strategy returns last ( current, real time ) price BGWTEX Strategy Development 3 12-12-2010 06:54 PM
Custom price channel indicator will not plot Lawnboy Indicator Development 3 02-03-2010 08:35 PM
Single plot Price Panel Display with multiple plot indicator cclsys Indicator Development 5 11-19-2009 01:41 PM


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

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.