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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Working...
    X