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

Double position contracts for the next Entry when Stop loss hitted

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

    Double position contracts for the next Entry when Stop loss hitted

    Hi,


    The thing is I am trying to make a counter so that when a stop loss is hitted, Add +1 to the counter and then in the next entry double the contracts for this entry, if it hit the stop loss again, add +1 and double the contracts, so that I can set a limit of Stop losses that I can handle + double my contracts for the every next entry.

    Every day I want to set the counter to 0, and the initial contracts like the strategy settings (default is 1 contract).

    Here Whats I made, but it doesnt update the contracts I dont know why...See the image for better understanding... How can I acomplish this? I did something wrong?


    Code:
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    {
    
    if (Bars.IsFirstBarOfSession)
    {
    counterLong = 0;
    counterShort = 0;
    Ncontratos_trade1 = 1;
    Ncontratos_trade2 = 1;
    }
    
    if ((execution.Order.Name == "StopLong1")
    && (Ncontratos_trade1 == 1))
    {
    counterLong = counterLong++;
    Ncontratos_trade1 = (counterLong * 2);
    Ncontratos_trade2 = (counterLong * 2);
    }
    
    if ((execution.Order.Name == "StopShort1")
    && (Ncontratos_trade1 == 1))
    {
    counterShort = counterShort++;
    Ncontratos_trade1 = (counterShort * 2);
    Ncontratos_trade2 = (counterShort * 2);
    }
    
    }
    ​
    Here the code for the entries:

    Code:
    
    Protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    
    if (CurrentBars[0] < 1)
    return;
    
    // Set 1
    if ((RangoHighLowBROKOLI1.HighestHigh[0] != 0)
    && (RangoHighLowBROKOLI1.LowestLow[0] != 0))
    {
    Draw.FibonacciRetracements(this, Convert.ToString(Bars.IsFirstBarOfSession), false, 0, RangoHighLowBROKOLI1.HighestHigh[0], 0, RangoHighLowBROKOLI1.LowestLow[0]);
    
    Draw.Rectangle (this, "Rectangle", false, HoraInicio, RangoHighLowBROKOLI1.HighestHigh[0], HoraFin, RangoHighLowBROKOLI1.LowestLow[0], Brushes.Transparent, Brushes.Yellow, 20);
    }
    
    
    [HASHTAG="t3322"]region[/HASHTAG] Entradas
    
    [HASHTAG="t3322"]region[/HASHTAG] 1 CONTRATO
    
    /* When our indicator gives us a bull signal we enter long. Notice that we are accessing the
    public BoolSeries we made in the indicator. */
    if (GetCurrentAsk(0) >= RangoHighLowBROKOLI1.HighestHigh[0]
    && (GetCurrentBid(0) >= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Open[0] <= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Open[1] <= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Close[1] <= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Open[1] >= RangoHighLowBROKOLI1.LowestLow[0])
    && (Close[1] >= RangoHighLowBROKOLI1.LowestLow[0])
    && (Trade_1 == true)
    && (Trade_2 == false)
    && (Buy_activar == true)
    )
    
    {
    EnterLong(Ncontratos_trade1, @"EntryLong1");
    
    ProfitLong1 = Instrument.MasterInstrument.RoundToTickSize(RangoH ighLowBROKOLI1.HighestHigh[0] + ((RangoHighLowBROKOLI1.HighestHigh[0]-RangoHighLowBROKOLI1.LowestLow[0])*Porcentaje_fibo_TP1/100));
    
    }
    
    // When our indicator gives us a bear signal we enter shor t
    if (GetCurrentBid(0) <= RangoHighLowBROKOLI1.LowestLow[0]
    && (GetCurrentAsk(0) <= RangoHighLowBROKOLI1.LowestLow[0])
    && (Open[0] >= RangoHighLowBROKOLI1.LowestLow[0])
    && (Open[1] >= RangoHighLowBROKOLI1.LowestLow[0])
    && (Close[1] >= RangoHighLowBROKOLI1.LowestLow[0])
    && (Open[1] <= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Close[1] <= RangoHighLowBROKOLI1.HighestHigh[0])
    && (Trade_1 == true)
    && (Trade_2 == false)
    && (Sell_activar == true)
    )
    
    {
    EnterShort(Ncontratos_trade1, @"EntryShort1");
    
    ProfitShort1 = Instrument.MasterInstrument.RoundToTickSize(RangoH ighLowBROKOLI1.LowestLow[0] - ((RangoHighLowBROKOLI1.HighestHigh[0]-RangoHighLowBROKOLI1.LowestLow[0])*Porcentaje_fibo_TP1/100));
    
    }
    #endregion​
    ​

    Click image for larger version

