Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trend Bars for Ninja

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

    Trend Bars for Ninja

    Hi

    Wonder if you Ninja .NET developers out there can help me translate the following TS code to Ninja

    Code:
    Inputs:
    Price(Close),
    Length1(13),
    Length2(34),
    Length3(89),
    UpLevel(35),
    MidLevel(0),
    LwrLevel(-35);
     
    Value1 = jthma(Price,Length1);
    Value2 = jthma(Price,Length2);
    Value3 = jthma(Price,Length3);
    if Value1 > Value1[1] then Plot1(UpLevel,"UpLevel", Green) else Plot1(UpLevel,"UpLevel", Red);
    if Value2 > Value2[1] then Plot2(MidLevel,"MidLevel" ,Green) else Plot2(MidLevel,"MidLevel" ,Red);
    if Value3 > Value3[1] then Plot3(LwrLevel,"LwrLevel" ,Green) else Plot3(LwrLevel,"LwrLevel" ,Red);

    The jthma function is:

    Code:
     
    Inputs: price(NumericSeries), length(NumericSimple);
    Vars: halvedLength(0), sqrRootLength(0);
     
    if ((ceiling(length / 2) - (length / 2))  <= 0.5) then
     halvedLength = ceiling(length / 2)
    else
     halvedLength = floor(length / 2);
    if ((ceiling(SquareRoot(length)) - SquareRoot(length))  <= 0.5) then
     sqrRootLength = ceiling(SquareRoot(length))
    else
     sqrRootLength = floor(SquareRoot(length));
    Value1 = 2 * WAverage(price, halvedLength);
    Value2 = WAverage(price, length);
    Value3 = WAverage((Value1 - Value2), sqrRootLength);
     
    jtHMA = Value3;
    I hope someone can help me out, the output should show something like:



    Many thanks
    NM

    #2
    ninjamouse,

    As a last resort you can also try one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Here it is

      Enjoy. It is not optimized yet. The code was easy to convert if I use drawdot(). But I use override Plot() instead and it took me much longer than I thought. May be someone can help me optimized the override Plot() for me.
      Attached Files

      Comment


        #4
        Thankyou so much rurimoon for taking some time over the weekend just to help me out, thats very kind of you. Really appricate your help!!

        I've just loaded it, and it looks FAB!!!!!

        THANKYOU AGAIN rurimoon

        Take care

        Comment

        Latest Posts

        Collapse

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