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

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.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X