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

ninja7 indicator NT7 to NT8

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

    ninja7 indicator NT7 to NT8

    hellow, I have upgraded ninja7 to ninja8 ,there is a frequently used indicator no work in ninja8 , can you help convert it? thanks!

    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
    Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "Plot2"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Line, "Plot3"));
    Add(new Line(Color.FromKnownColor(KnownColor.DarkOliveGree n), 0, "Zero"));
    Add(new Line(Color.FromKnownColor(KnownColor.Khaki), 10, "Ten"));
    Add(new Line(Color.FromKnownColor(KnownColor.Lavender), 60, "Sixty"));

    Var1= new DataSeries(this);
    Var2 = new DataSeries(this);
    Var3= new DataSeries(this);
    Var4= new DataSeries(this);
    Var5= new DataSeries(this);
    Var6= new DataSeries(this);
    Var7= new DataSeries(this);
    Var8= new DataSeries(this);
    Var9= new DataSeries(this);
    Var10= new DataSeries(this);
    Var11= new DataSeries(this);
    Var12= new DataSeries(this);
    Var13= new DataSeries(this);
    Var14= new DataSeries(this);

    CalculateOnBarClose = true;
    Overlay = false;
    PriceTypeSupported = false;
    }

    protected override void OnBarUpdate()
    {

    if (CurrentBar < 1) return;

    Var1.Set(Volume[0]/10000);

    if( Close[0] - Close[1] >= 0 )
    {

    Var2.Set(Var1[0]);
    }
    else
    {
    Var2.Set(0);
    }

    if( Close[0] - Close[1] <= 0 )
    {

    Var4.Set(Var1[0]);
    }
    else
    {
    Var4.Set(0);
    }

    Var5.Set(SUM(Var2,8)[0] / SUM(Var4, 8)[0]);

    Var6.Set((1-1/(1+Var5[0])) * 100);

    Var7.Set(EMA(Var6, 3)[0]);

    Var8.Set(EMA(Var7, 7)[0]);

    Var9.Set(MIN(Volume, 50)[0]);

    Var10.Set(MAX(Volume, 50)[0]);

    Var11.Set(EMA(Volume, 3)[0]);

    Var12.Set((Var11[0] - Var9[0]) / (Var10[0] - Var9[0]) * 100);

    Var13.Set(EMA( Var12, 4)[0]);

    Var14.Set(EMA ( Var13, 16)[0]);


    Plot0.Set(60);
    Plot1.Set(EMA(Var13, 16)[0]);
    Plot2.Set(EMA(Var14, 16)[0]);
    Plot3.Set((Var14[0] + Var8[0]) / 2);
    Last edited by zhaofangoo; 02-24-2022, 02:41 PM.

    #2
    Hi zhaofangoo, thanks for posting.

    The original script is quite short, so I converted it for posterity. To summarize what I did: Add(new Plot.. is now AddPlot(), DataSeries are now Series<T> objects, initialized in State.DataLoaded, and anywhere you see .Set(), we set the Series<T> object at the 0 index: Var1[0] = Volume[0]/10000; //same as Var1.Set(Volume[0]/10000);

    Kindest regards,
    -ChrisL
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi zhaofangoo, thanks for posting.

      The original script is quite short, so I converted it for posterity. To summarize what I did: Add(new Plot.. is now AddPlot(), DataSeries are now Series<T> objects, initialized in State.DataLoaded, and anywhere you see .Set(), we set the Series<T> object at the 0 index: Var1[0] = Volume[0]/10000; //same as Var1.Set(Volume[0]/10000);

      Kindest regards,
      -ChrisL
      thank you very much ChrisL!

      Comment


        #4
        Originally posted by zhaofangoo View Post

        thank you very much ChrisL!
        It seems the indicator plots multiple EMA of volume and ratios of some oscillators of the volume with more EMAs, that make it a very lagging indicator. Frankly, I can not see how this indicator is frequently used as you noted, and is of any value without some description of the use.

        It would be nice if at least you explain what this indicator does and how it is used, and perhaps provide a reference that gives a detail explanation of the logic.

        Cheers!

        Comment


          #5
          Good morning ChrisL, nice of you to assist a trader. I was instructed that help of this sort isn't a service you all provide and I just needed a conversion as well https://ninjatrader.com/support/foru...ion-to-ninja-8

          Comment


            #6
            Hi Justina, Unfortunately, we are not able to convert indicators on request. We will convert indicators that serve as a good example of how to perform a conversion if they are short and quick to convert. The script you linked requires a more advanced method such as converting the Plot() method to the OnRender method. More reading on this subject can be found here:

            Chris L.NinjaTrader Customer Service

            Comment


              #7
              ok thanks for the info

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 02:12 AM
              7 responses
              28 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by guillembm, Yesterday, 11:25 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by junkone, 04-21-2024, 07:17 AM
              10 responses
              148 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by tsantospinto, 04-12-2024, 07:04 PM
              6 responses
              101 views
              0 likes
              Last Post tsantospinto  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              7 responses
              28 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X