Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Decimals

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

    Decimals

    Hi,

    I have in all my strategies this code:

    else if ((Closes[2][0] > 20.00) && (Closes[2][0] <= 30.00))
    {
    - Set parametres to values depending on VIX last session close value.
    }
    As far as I debugged my strategies I checked that Closes[2][0] (ViX last session close value) has two decimals. For that reason I compare in the "if" sentence using 20.00 and 30.00.

    However, when usign real time, parameters are set not considering those decimals. For example, on Friday vix close at 20.97, meaning that on Monday parameters should had been set using 20.00-30.00 range but they did not. They use vix < 20.00 parameters.

    Is there any way to ensure that strategies compare using that two decimals??

    Thanks in advance,

    Fernando

    #2
    Hi Fernando, thanks for the post - I don't see a reason why the decimals handling should be different comparing historical vs realtime processing. From which BarsInProgress do you access those values?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      From barsInProgress 2.

      Regards,

      Fernando

      Comment


        #4
        Hello Fernando,

        We would need to look at the logic of the code, can you provide the script or a toy version of the code that reproduces the same unwanted behavior?

        Comment


          #5
          Hi Patrick,

          Please find below part of the script when is comparing vix data.

          protected override void Initialize()
          {
          CalculateOnBarClose = true;
          Add(PeriodType.Minute,1440);
          Add("^VIX",PeriodType.Day,1);
          /*SyncAccountPosition = true;*/
          TraceOrders = true;
          Vendido = false;
          Entradas = 0.0;
          }

          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          if ((CurrentBars[0] < 1)||(CurrentBars[1] < 1)||(CurrentBars[2] < 1))
          {
          return;
          }
          if (Closes[2][0] <= 20.00)
          {
          contratos = 1;
          periodo = 8;
          gananciasDebajo = 44.0;
          stopGananciasDebajo= 8.0;
          stopLoss=77.0;
          }
          else if ((Closes[2][0] > 20.00) && (Closes[2][0] <= 30.00))
          {
          contratos = 1;
          periodo = 7;
          gananciasDebajo = 152.0;
          stopGananciasDebajo= 80.0;
          stopLoss= 47.0;
          }
          else if ((Closes[2][0] > 30.00) && (Closes[2][0] <= 55.00))
          {
          contratos = 1;
          periodo = 3;
          gananciasDebajo = 182.0;
          stopGananciasDebajo= 88.0;
          stopLoss= 50.0;
          }
          else if (Closes[2][0] > CierreVix)
          {
          return;
          }

          Comment


            #6
            By the way, data are get from kinetic EOD connection

            Comment


              #7
              Hello Fernando,

              Thank you for your patience.

              Originally posted by azunal View Post
              For example, on Friday vix close at 20.97, meaning that on Monday parameters should had been set using 20.00-30.00 range but they did not. They use vix < 20.00 parameters.
              I tested your code and it works as expected on my end. How are you confirming that the values should be those for greater than 20? What would the values be based on Monday's Closes[2][0]?

              Comment


                #8
                Hello Patrick,

                I checked on Monday afternoon, comparing Monday trades and strategies parameters. I also check in the output window and Print sentence indicates that vix were taken <20.00.
                Anyway, I will add a Print sentence tonight to see which vix are checking strategies in the first bar of session and post comments tomorrow.

                Regards,

                Fernando

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Tim-c, Today, 03:54 AM
                0 responses
                3 views
                0 likes
                Last Post Tim-c
                by Tim-c
                 
                Started by FrancisMorro, Today, 03:24 AM
                0 responses
                2 views
                0 likes
                Last Post FrancisMorro  
                Started by Segwin, 05-07-2018, 02:15 PM
                10 responses
                1,771 views
                0 likes
                Last Post Leafcutter  
                Started by Rapine Heihei, 04-23-2024, 07:51 PM
                2 responses
                31 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by Shansen, 08-30-2019, 10:18 PM
                24 responses
                945 views
                0 likes
                Last Post spwizard  
                Working...
                X