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

hide the parameters of an ocsilator.

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

    #16
    Originally posted by NinjaTrader_Kate View Post
    Hello TraderElegante,

    Thank you for your reply.

    We in the support department cannot write your logic for you, only give examples to put you down the correct path. The example provided shows how you can basically do those calculations and assign them to plots by checking prior bars, we would expect that you would build off the example given to create your own logic.

    If you are interested in services in having the code written for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

    Please let us know if we may be of further assistance to you.
    I managed to do it but part of it draws me on line 0 because of those errors ..

    Comment


      #17
      Hello TraderElegante,

      Thank you for your reply.

      If you can provide a code snippet showing the changes you've made that aren't working for you, I would be happy to take a look and see why it might be drawing at 0.

      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_Kate View Post
        Hello TraderElegante,

        Thank you for your reply.

        If you can provide a code snippet showing the changes you've made that aren't working for you, I would be happy to take a look and see why it might be drawing at 0.

        Thanks in advance; I look forward to assisting you further.
        The one with the zero value I already solved it .. the one that I can't do is when entry> High [0] That works all right .. but when the price returns to entry <High [0] it redraws entry .. how would the logic be so that once you see that the price touches entry, it no longer starts to draw from that bar onwards ..

        if (CurrentTrend[1] == 1 && CurrentTrend[0] == 1){
        // si el precio esta por debajo del precio de entrada se sigue dibujando la linea de entrada

        if(entry >= High[0]){
        Entry[0] = entry ;
        }
        else {
        Target[0] = target ;
        }
        }

        // si la tendencia es bajista
        else if (CurrentTrend[1] == 3 && CurrentTrend[0] == 3){
        // si el precio esta por arriba del precio de entrada se sigue dibujando la linea de entrada

        if(entry <= Low[0]){
        Entry[0] = entry;
        }
        else{
        Target[0] = target ;
        }
        }

        Comment


          #19
          Hello TraderElegante,

          Thank you for your reply.

          To clarify, you're wanting to plot the Entry plot until the high price of the bar is less than the price of the entry plot or the low price is greater than the entry price, then stop plotting that to plot Target line, then when would you be plotting the entry line again? When the close price hits the target line or stop line? You could use a bool like EntryPriceHit set to false, and check that in your conditions for plotting the entry. When it starts to print the Target, flip the bool to true, and then back to false when the target price is hit.

          // declare bool at class level
          private bool EntryPriceHit = false;

          //in OnBarUpdate
          if (CurrentTrend[1] == 1 && CurrentTrend[0] == 1){
          // si el precio esta por debajo del precio de entrada se sigue dibujando la linea de entrada

          if(entry >= High[0] && EntryPriceHit == false){
          Entry[0] = entry ;
          }
          else {
          Target[0] = target ;
          EntryPriceHit = true;
          }
          }

          // si la tendencia es bajista
          else if (CurrentTrend[1] == 3 && CurrentTrend[0] == 3){
          // si el precio esta por arriba del precio de entrada se sigue dibujando la linea de entrada

          if(entry <= Low[0] && EntryPriceHit == false){
          Entry[0] = entry;
          }
          else{
          Target[0] = target ;
          EntryPriceHit = true;
          }
          }
          // reset bool when target price is hit by the current price - need to be running the script OnPriceChange to ensure this is recognized
          if (Close[0] == Target[0])
          {
          EntryPriceHit = false;
          }

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment


            #20
            [


            if (CurrentTrend [1] == 1 && CurrentTrend [0] == 1) {
            // si el precio esta por debajo del precio de entrada se sigue dibujando la línea de entrada

            if (entry> = High [0] && EntryPriceHit == verdadero) {
            Entrada [0] = entrada;
            }
            else {
            Target [0] = target;
            EntryPriceHit = true;
            }
            }

            // si la tendencia es bajista
            if (CurrentTrend [1] == 3 && CurrentTrend [0] == 3) {
            // si el precio esta arriba del precio de entrada se sigue dibujando la línea de entrada
            if (entrada <= Bajo [0] && EntryPriceHit == true) {
            Entrada [0] = entrada;

            else {
            Target [0] = target;
            EntryPriceHit = true;





            Last edited by TraderElegante; 10-22-2021, 10:03 AM.

            Comment


              #21
              Hello TraderElegante,

              Thank you for your reply.

              It appears some things in the script are getting messed up by translation, could you export the script from Tools > Export > NinjaScript Add-On? Do not check the box to export as a compiled assembly or I will not be able to review your code. Please attach the resulting .Zip file to your reply.

              Thanks in advance; I look forward to assisting you further.
              Kate W.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Kate View Post
                Hello TraderElegante,

                Thank you for your reply.

                It appears some things in the script are getting messed up by translation, could you export the script from Tools > Export > NinjaScript Add-On? Do not check the box to export as a compiled assembly or I will not be able to review your code. Please attach the resulting .Zip file to your reply.

                Thanks in advance; I look forward to assisting you further.
                here the code

                Comment


                  #23
                  Hello TraderElegante,

                  Thank you for your reply.

                  I am working on a better example but have not yet completed it yet. I'm trying to simplify your logic so the steps necessary are more clear. I should have that example on Monday.

                  Thanks in advance for your patience.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Kate View Post
                    Hello TraderElegante,

                    Thank you for your reply.

                    I am working on a better example but have not yet completed it yet. I'm trying to simplify your logic so the steps necessary are more clear. I should have that example on Monday.

                    Thanks in advance for your patience.
                    excellent thanks for your help ...

                    Comment


                      #25
                      Hello TraderElegante,

                      Thank you for your patience.

                      I've completed my example script and am attaching it below. This will plot the entry plot until the bar hits that level or the trend changes. If the price hits the level of entry plot before the trend is changed, it will then plot the target plot until the price hits that level.

                      Please let us know if we may be of further assistance to you.
                      Attached Files
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_Kate View Post
                        Hello TraderElegante,

                        Thank you for your patience.

                        I've completed my example script and am attaching it below. This will plot the entry plot until the bar hits that level or the trend changes. If the price hits the level of entry plot before the trend is changed, it will then plot the target plot until the price hits that level.

                        Please let us know if we may be of further assistance to you.
                        I have tested it and I mark so that the lines do not mark in each trend .. the period variable is a calculation only for the trend nothing more .. I clarify the doubts .. I have noticed that the target is deactivated when it touches a candle .. the target must be deactivated when there is a downward or upward trend change
                        Last edited by TraderElegante; 10-25-2021, 04:03 PM.

                        Comment


                          #27
                          Originally posted by NinjaTrader_Kate View Post
                          Hello TraderElegante,

                          Thank you for your patience.

                          I've completed my example script and am attaching it below. This will plot the entry plot until the bar hits that level or the trend changes. If the price hits the level of entry plot before the trend is changed, it will then plot the target plot until the price hits that level.

                          Please let us know if we may be of further assistance to you.
                          I already solved it .. very interesting the example .. I am new in this world learn a lot with your help .. you are a very good programmer .. thanks for the help ..

                          Comment


                            #28
                            [QUOTE = NinjaTrader_Kate; n1175472] Hola, TraderElegante,

                            Gracias por su respuesta.

                            Debería modificar algunas cosas aquí. Estoy poniendo algunas modificaciones de ejemplo en el script a continuación, pero básicamente necesitaría comentar las entradas del usuario actual para rápido y lento, y definirlas en la parte superior del script en su lugar. También querrá eliminar los valores predeterminados de estos de State.SetDefaults.

                            También querrá hacer una enumeración para que el usuario seleccione una opción, luego asigne valores para rápido y lento en función de esa selección.

                            Consulte los cambios de muestra junto con mis comentarios en el siguiente script:

                            [CÓDIGO] // Este espacio de nombres contiene Indicadores en esta carpeta y es obligatorio. No lo cambie.
                            espacio de nombres NinjaTrader.NinjaScript.Indicators
                            {
                            public class ElliotOscillator: Indicator
                            {
                            Private Series <double> fastEMA;
                            Serie privada <doble> slowEMA;
                            elliot doble privado = 0;
                            privado doble elliot3 = 0;

                            [B] // definimos rápido y lento aquí, los asignaremos en función de la enumeración seleccionada por el usuario
                            private int Fast;
                            privado int lento;

                            // agregamos la variable interna que
                            expondremos a continuación para mantener nuestro valor de enumeración privado CustomPeriodSettings.PeriodSettings myPeriodSetting; [/ B]

                            anulación protegida void OnStateChange ()
                            {
                            if (State == State.SetDefaults)
                            {




                            DisplayInDataBox = verdadero;
                            DrawOnPricePanel = true;
                            DrawHorizontalGridLines = true;







                            [B] // valores predeterminados para eliminación rápida y lenta
                            // establecer predeterminados para la selección de enumeración
                            myPeriodSetting = CustomPeriodSettings.PeriodSettings.Fast15Slow20; [/ B]

                            AddPlot (nuevo Stroke (Brushes.Black, 2), PlotStyle.Bar, "Neutral");
                            AddPlot (nuevo Stroke (Brushes.Blue, 2), PlotStyle.Bar, "UpTrend");
                            AddPlot (nuevo Stroke (Brushes.Red, 2), PlotStyle.Bar, "DownTrend");
                            AddPlot (nuevo Stroke (Brushes.Transparent, 2), PlotStyle.Line, "Elliot");
                            AddPlot (nuevo trazo (Brushes.Red, 2), PlotStyle.Line, "Elliot desplazado");

                            }
                            else if (State == State.Configure)
                            {
                            [B] // asignar rápido y lento basado en el valor de enumeración seleccionado
                            switch (MyPeriodSetting)
                            {
                            case CustomPeriodSettings.PeriodSettings.Fast15Slow20:
                            {
                            Fast = 15;
                            Lento = 20;
                            rotura;
                            }
                            case CustomPeriodSettings.PeriodSettings.Fast5Slow10:


                            Lento = 10;
                            rotura;
                            }
                            case CustomPeriodSettings.PeriodSettings.Fast10Slow15:
                            {
                            Fast = 10;
                            Lento = 15;
                            rotura;
                            }
                            } [/ B]
                            }
                            else if (State == State.DataLoaded)
                            {
                            fastEMA = new Series <double> (this);
                            slowEMA = nueva serie <doble> (este);
                            }
                            }

                            anulación protegida void OnBarUpdate ()
                            {
                            if (CurrentBar <3)
                            return;
                            if (CurrentBar == 0)
                            {
                            fastEMA [0] = (Entrada [0]);
                            slowEMA [0] = (Entrada [0]);
                            Valor [0] = (0);
                            Elliott3 [0] = (0);


                            si (SMA (100) [0]> SMA (200) [0] && SMA (20) [0]> SMA (100) [0])
                            UpTrend [0] = (0);
                            de lo contrario, si (SMA (100) [0] <SMA (200) [0] && SMA (20) [0] <SMA (100) [0])
                            Tendencia a la baja [0] = 0;
                            si no
                            Neutral [0] = (0);
                            }
                            más
                            {
                            fastEMA [0] = (SMA (Rápido) [0]);
                            slowEMA [0] = (SMA (lento) [0]);
                            elliot = ((fastEMA [0] - slowEMA [0]));
                            elliot3 = ((fastEMA [3] - slowEMA [3]));

                            Valor [0] = elliot;
                            Elliott3 [0] = elliot3;


                            si (SMA (100) [0]> SMA (200) [0] && SMA (20) [0]> SMA (100) [0])
                            UpTrend [0] = (elliot);







                            #region Properties
                            [B] // elimina las entradas del usuario para Fast y Slow - las hemos definido como variables regulares en la parte superior [/ B]

                            [B] // agrega una propiedad para que se muestren nuestros valores de enumeración y el usuario pueda elegir entre ellos
                            [ NinjaScriptProperty]
                            [Display (Name = @ "Configuración rápida / lenta", GroupName = "Parámetros", Descripción = "Elija una combinación rápida / lenta")]



                            establecer {myPeriodSetting = valor; }
                            } [/ B]

                            [Navegable (falso)]
                            [XmlIgnore ()]
                            public Series <double> Predeterminado
                            {
                            get {return Values ​​[0]; }
                            }

                            [Navegable (falso)]
                            [XmlIgnore]
                            public Series <double> Neutral
                            {
                            obtener {valores devueltos [1]; }
                            }

                            [Navegable (falso)]
                            [XmlIgnore]
                            public Series <double> UpTrend
                            {
                            get {return Values ​​[2]; }
                            }

                            [Navegable (falso)]
                            [XmlIgnore]
                            public Series <double> DownTrend
                            {
                            get {return Values ​​[3]; }





                            {
                            get {return Values ​​[4]; }
                            }
                            #endregion

                            }
                            }
                            [B] // enumeración para las selecciones, solo puede elegir entre estas, puede agregar otras adicionales a la enumeración si le gusta el
                            espacio de nombres CustomPeriodSettings
                            {
                            public enum PeriodSettings
                            {
                            Fast5Slow10,
                            Fast10Slow15,
                            Fast15Slow20
                            }







                            Hello!! I was seeing this ocsilator how you can choose the maximum high and maximum low of the ocsilator but with a minimum of x amount of bar of the histogram?
                            Last edited by Marcus07; 10-26-2021, 07:21 PM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by RookieTrader, Today, 09:37 AM
                            3 responses
                            15 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by kulwinder73, Today, 10:31 AM
                            0 responses
                            7 views
                            0 likes
                            Last Post kulwinder73  
                            Started by terofs, Yesterday, 04:18 PM
                            1 response
                            24 views
                            0 likes
                            Last Post terofs
                            by terofs
                             
                            Started by CommonWhale, Today, 09:55 AM
                            1 response
                            4 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Started by Gerik, Today, 09:40 AM
                            2 responses
                            7 views
                            0 likes
                            Last Post Gerik
                            by Gerik
                             
                            Working...
                            X