Name:	image.png
Views:	47
Size:	92.1 KB
ID:	1293662​​






    Attached Files

    #2
    Hello tradingnasdaqprueba,

    Thank you for your post.

    I suggest adding print statements to debug and understand your strategy's behavior. You could add prints before your Enter() methods that print the value for Ncontratos_trade1 so you know what value is being passed in the entry method. You should also add prints any time you are modifying that value inside of OnExecutionUpdate() to see if that logic is being hit or not. For more information about using prints for debugging, please see the following page:


    Once you have added print statements, test the strategy with the NinjaScript Output window open and then review the prints to get a better understanding of the behavior. This will help to identify the cause of the unexpected behavior so you know what needs to be modified for your strategy to behave how you expect it to.

    If you need assistance with understanding the output, you may right-click the NinjaScript Output window and select Save As to save the output to a text file. Then, you can attach the text file to your reply here.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Hi Emily,

      I made some Prints to the Code, here the code I made, it works well but not as expected... I wanted to calculate the contracts depending on the StopLosses that are read OnExecutionUpdate, the thing is it starts okey taking the initialcontracts (let say 1 contract) at the start but when I get a stop it should get 2 contracts (double), but it keeps doubling it... I don't really know why is this happening...

      I attached a Photo of the Prints so you can see What I mean. You can see here that at the 08:40 we get a Stoploss and the Actual contracts are doubled to 2 contracts, but it keeps doubling it... until 256 contracts... Why is that??? Is there a way to only double the contracts and keep it from doubling it until a new stop loss is reached...

      Here the code:


      Code:
          protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
      {
          
              #region Cobertura Automatica X2    
          
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                  && execution.Order.OrderState == OrderState.Filled
                  && (iscounting == false)
              )
          {
              counter++;
              Ncontratos_trade1 = (counter * 2);
              Ncontratos_trade2 = (counter * 2);
              iscounting = true;
      
              Print(Time[0] + " Number of STOPS are " + counter);
              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
              Print(Time[0] + " ISCOUNTING = " + iscounting);
          }
          
                  #endregion    
          
              #region Cobertura Manual
          
          
      
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 1)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura1;
                              Ncontratos_trade2 = Cobertura1;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }
          
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 2)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura2;
                              Ncontratos_trade2 = Cobertura2;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }                    
      
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 3)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura3;
                              Ncontratos_trade2 = Cobertura3;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }                        
          
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 4)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura4;
                              Ncontratos_trade2 = Cobertura4;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }
          
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 5)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura5;
                              Ncontratos_trade2 = Cobertura5;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }                    
      
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 6)
              && (counter < Cobertura_Max)    
              )
          {
              
                              Ncontratos_trade1 = Cobertura6;
                              Ncontratos_trade2 = Cobertura6;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }        
          
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 7)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura7;
                              Ncontratos_trade2 = Cobertura7;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }                    
      
              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
              && execution.Order.OrderState == OrderState.Filled
              && (Cobertura_manual == true)
              && (counter == 8)
              && (counter < Cobertura_Max)
              )
          {
              
                              Ncontratos_trade1 = Cobertura8;
                              Ncontratos_trade2 = Cobertura8;
              
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              
          }    
          
              
                  #endregion        
      
      }    
      
              #endregion    ​



      Click image for larger version

