Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Translating TD Ameritrade ZZ Percent Indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Translating TD Ameritrade ZZ Percent Indicator

    Hello Ninja Traders,

    I'm trying to convert a TD Ameritrade indicator into a Ninja Trader indicator but no matter how hard I try, I can never get it so I think its time I seek some help. I will leave the code to the TD Ameritrade indicator down below. If anyone has any ideas of how to translate it I would be very grateful. Thank you for your time and I hope you have an amazing day.

    Code:
    input price = close;
    input reversalAmount = 8.0;
    input showBubbles = no;
    input showLabel = no;
    
    assert(reversalAmount > 0, "'reversal amount' should be positive: " + reversalAmount);
    
    plot "ZZ%" = reference ZigZagHighLow(price, price, reversalAmount, 0, 1, 0);
    
    def zzSave = if !IsNaN("ZZ%") then price else getValue(zzSave, 1);
    def chg = (price / getValue(zzSave, 1) - 1) * 100;
    def isUp = chg >= 0;
    def isConf = AbsValue(chg) >= reversalAmount or (IsNaN(getValue("ZZ%", 1)) and getValue(isConf, 1));
    
    "ZZ%".EnableApproximation();
    "ZZ%".DefineColor("Up Trend", Color.UPTICK);
    "ZZ%".DefineColor("Down Trend", Color.DOWNTICK);
    "ZZ%".DefineColor("Undefined", Color.DARK_ORANGE);
    "ZZ%".AssignValueColor(if !isConf then "ZZ%".color("Undefined") else if isUp then "ZZ%".color("Up Trend") else "ZZ%".color("Down Trend"));
    
    DefineGlobalColor("Unconfirmed", Color.DARK_ORANGE);
    DefineGlobalColor("Up", Color.UPTICK);
    DefineGlobalColor("Down", Color.DOWNTICK);
    
    def barNumber = barNumber();
    
    AddChartBubble(showBubbles and !IsNaN("ZZ%") and barNumber != 1, price, round(chg) + "%", if !isConf then globalColor("Unconfirmed") else if isUp then globalColor("Up") else globalColor("Down"), isUp);
    AddLabel(showLabel and barNumber != 1, (if isConf then "Confirmed " else "Unconfirmed ") + "ZigZag: " + round(chg) + "%", if !isConf then globalColor("Unconfirmed") else if isUp then globalColor("Up") else globalColor("Down"));​

    #2
    Hello jeffrybatista,

    Thank you for your post.

    Although the NinjaScript support team does not offer script conversion services, this thread will remain open in case anyone in the forum community would like to assist. You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.

    Please feel free to reach out with any questions or concerns.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    650 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X