Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ETFVoyageur, Today, 04:00 PM
        1 response
        7 views
        0 likes
        Last Post ETFVoyageur  
        Started by AaronKTradingForum, Today, 03:44 PM
        1 response
        8 views
        0 likes
        Last Post AaronKTradingForum  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        11 responses
        77 views
        0 likes
        Last Post Felix Reichert  
        Started by junkone, 04-28-2024, 02:19 PM
        7 responses
        83 views
        1 like
        Last Post junkone
        by junkone
         
        Started by pechtri, 06-22-2023, 02:31 AM
        11 responses
        139 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Working...
        X