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

error en una estrategia porque sale dos veces, y una es errada.

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

  • NinjaTrader_ChrisL
    replied
    Hello Da vinci, thanks for your question.

    I am going to be using Google Translate to translate your message.

    In the managed approach, it is designed so that any Exit order will be ignored if an entry does not exist. So if you call ExitLong and the strategic position is flat, the ExitLong order will be ignored.

    You will need to add Prints to the strategy to find what's wrong. This part does not seem right to me, but this is just an assumption as I don't have full knowledge of the code:

    Code:
    ExitLong("Exitlong5", "");
    // Condition set 5.2 condicion de salida de la estrategia fallida.
    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[1] < EMA(SMALAJC)[1] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= (stop / salidasExitLargoCON))
    
    {
    ExitLong("Exitlong5", "");
    You are calling ExitLong twice here. If it continues to happen after debugging with prints, you will need to re-build the strategy and make sure it works for one Exit condition, then add the rest of the exits one by one. Also, you can check for the MarketPostition and check to make sure Position.MarketPosition is Long before calling ExitLong.

    Best regards.

    Leave a comment:


  • error en una estrategia porque sale dos veces, y una es errada.

    Cordial Saludo.


    tengo una estrategia automatizada, que tiene el siguiente problemas, cuando entra en largo, y va a cerrar la operación ___
    ____ a veces sale dos veces porque tiene varios filtros de cierre , esto hace que de nuevo entre..... pero es una entrada fallida....
    Como hago para que salgo solo una ves si tiene

    copia parte del codigo:

    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[7] < EMA(SMALAJC)[7] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= (stop / salidasExitLargoCON))

    {
    ExitLong("Exitlong4", "");
    }
    // Condition set 5.1 condicion de salida de la estrategia fallida.
    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[1] < EMA(SMALAJC)[1] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) <= - (stop / salidasIndExitFallo))

    {
    ExitLong("ExitlongFallo4", "");
    } if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[7] < EMA(SMALAJC)[7] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= (stop / salidasExitLargoCON))

    {
    ExitLong("Exitlong4", "");
    }
    // Condition set 5.1 condicion de salida de la estrategia fallida.
    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[1] < EMA(SMALAJC)[1] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) <= - (stop / salidasIndExitFallo))

    {
    ExitLong("ExitlongFallo4", "");
    }
    // Condition set 5.2 condicion de salida de la estrategia fallida.
    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[1] < EMA(SMALAJC)[1] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= (stop / salidasExitLargoCON))

    {
    ExitLong("Exitlong5", "");
    // Condition set 5.2 condicion de salida de la estrategia fallida.
    if ( EMA(SMALAJC)[0] + SMA(SMALAJC)[1] < EMA(SMALAJC)[1] + SMA(SMALAJC)[0]
    && Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= (stop / salidasExitLargoCON))

    {
    ExitLong("Exitlong5", "");

    Mil Gracias

    Leonardo Jimčnez C.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Brevo, Today, 01:45 AM
0 responses
6 views
0 likes
Last Post Brevo
by Brevo
 
Started by aussugardefender, Today, 01:07 AM
0 responses
3 views
0 likes
Last Post aussugardefender  
Started by pvincent, 06-23-2022, 12:53 PM
14 responses
242 views
0 likes
Last Post Nyman
by Nyman
 
Started by TraderG23, 12-08-2023, 07:56 AM
9 responses
384 views
1 like
Last Post Gavini
by Gavini
 
Started by oviejo, Today, 12:28 AM
0 responses
6 views
0 likes
Last Post oviejo
by oviejo
 
Working...
X