Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

launch a command with a button when a certain condition occurs

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

    launch a command with a button when a certain condition occurs

    Hello. I have this code that draws me a point on the fourth candle that meets a condition:

    //Código para identificar una barra por su numero. Por ejemplo que nos señale con un punto
    //cual es la cuarta barra seguida que cumple la condicion:

    {
    // Crear una variable para llevar cuenta de las barras consecutivas con cierre por debajo de la apertura
    private int consecutivasCierrePorDebajo = 0;

    // Definir el método OnBarUpdate() para manejar las actualizaciones de las barras
    protected override void OnBarUpdate()
    {
    // Verificar si el cierre está por debajo de la apertura
    if (Close[0] < Open[0])
    {
    // Incrementar la cuenta de barras consecutivas con cierre por debajo de la apertura
    consecutivasCierrePorDebajo++;

    // Verificar si hay tres barras consecutivas con cierre por debajo de la apertura
    if (consecutivasCierrePorDebajo == 3)
    {
    // Dibujar un punto amarillo debajo de la tercera barra consecutiva
    Draw.Dot(this, "MiPunto", true, 0, Low[0] - TickSize, Brushes.Yellow);
    }
    }
    else
    {
    // Reiniciar la cuenta de barras consecutivas con cierre por debajo de la apertura
    consecutivasCierrePorDebajo = 0;
    }
    }
    }
    ​Using the LongShortToolbarButtonsB9 indicator, I want that when I press the sell button, it will launch a stoplimit order when the condition of the previous code is met.
    I can't get it to work. Could you guide me? thank you.​

    #2
    Hello julifro,

    Thank you for your post.

    The LongShortToolbarButtonsB9 indicator is not something that comes with NinjaTrader by default, so if you are looking to modify it you may need to reach out to the original developer for more information on how the sell button actions could be modified.

    We have an example of submitting orders from a button click that may be found here:
    I need some guidance. I need to create a script that has 3 plots that are public and they plot either a 1 or 0. But I need to create another indicator that has 3 chart buttons that sets these variables. The first indicator needs to get those values from the second indicator depending on the button clicks. Because of using


    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X