NexusFi: Find Your Edge


Home Menu

 





Need help with plotting behavior of NT8 indicator


Discussion in NinjaTrader

Updated
    1. trending_up 946 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 3 attachments




 
Search this Thread
  #1 (permalink)
loxacali
Orlando, FL
 
Posts: 2 since May 2024
Thanks Given: 1
Thanks Received: 1

Hi all,

Trying my hand at developing a NT8 Supertrend indicator that mirrors the version found on TradingView. I've tried the TSSuperTrend indicator, which supposedly was converted from an equivalent in NT7, but found that it had some unusual properties not found in the standard Supertrend indicator that made it differ considerably from the TV one I've been used to using - some SMA smoothing and other such things.

I've got most of the core functionality down, but I'm running into an issue with the final plot behavior. I've been given to understand (from reading other indicators) that to "turn off" a plot for a span of bars one fills the points with NaNs, but this puts an unusual characteristic artifact to the indicator (see first photo below) - namely, that NT8 appears to render NaNs as equal to infinity (or something of that sort). I need help adjusting my final code so that rather than plotting these "artifacts", each Supertrend series simply does not plot at the respective times. I've included the source code as well as a TradingView screenshot of the final behavior I'm looking to achieve.

Thanks in advance,
loxacali

Attached Thumbnails
Click image for larger version

Name:	Screenshot 2024-05-23 020637.png
Views:	28
Size:	33.9 KB
ID:	339696   Click image for larger version

Name:	CL1!_2024-05-23_02-05-33_dd5cd.png
Views:	25
Size:	133.4 KB
ID:	339697  
Attached Files
Elite Membership required to download: SuperTrend.cs
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Radarscreen
TradeStation
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Has anyone taken trading from Agnieska Wood - Ahead Coach?
Psychology and Money Management
How reliable is ninjatrader 8?
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
ApexTraderFunding.com experience and review
141 thanks
1 Minute Man
64 thanks
HumbleTraders next chapter
35 thanks
GFIs1 1 DAX trade per day journal
24 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
23 thanks
  #2 (permalink)
 sevensa 
Singapore, Singapore
 
Experience: Intermediate
Platform: Sierra Chart/IB, NT, TS
Trading: NQ, Weekly Options
Frequency: Several times daily
Duration: Hours
Posts: 59 since Aug 2017
Thanks Given: 52
Thanks Received: 100


loxacali View Post
Hi all,

Trying my hand at developing a NT8 Supertrend indicator that mirrors the version found on TradingView. I've tried the TSSuperTrend indicator, which supposedly was converted from an equivalent in NT7, but found that it had some unusual properties not found in the standard Supertrend indicator that made it differ considerably from the TV one I've been used to using - some SMA smoothing and other such things.

I've got most of the core functionality down, but I'm running into an issue with the final plot behavior. I've been given to understand (from reading other indicators) that to "turn off" a plot for a span of bars one fills the points with NaNs, but this puts an unusual characteristic artifact to the indicator (see first photo below) - namely, that NT8 appears to render NaNs as equal to infinity (or something of that sort). I need help adjusting my final code so that rather than plotting these "artifacts", each Supertrend series simply does not plot at the respective times. I've included the source code as well as a TradingView screenshot of the final behavior I'm looking to achieve.

Thanks in advance,
loxacali

I haven't tested it, but I think you should simply assign nothing instead of double.NaN. For example, this might work:

if (direction < 0) Values[0][0] = superTrend[0];
if (direction > 0) Values[1][0] = superTrend[0];

Reply With Quote
Thanked by:
  #3 (permalink)
loxacali
Orlando, FL
 
Posts: 2 since May 2024
Thanks Given: 1
Thanks Received: 1



sevensa View Post
I haven't tested it, but I think you should simply assign nothing instead of double.NaN. For example, this might work:

if (direction < 0) Values[0][0] = superTrend[0];
if (direction > 0) Values[1][0] = superTrend[0];

That did the trick! I know I had pondered the one-legged form of the assignment, but I wasn't sure how well that would play with the NT Series datatype. Sometimes, ideas require talking out.

Thanks for the much-needed hand!

Reply With Quote
Thanked by:




Last Updated on May 23, 2024


© 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