Name:	Captura de pantalla 2024-03-03 195513.png
Views:	44
Size:	27.2 KB
ID:	1294041


      Thanks a lot!!!

      Comment


        #4
        Originally posted by tradingnasdaqprueba View Post
        Hi Emily,

        I made some Prints to the Code, here the code I made, it works well but not as expected... I wanted to calculate the contracts depending on the StopLosses that are read OnExecutionUpdate, the thing is it starts okey taking the initialcontracts (let say 1 contract) at the start but when I get a stop it should get 2 contracts (double), but it keeps doubling it... I don't really know why is this happening...

        I attached a Photo of the Prints so you can see What I mean. You can see here that at the 08:40 we get a Stoploss and the Actual contracts are doubled to 2 contracts, but it keeps doubling it... until 256 contracts... Why is that??? Is there a way to only double the contracts and keep it from doubling it until a new stop loss is reached...

        Here the code:


        Code:
        protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
        {
        
        #region Cobertura Automatica X2
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (iscounting == false)
        )
        {
        counter++;
        Ncontratos_trade1 = (counter * 2);
        Ncontratos_trade2 = (counter * 2);
        iscounting = true;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        Print(Time[0] + " ISCOUNTING = " + iscounting);
        }
        
        #endregion
        
        #region Cobertura Manual
        
        
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 1)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura1;
        Ncontratos_trade2 = Cobertura1;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 2)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura2;
        Ncontratos_trade2 = Cobertura2;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 3)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura3;
        Ncontratos_trade2 = Cobertura3;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 4)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura4;
        Ncontratos_trade2 = Cobertura4;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 5)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura5;
        Ncontratos_trade2 = Cobertura5;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 6)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura6;
        Ncontratos_trade2 = Cobertura6;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 7)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura7;
        Ncontratos_trade2 = Cobertura7;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (Cobertura_manual == true)
        && (counter == 8)
        && (counter < Cobertura_Max)
        )
        {
        
        Ncontratos_trade1 = Cobertura8;
        Ncontratos_trade2 = Cobertura8;
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        
        }
        
        
        #endregion
        
        }
        
        #endregion ​



        Click image for larger version  Name:	Captura de pantalla 2024-03-03 195513.png Views:	0 Size:	27.2 KB ID:	1294041


        Thanks a lot!!!
        I suggest breaking your prints down even further, line by line, to see how the counter is being modified. For example:
        Code:
        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
        && execution.Order.OrderState == OrderState.Filled
        && (iscounting == false)
        )
        {
        Print("order name: " + execution.Order.Name + " order state: " + execution.Order.OrderState + " iscounting: " + iscounting);
        Print("initial counter value: " + counter);
        counter++;
        Print("counter++. new counter value: " + counter);
        Ncontratos_trade1 = (counter * 2);
        Print("Ncontratos_trade1: " + Ncontratos_trade1);
        Ncontratos_trade2 = (counter * 2);
        Print("Ncontratos_trade2: " + Ncontratos_trade2);
        iscounting = true;
        Print("iscounting: " + iscounting);
        
        Print(Time[0] + " Number of STOPS are " + counter);
        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
        Print(Time[0] + " ISCOUNTING = " + iscounting);
        }​
        Anywhere that your code is changing the value of Ncontratos_trade1 or Ncontratos_trade2 you should print out the value before and after modifying it, since I believe those are the values you are using in your entry conditions to determine the number of contracts in the entry. This should help you to narrow down which parts of your logic are changing those values unexpectedly so you can modify it to behave how you expect it to instead.

        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hello Emily,

          Thanks a lot fot your help but still not finding where is the error causing this...

          It's a bit confusing because if you see the first stop it counts well and double the next contracts to 2 for the next Entry, but for the third Stop it goes CRAZY until 256 Contracts...

          Could you help me to find where the error is? Not programming but just explainig how to fixi this error... I can't get it where this error comes from... Thanks a lot for the help Emily!

          Here some images for better understanding:


          Click image for larger version

Name:	image.png
Views:	35
Size:	70.4 KB
ID:	1294154

          FIRST TRADE, NO STOPS:

          Click image for larger version

Name:	image.png
Views:	31
Size:	12.2 KB
ID:	1294155

          SECOND TRADE, STOP - DOUBLE OKEY:

          Click image for larger version

Name:	image.png
Views:	31
Size:	42.8 KB
ID:	1294157​​


          SECOND TRADE, STOP - DOUBLE KEEPS DOUBLING UNTIL 256 CONTRACTS????:

          Click image for larger version

