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

Problems developing a Low Lag TEMA

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

    Problems developing a Low Lag TEMA

    Hi, everyone,

    I'm somewhat new to Ninjascript and have been trying to port the following TraderStudio code over to Ninjascript but so far it's not working. It's a lag adjusted TEMA. Here's the TraderStudio code:

    Function ZL_TEMA(TEMA1 As BarArray, Length, OffSet) As BarArray
    Dim TEMA2 As BarArray
    Dim Diff
    TEMA2 = TEMA(TEMA1, Length, OffSet)
    Diff = TEMA1 - TEMA2
    ZL_TEMA = MA_TEMA1 + Diff
    End Function


    Here's the relevant section of Ninjascript:

    protected override void OnBarUpdate()
    {
    double ZL_Tema;
    double Tema2;
    double Diff;
    int i;

    if (CurrentBar < period) return;

    for(i = 0; i < period; i++)
    {

    Tema1.Set( i, TEMA( period )[i] );

    }
    Tema2 = TEMA( Tema1, period )[0];
    Diff = Tema1[0] - Tema2;
    ZL_Tema = SMA(Tema1, period)[0] + Diff;


    CenterLine.Set(ZL_Tema);
    }


    Nothing is showing up on the chart for the indicator even though it compiles fine. It's not clear to me how to debug indicator values with the Print() function, and I'm not even sure I have this code converted correctly.

    #2
    The ZerolagTEMA is available for NinjaTrader. I have attached the code.
    Attached Files

    Comment


      #3
      Hello YngvaiMalmsteve,
      As Harry has posted there is an existing ZerolagTEMA that other users have made. I would recommend taking a look at it as this may be exactly what you are looking for.
      If it is not I am more than happy to assist with working with you on getting your code.
      Is the example that you have provided below an example from your NinjaScript Code? If not please provide what you have done with the NinjaScript Code.
      Cody B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by Harry View Post
        The ZerolagTEMA is available for NinjaTrader. I have attached the code.
        Thank you! Yes this helps a lot.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by traderqz, Today, 12:06 AM
        10 responses
        18 views
        0 likes
        Last Post traderqz  
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        46 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by arvidvanstaey, Today, 02:19 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        9 views
        0 likes
        Last Post f.saeidi  
        Working...
        X