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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        162 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X