Name:	image.png
Views:	29
Size:	76.7 KB
ID:	1294158
          Attached Files

          Comment


            #6
            Hello tradingnasdaqprueba,

            Thank you for your reply.

            Are the prints that state "ACTUAL Contracts for TRADE1/TRADE2 are ___" in the Cobertura Manual region of your strategy? I suggest adding additional prints to each of those sections to differentiate which condition is being triggered rather than pasting the same print several times. For example, you could put "Cobertura Manual 1" then "Cobertura Manual 2" and so on for each line of the prints so you can see which number/print is being triggered. This will help you narrow down which condition is hit that is doubling the contracts repeatedly.

            Thank you for your time and patience.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Hello Emily,

              Lets make it easier for now, Cobertura Manual is just a boolean that multiplies the contracts with a user defined value.

              What I am using now is the Cobertura Automatica, wich is the automatic doubling of the contracts, which the actual Prints are for this option:

              Code:
              #region Cobertura Automatica X2    
                  
                      if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                          && execution.Order.OrderState == OrderState.Filled
                          && (iscounting == false)
                      )
                  {
                      
                      Print(Time[0] + "order name: " + execution.Order.Name + " order state: " + execution.Order.OrderState + " iscounting: " + iscounting);
                      Print(Time[0] + "initial counter value: " + counter);
                      counter++;
                      Print(Time[0] + "counter++. new counter value: " + counter);
                      Ncontratos_trade1 = (counter * 2);
                      Print(Time[0] + "Ncontratos_trade1: " + Ncontratos_trade1);
                      Ncontratos_trade2 = (counter * 2);
                      Print(Time[0] + "Ncontratos_trade2: " + Ncontratos_trade2);
                      iscounting = true;
                      Print(Time[0] + "iscounting: " + iscounting);
              
                      Print(Time[0] + " Number of STOPS are " + counter);
                      Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                      Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                      Print(Time[0] + " ISCOUNTING = " + iscounting);
                  }
                  
                          #endregion    ​

              Comment


                #8
                Hello tradingnasdaqprueba,

                Thank you for your reply.

                What are the results when you test with these prints? Per your previous screenshot, the section in the yellow box matches with the prints you have provided. The section highlighted in red seems to be generated from somewhere else in your code, because the prints don't match up with the snippet you provided:


                What part of your strategy is generating the prints highlighted in red? That is why I suggest adding a number to each line to differentiate which part of your script is printing these messages:
                Code:
                 Print(Time[0] + " Number of STOPS are " + counter);
                Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);​
                If you paste the same print several times, you may not know which condition is triggering the print. Each time you paste it, you should differentiate it with maybe the line number in the code or separate numbers for each time it appears:
                Code:
                // first condition that triggers these prints
                Print(Time[0] + "1st print Number of STOPS are " + counter);
                Print(Time[0] + "1st print ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                Print(Time[0] + "1st print ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);​
                
                
                // another condition that triggers these prints
                Print(Time[0] + "2nd print Number of STOPS are " + counter);
                Print(Time[0] + "2nd print ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                Print(Time[0] + "2nd print ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);​
                etc...that way you can narrow down which section of your logic is generating these prints and changing the values of Ncontratos_trade1 and Ncontratos_trade2.

                I hope this helps to clarify what I was explaining. Please add numbers to each section with these prints to differentiate them and help you to analyze your output.

                I look forward to assisting you further.
                Emily C.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Emily,

                  Thanks for your reply.

                  I have some Prints for the initial reset of the counter... but I see at the image that does not match the words starting with INITIAL...

                  I will try to change the prints of the Cobertura Manual, maybe we are getting some values from here... I will come back to you ASAP.

                  Thanks!!!


                  Code:
                  protected override void OnBarUpdate()
                  {
                  if (BarsInProgress != 0)
                  return;
                  
                  if (CurrentBars[0] < 1)
                  return;
                  
                  if (Bars.IsFirstBarOfSession)
                  
                  {
                  counter = 0;
                  Ncontratos_trade1 = InitialNcontratos_trade1;
                  Ncontratos_trade2 = InitialNcontratos_trade2;
                  
                  Print(Time[0] + " INITIAL Counter of STOPS is " + counter);
                  Print(Time[0] + " INITIAL Contracts for TRADE1 is " + Ncontratos_trade1);
                  Print(Time[0] + " INITIAL Contracts for TRADE2 is " + Ncontratos_trade2);
                  
                  }

                  Comment


                    #10
                    Hello Emily,

                    The problem is in the cobertura Manual, see image... I had to add a condition for the Cobertura Manual == false to not to calculate this...

                    if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                    && execution.Order.OrderState == OrderState.Filled
                    && (Cobertura_manual == false)
                    && (iscounting == false)
                    )

                    Thanksss!!! I will try it and come back if there is any Problems.​

                    Click image for larger version

