Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volume for Multi-Timeframe

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

    Volume for Multi-Timeframe


    I tried to print the volume for a 10 min time frame which I added to a strategy. The strategy was added to a 1 min chart. I found that the volume for the 10 min time frame was the same as the volume of the last min from the chart data. Here is the code and what I printed.

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Add(PeriodType.Minute,10);
    }
    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    {
    Print(Time[0].ToString()+ " 10 Min " + Volumes[1] + " O " + Opens[1] + " C " + Closes[1]);
    }
    if (BarsInProgress == 0)
    {
    Print(Time[0].ToString()+ " Chart " + Volumes[0] + " O " + Opens[0] + " C " + Closes[0] );
    }
    }


    Output::::
    Notice that the Open and close are correct but the volume for the 10 min bar is the same as the last 1 min bar.
    2/1/2008 12:01:00 PM Chart Vol: 3258 O 1384.5 C 1385
    2/1/2008 12:02:00 PM Chart Vol: 4516 O 1385 C 1384.5
    2/1/2008 12:03:00 PM Chart Vol: 2853 O 1384.75 C 1384.75
    2/1/2008 12:04:00 PM Chart Vol: 1701 O 1384.5 C 1384.5
    2/1/2008 12:05:00 PM Chart Vol: 1083 O 1384.5 C 1385.25
    2/1/2008 12:06:00 PM Chart Vol: 1888 O 1385.25 C 1385.75
    2/1/2008 12:07:00 PM Chart Vol: 1405 O 1385.75 C 1385.5
    2/1/2008 12:08:00 PM Chart Vol: 3228 O 1385.25 C 1385.75
    2/1/2008 12:09:00 PM Chart Vol: 922 O 1386 C 1386
    2/1/2008 12:10:00 PM Chart Vol: 2798 O 1386 C 1387.75
    2/1/2008 12:10:00 PM 10 Min Vol: 2798 O 1384.5 C 1387.75
    2/1/2008 12:11:00 PM Chart Vol: 1309 O 1387.5 C 1387
    2/1/2008 12:12:00 PM Chart Vol: 4539 O 1387 C 1388
    2/1/2008 12:13:00 PM Chart Vol: 3327 O 1388 C 1388.25
    2/1/2008 12:14:00 PM Chart Vol: 2336 O 1388.5 C 1389
    2/1/2008 12:15:00 PM Chart Vol: 1460 O 1389 C 1388.5
    2/1/2008 12:16:00 PM Chart Vol: 1094 O 1388.5 C 1388
    2/1/2008 12:17:00 PM Chart Vol: 1232 O 1388 C 1388.75
    2/1/2008 12:18:00 PM Chart Vol: 638 O 1388.75 C 1388.75
    2/1/2008 12:19:00 PM Chart Vol: 798 O 1388.75 C 1388.75
    2/1/2008 12:20:00 PM Chart Vol: 1091 O 1389 C 1389.25
    2/1/2008 12:20:00 PM 10 Min Vol: 1091 O 1387.5 C 1389.25
    2/1/2008 12:21:00 PM Chart Vol: 5180 O 1389.25 C 1390.25
    2/1/2008 12:22:00 PM Chart Vol: 2688 O 1390.25 C 1389.75
    2/1/2008 12:23:00 PM Chart Vol: 1836 O 1390 C 1388.75
    2/1/2008 12:24:00 PM Chart Vol: 4668 O 1389 C 1391
    2/1/2008 12:25:00 PM Chart Vol: 5154 O 1391 C 1390.5
    2/1/2008 12:26:00 PM Chart Vol: 1311 O 1390.5 C 1391.25
    2/1/2008 12:27:00 PM Chart Vol: 1413 O 1391 C 1390.75
    2/1/2008 12:28:00 PM Chart Vol: 2362 O 1390.75 C 1389.75
    2/1/2008 12:29:00 PM Chart Vol: 2238 O 1389.75 C 1391.25
    2/1/2008 12:30:00 PM Chart Vol: 1379 O 1391 C 1390.75
    2/1/2008 12:30:00 PM 10 Min Vol: 1379 O 1389.25 C 1390.75
    2/1/2008 12:31:00 PM Chart Vol: 1756 O 1390.75 C 1391.5
    2/1/2008 12:32:00 PM Chart Vol: 7035 O 1391.5 C 1392.75
    2/1/2008 12:33:00 PM Chart Vol: 5622 O 1392.75 C 1392.75
    2/1/2008 12:34:00 PM Chart Vol: 2610 O 1392.75 C 1392.75
    2/1/2008 12:35:00 PM Chart Vol: 2249 O 1392.5 C 1392.5
    2/1/2008 12:36:00 PM Chart Vol: 6132 O 1392.5 C 1391.75
    2/1/2008 12:37:00 PM Chart Vol: 3408 O 1391.75 C 1392.75
    2/1/2008 12:38:00 PM Chart Vol: 5338 O 1393 C 1393.75
    2/1/2008 12:39:00 PM Chart Vol: 11603 O 1393.75 C 1394.25
    2/1/2008 12:40:00 PM Chart Vol: 5714 O 1394 C 1393.75
    2/1/2008 12:40:00 PM 10 Min Vol: 5714 O 1390.75 C 1393.75

    #2
    - are you on NT6.5.0.8?
    - which data provider did you get your historical data from?

    Thanks
    DierkNinjaTrader Customer Service

    Comment


      #3
      I am running 6.5.0.6

      Using IB for a data vendor.

      Comment


        #4
        Could you please update to latest NT 6.5.0.8 and let us know if issue persists?

        Also: Which instrument was this?

        Thanks
        DierkNinjaTrader Customer Service

        Comment


          #5
          I am using ES 03-08

          Comment


            #6
            I down loaded version 6.5.8 and tried again. Same problem:
            2/1/2008 1:11:00 PM Chart Vol: 2959 O 1394.75 C 1395.5
            2/1/2008 1:12:00 PM Chart Vol: 2794 O 1395.5 C 1394
            2/1/2008 1:13:00 PM Chart Vol: 1993 O 1394 C 1394.5
            2/1/2008 1:14:00 PM Chart Vol: 2274 O 1394.5 C 1394
            2/1/2008 1:15:00 PM Chart Vol: 1850 O 1394 C 1393.75
            2/1/2008 1:16:00 PM Chart Vol: 6755 O 1393.75 C 1391.5
            2/1/2008 1:17:00 PM Chart Vol: 7408 O 1391.25 C 1391.5
            2/1/2008 1:18:00 PM Chart Vol: 3828 O 1391.5 C 1391.5
            2/1/2008 1:19:00 PM Chart Vol: 4025 O 1391.5 C 1391.75
            2/1/2008 1:20:00 PM Chart Vol: 4379 O 1391.75 C 1393
            2/1/2008 1:20:00 PM 10 Min Vol: 4379 O 1394.75 C 1393
            *******

            I tried this on a 10 min chart and both volumes were the same.

            Comment


              #7
              Please change your OnBarUpdate method to:

              if (BarsInProgress == 1)
              {
              Print(Time[0].ToString()+ " 10 Min " + Volumes[1][0] + " O " + Opens[1][0] + " C " + Closes[1][0]);
              }
              if (BarsInProgress == 0)
              {
              Print(Time[0].ToString()+ " Chart " + Volumes[0][0] + " O " + Opens[0][0] + " C " + Closes[0][0] );
              }

              Tech background: As you coded it before, some default .NET logic (.ToString() method) triggered in which just displayed unexpected results.
              DierkNinjaTrader Customer Service

              Comment


                #8
                I tried your suggestion but same result. Here is my code and results:
                protected override void OnBarUpdate()
                {
                if (BarsInProgress == 1)
                {
                Print(Time[1].ToString()+ " 10 Min Vol: " + Volumes[1][0] + " O " + Opens[1][0] + " C " + Closes[1][0]);
                }
                if (BarsInProgress == 0)
                {
                Print(Time[0].ToString()+ " Chart Vol: " + Volumes[0][0] + " O " + Opens[0][0] + " C " + Closes[0][0] );
                }
                }

                Result:
                2/1/2008 1:51:00 PM Chart Vol: 3398 O 1396 C 1396.25
                2/1/2008 1:52:00 PM Chart Vol: 3245 O 1396.25 C 1395.75
                2/1/2008 1:53:00 PM Chart Vol: 3844 O 1395.75 C 1395.5
                2/1/2008 1:54:00 PM Chart Vol: 2966 O 1395.5 C 1395.5
                2/1/2008 1:55:00 PM Chart Vol: 2071 O 1395.5 C 1395.25
                2/1/2008 1:56:00 PM Chart Vol: 2861 O 1395 C 1394.75
                2/1/2008 1:57:00 PM Chart Vol: 4094 O 1395 C 1395
                2/1/2008 1:58:00 PM Chart Vol: 6489 O 1395 C 1395.25
                2/1/2008 1:59:00 PM Chart Vol: 6744 O 1395.25 C 1395.25
                2/1/2008 2:00:00 PM Chart Vol: 6829 O 1395.25 C 1395.5
                2/1/2008 1:50:00 PM 10 Min Vol: 6829 O 1396 C 1395.5
                2/1/2008 2:01:00 PM Chart Vol: 11226 O 1395.5 C 1395.5
                2/1/2008 2:02:00 PM Chart Vol: 6910 O 1395.5 C 1395.75
                2/1/2008 2:03:00 PM Chart Vol: 5396 O 1395.75 C 1396.5
                2/1/2008 2:04:00 PM Chart Vol: 5616 O 1396.5 C 1397
                2/1/2008 2:05:00 PM Chart Vol: 3660 O 1397 C 1397.25
                2/1/2008 2:06:00 PM Chart Vol: 3355 O 1397.5 C 1397.25
                2/1/2008 2:07:00 PM Chart Vol: 3148 O 1397 C 1396.5
                2/1/2008 2:08:00 PM Chart Vol: 2142 O 1396.25 C 1397
                2/1/2008 2:09:00 PM Chart Vol: 1818 O 1396.75 C 1397
                2/1/2008 2:10:00 PM Chart Vol: 1480 O 1397 C 1396.75
                2/1/2008 2:00:00 PM 10 Min Vol: 1480 O 1395.5 C 1396.75
                ********

                Comment


                  #9
                  Works here:
                  01.02.2008 13:55:00 01.02.2008 13:55:00 Chart 531 O 730,9 C 731,7
                  01.02.2008 13:56:00 01.02.2008 13:56:00 Chart 818 O 731,6 C 731,3
                  01.02.2008 13:57:00 01.02.2008 13:57:00 Chart 336 O 731,2 C 731,3
                  01.02.2008 13:58:00 01.02.2008 13:58:00 Chart 1057 O 731,3 C 731
                  01.02.2008 13:59:00 01.02.2008 13:59:00 Chart 1426 O 731 C 731,3
                  01.02.2008 14:00:00 01.02.2008 14:00:00 Chart 3255 O 731,3 C 729,7
                  01.02.2008 14:00:00 01.02.2008 14:00:00 10 Min 9075 O 732,1 C 729,7
                  01.02.2008 14:01:00 01.02.2008 14:01:00 Chart 1190 O 729,7 C 730
                  01.02.2008 14:02:00 01.02.2008 14:02:00 Chart 592 O 729,9 C 730,2
                  01.02.2008 14:03:00 01.02.2008 14:03:00 Chart 635 O 730,2 C 730,2
                  01.02.2008 14:04:00 01.02.2008 14:04:00 Chart 444 O 730,2 C 730,4
                  01.02.2008 14:05:00 01.02.2008 14:05:00 Chart 443 O 730,6 C 731,2
                  01.02.2008 14:06:00 01.02.2008 14:06:00 Chart 155 O 731,2 C 731,6
                  01.02.2008 14:07:00 01.02.2008 14:07:00 Chart 272 O 731,4 C 731,2
                  01.02.2008 14:08:00 01.02.2008 14:08:00 Chart 227 O 731,2 C 731,4
                  01.02.2008 14:09:00 01.02.2008 14:09:00 Chart 124 O 731,3 C 731,2
                  01.02.2008 14:10:00 01.02.2008 14:10:00 Chart 103 O 731,2 C 731,1
                  01.02.2008 14:10:00 01.02.2008 14:10:00 10 Min 4185 O 729,7 C 731,1

                  Did you press F5 to compile and did you reapply the strategy to your chart? If still not working, try a restart of NT.
                  DierkNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jcbinks, Today, 03:32 PM
                  2 responses
                  14 views
                  0 likes
                  Last Post jcbinks
                  by jcbinks
                   
                  Started by Stefan Mayer, Today, 03:09 PM
                  1 response
                  13 views
                  0 likes
                  Last Post NinjaTrader_Kate  
                  Started by M_ichel, Today, 03:18 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by ralett, Today, 02:43 PM
                  2 responses
                  15 views
                  0 likes
                  Last Post ralett
                  by ralett
                   
                  Started by Nightmaregpu, Today, 02:18 PM
                  1 response
                  14 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X