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 RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,281 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        19 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by Tim-c, Today, 02:10 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X