Name:	image.png
Views:	25
Size:	44.4 KB
ID:	1294193

                    Comment


                      #11
                      Hello Emily,

                      I have problems again with the contracts... It starts really well but at some point it goes crazy and calculates initial counter at 10 and keeps doubling from here... See output image.

                      Here the code again... What could happen here??? I add a condition for the Cobertura Manual == false to not to calculate the manual mode when Cobertura automatica is selected... but it keeps going...

                      Thanks a lot for the help!!!

                      Code:
                          #region Cobertura        
                              
                              protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)​
                      
                      
                              #region Cobertura Automatica X2    
                          
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                                  && (Cobertura_manual == false)
                                  && (iscounting == false)
                              )
                          {
                              
                              Print(Time[0] + "order name: " + execution.Order.Name + " order state: " + execution.Order.OrderState + " iscounting: " + iscounting);
                              Print(Time[0] + "initial counter value: " + counter);
                              counter++;
                              Print(Time[0] + "counter++. new counter value: " + counter);
                              Ncontratos_trade1 = (counter * 2);
                              Print(Time[0] + "Ncontratos_trade1: " + Ncontratos_trade1);
                              Ncontratos_trade2 = (counter * 2);
                              Print(Time[0] + "Ncontratos_trade2: " + Ncontratos_trade2);
                              iscounting = true;
                              Print(Time[0] + "iscounting: " + iscounting);
                      
                              Print(Time[0] + " Number of STOPS are " + counter);
                              Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                              Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                              Print(Time[0] + " ISCOUNTING = " + iscounting);
                          }
                          
                                  #endregion    ​
                      
                              #region Cobertura Manual
                          
                          
                      
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                              )
                          {
                              counter++;
                              if ((counter == 1)
                              && (counter < Cobertura_Max)
                                  )
                                          {
                                              Ncontratos_trade1 = Cobertura1;
                                              Ncontratos_trade2 = Cobertura1;
                              
                                              Print(Time[0] + " Cobertura Manual 1 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 1 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 1 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                                              
                          }
                          
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                              )
                          {
                              counter++;
                              if ((counter == 2)
                              && (counter < Cobertura_Max)
                                  )        
                                      {
                                              Ncontratos_trade1 = Cobertura2;
                                              Ncontratos_trade2 = Cobertura2;
                              
                                              Print(Time[0] + " Cobertura Manual 2 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 2 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 2 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                      }        
                          }                    
                      
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                      
                              )
                          {
                              counter++;
                              if ((counter == 3)
                              && (counter < Cobertura_Max)
                                  )        
                                      {
                                              Ncontratos_trade1 = Cobertura3;
                                              Ncontratos_trade2 = Cobertura3;
                              
                                              Print(Time[0] + " Cobertura Manual 3 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 3 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 3 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                      }        
                          }                        
                          
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                              && (counter == 4)
                              && (counter < Cobertura_Max)
                              )
                          {
                              counter++;
                              if ((counter == 4)
                              && (counter < Cobertura_Max)
                                  )    
                                          {
                                              Ncontratos_trade1 = Cobertura4;
                                              Ncontratos_trade2 = Cobertura4;
                              
                                              Print(Time[0] + " Cobertura Manual 4 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 4 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 4 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }    
                          }
                          
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                      
                              )
                          {
                              counter++;
                              if ((counter == 5)
                              && (counter < Cobertura_Max)
                                  )        
                                      {
                                              Ncontratos_trade1 = Cobertura5;
                                              Ncontratos_trade2 = Cobertura5;
                              
                                              Print(Time[0] + " Cobertura Manual 5 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 5 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 5 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                      }        
                          }                    
                      
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                          
                              )
                          {
                              counter++;
                              if ((counter == 6)
                              && (counter < Cobertura_Max)
                                  )        
                                          {
                                              Ncontratos_trade1 = Cobertura6;
                                              Ncontratos_trade2 = Cobertura6;
                              
                                              Print(Time[0] + " Cobertura Manual 6 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 6 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 6 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                                              
                          }        
                          
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                      
                              )
                          {
                              counter++;
                              if ((counter == 7)
                              && (counter < Cobertura_Max)
                                  )
                                              
                                      {
                                              Ncontratos_trade1 = Cobertura7;
                                              Ncontratos_trade2 = Cobertura7;
                              
                                              Print(Time[0] + " Cobertura Manual 7 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 7 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 7 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                      }        
                          }                    
                      
                              if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                              && execution.Order.OrderState == OrderState.Filled
                              && (Cobertura_manual == true)
                      
                              )
                          {
                              counter++;
                              if ((counter == 8)
                              && (counter < Cobertura_Max)
                                  )
                                  
                                  {
                                              Ncontratos_trade1 = Cobertura8;
                                              Ncontratos_trade2 = Cobertura8;
                              
                                              Print(Time[0] + " Cobertura Manual 8 Number of STOPS are " + counter);
                                              Print(Time[0] + " Cobertura Manual 8 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                              Print(Time[0] + " Cobertura Manual 8 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                  }            
                          }    
                          
                              
                                  #endregion        ​

                      Click image for larger version

Name:	image.png
Views:	20
Size:	106.1 KB
ID:	1295775


                      Click image for larger version

Name:	image.png
Views:	28
Size:	65.8 KB
ID:	1295774

                      Comment


                        #12
                        Hello tradingnasdaqprueba,

                        Thank you for your note.

                        It seems that the prints are all triggering from the following portion of your script:
                        Code:
                        if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                        && execution.Order.OrderState == OrderState.Filled
                        && (Cobertura_manual == false)
                        && (iscounting == false)
                        )
                        {
                        
                        Print(Time[0] + "order name: " + execution.Order.Name + " order state: " + execution.Order.OrderState + " iscounting: " + iscounting);
                        Print(Time[0] + "initial counter value: " + counter);
                        counter++;
                        Print(Time[0] + "counter++. new counter value: " + counter);
                        Ncontratos_trade1 = (counter * 2);
                        Print(Time[0] + "Ncontratos_trade1: " + Ncontratos_trade1);
                        Ncontratos_trade2 = (counter * 2);
                        Print(Time[0] + "Ncontratos_trade2: " + Ncontratos_trade2);
                        iscounting = true;
                        Print(Time[0] + "iscounting: " + iscounting);
                        
                        Print(Time[0] + " Number of STOPS are " + counter);
                        Print(Time[0] + " ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                        Print(Time[0] + " ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                        Print(Time[0] + " ISCOUNTING = " + iscounting);
                        }​
                        With that said, between the 21:06 timestamp and the 21:38 timestamp the counter value seems to go up from 12 to 20. Please add additional prints anywhere in your logic that adds to the counter, such as the following:
                        Code:
                        counter++;
                        Print("Added to counter print 1. New value: " + counter);
                        
                        // next time you use counter++ in your script
                        counter++;
                        Print("Added to counter print 2. New value: " + counter);
                        This way you can see which conditions that result in incrementing the counter are being triggered and debug the behavior further from there.

                        Please let us know if we may be of further assistance.
                        Emily C.NinjaTrader Customer Service

                        Comment


                          #13
                          So... I add some prints to every Counter++ and it seems that I get the counts from the Manual Entries... (ENTRADA MANUAL), I dont know why is doing this because I set a Boolean that is false when working with the Automatic calculation mode (Cobertura Automatica) and True for the Manual Calc...

                          Do you have an idea why is working this way, any idea how can I prevent this?

                          Code:
                          
                          //Cobertura Automatica
                          
                          if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                          && execution.Order.OrderState == OrderState.Filled
                          [COLOR=#16a085][B]&& (Cobertura_manual == false)[/B][/COLOR]
                          && (iscounting == false)
                          
                          
                          
                          //Cobertura Manual
                          
                          ​if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                               [COLOR=#4e5f70]  [/COLOR][COLOR=#2980b9][B]&& (Cobertura_manual == true)[/B][/COLOR]
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 1 counter++. new counter value: " + counter);
                                  if ((counter == 1)
                                  && (counter < Cobertura_Max)
                                      )
                                              {
                                                  Ncontratos_trade1 = Cobertura1;
                                                  Ncontratos_trade2 = Cobertura1;
                                  
                                                  Print(Time[0] + " Cobertura Manual 1 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 1 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 1 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                              }        
                                                  
                              }
                              
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                          [COLOR=#2980b9][B]        && (Cobertura_manual == true)[/B][/COLOR]
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 2 counter++. new counter value: " + counter);
                                  if ((counter == 2)
                                  && (counter < Cobertura_Max)
                                      )        
                                          {
                                                  Ncontratos_trade1 = Cobertura2;
                                                  Ncontratos_trade2 = Cobertura2;
                                  
                                                  Print(Time[0] + " Cobertura Manual 2 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 2 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 2 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                              }                    
                          
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                          [B][COLOR=#2980b9]        && (Cobertura_manual == true)[/COLOR][/B]
                          
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 3 counter++. new counter value: " + counter);
                                  if ((counter == 3)
                                  && (counter < Cobertura_Max)
                                      )        
                                          {
                                                  Ncontratos_trade1 = Cobertura3;
                                                  Ncontratos_trade2 = Cobertura3;
                                  
                                                  Print(Time[0] + " Cobertura Manual 3 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 3 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 3 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                              }                        
                              
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                          [COLOR=#2980b9][B]        && (Cobertura_manual == true)[/B][/COLOR]
                          
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 4 counter++. new counter value: " + counter);
                                  if ((counter == 4)
                                  && (counter < Cobertura_Max)
                                      )    
                                              {
                                                  Ncontratos_trade1 = Cobertura4;
                                                  Ncontratos_trade2 = Cobertura4;
                                  
                                                  Print(Time[0] + " Cobertura Manual 4 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 4 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 4 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                              }    
                              }
                              
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                           [B][COLOR=#2980b9]       && (Cobertura_manual == true)[/COLOR][/B]
                          
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 5 counter++. new counter value: " + counter);
                                  if ((counter == 5)
                                  && (counter < Cobertura_Max)
                                      )        
                                          {
                                                  Ncontratos_trade1 = Cobertura5;
                                                  Ncontratos_trade2 = Cobertura5;
                                  
                                                  Print(Time[0] + " Cobertura Manual 5 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 5 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 5 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                              }                    
                          
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                          [COLOR=#2980b9][B]        && (Cobertura_manual == true)[/B][/COLOR]
                              
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 6 counter++. new counter value: " + counter);
                                  if ((counter == 6)
                                  && (counter < Cobertura_Max)
                                      )        
                                              {
                                                  Ncontratos_trade1 = Cobertura6;
                                                  Ncontratos_trade2 = Cobertura6;
                                  
                                                  Print(Time[0] + " Cobertura Manual 6 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 6 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 6 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                              }        
                                                  
                              }        
                              
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                           [COLOR=#2980b9][B]       && (Cobertura_manual == true)[/B][/COLOR]
                          
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 7 counter++. new counter value: " + counter);
                                  if ((counter == 7)
                                  && (counter < Cobertura_Max)
                                      )
                                                  
                                          {
                                                  Ncontratos_trade1 = Cobertura7;
                                                  Ncontratos_trade2 = Cobertura7;
                                  
                                                  Print(Time[0] + " Cobertura Manual 7 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 7 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 7 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                          }        
                              }                    
                          
                                  if ((execution.Order.Name == "StopLong1") || (execution.Order.Name == "StopShort1")
                                  && execution.Order.OrderState == OrderState.Filled
                          [B][COLOR=#2980b9]        && (Cobertura_manual == true)[/COLOR][/B]
                          
                                  )
                              {
                                  counter++;
                                  Print(Time[0] + "Cobertura Manual 8 counter++. new counter value: " + counter);
                                  if ((counter == 8)
                                  && (counter < Cobertura_Max)
                                      )
                                      
                                      {
                                                  Ncontratos_trade1 = Cobertura8;
                                                  Ncontratos_trade2 = Cobertura8;
                                  
                                                  Print(Time[0] + " Cobertura Manual 8 Number of STOPS are " + counter);
                                                  Print(Time[0] + " Cobertura Manual 8 ACTUAL Contracts for TRADE1 are " + Ncontratos_trade1);
                                                  Print(Time[0] + " Cobertura Manual 8 ACTUAL Contracts for TRADE2 are " + Ncontratos_trade2);
                                      }            
                              }    
                              
                                  
                                      #endregion        ​
                          ​


                          Click image for larger version

Name:	image.png
Views:	20
Size:	74.6 KB
ID:	1295857

                          Comment


                            #14
                            Hello tradingnasdaqprueba,

                            Thank you for your reply.

                            Just as a note, trying to put bold font inside of a code block does not work on the forum. I suggest adding a print both inside and outside of each condition that is triggering the int to increment and print all of the values used in the condition. Especially the bool, to see if it is set to true or false and why.

                            Thank you for your time and patience.
                            Emily C.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi Emily,

                              Everything is set to false... I dont undestand...

                              Click image for larger version

Name:	image.png
Views:	14
Size:	101.7 KB
ID:	1295948

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pibrew, Today, 06:37 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post pibrew
                              by pibrew
                               
                              Started by rbeckmann05, Yesterday, 06:48 PM
                              1 response
                              14 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
                              11 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              16 views
                              0 likes
                              Last Post AaronKoRn  
                              Working...
                              X