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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    63 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X