Strips

(Back to Special Queries)

 


 

Here is a typical 12 month calendar strip for NG that sums the individual 12 contract prices for each date and divides by 12 to get an average price.  *this adjusts which contract is being used, prompt or back for each month based on the proximity to the expiration date for that month

SHOW

     1: (IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_Z  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 12 )

         ELSE adjust_contract ( NG, 2, 0, 12 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_F  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 1 )

         ELSE adjust_contract ( NG, 2, 0, 1 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_G  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 2 )

         ELSE adjust_contract ( NG, 2, 0, 2 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_H  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 3 )

         ELSE adjust_contract ( NG, 2, 0, 3 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_J  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 4 )

         ELSE adjust_contract ( NG, 2, 0, 4 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_K  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 5 )

         ELSE adjust_contract ( NG, 2, 0, 5 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_M  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 6 )

         ELSE adjust_contract ( NG, 2, 0, 6 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_N  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 7 )

         ELSE adjust_contract ( NG, 2, 0, 7 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_Q  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 8 )

         ELSE adjust_contract ( NG, 2, 0, 8 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_U  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 9 )

         ELSE adjust_contract ( NG, 2, 0, 9 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_V  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 10 )

         ELSE adjust_contract ( NG, 2, 0, 10 )

         ENDIF  + IF

             periods_in_range from today to yearly Close  is more than

             periods_in_range from today to NG_X  expiration_day 

         THEN adjust_contract ( NG, 1, 0, 11 )

         ELSE adjust_contract ( NG, 2, 0, 11 )

         ENDIF ) / 12

   WHEN

       Date is after 1995

 

Next years strip:   This calendar strip shows on the expiration day, what the next years contract is trading at for each month, takes the sum of those prices and divides by 12 to get the average per day.

SHOW 
     NextYearStrip: (IF 
                         Date is NG_F  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 1 ) 
                     ELSE adjust_contract ( NG, 1, 0, 1 ) 
                     ENDIF  + IF 
                         Date is NG_G  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 2 ) 
                     ELSE adjust_contract ( NG, 1, 0, 2 ) 
                     ENDIF  + IF 
                         Date is NG_H  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 3 ) 
                     ELSE adjust_contract ( NG, 1, 0, 3 ) 
                     ENDIF  + IF 
                         Date is NG_J  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 4 ) 
                     ELSE adjust_contract ( NG, 1, 0, 4 ) 
                     ENDIF  + IF 
                         Date is NG_K  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 5 ) 
                     ELSE adjust_contract ( NG, 1, 0, 5 ) 
                     ENDIF  + IF 
                         Date is NG_M  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 6 ) 
                     ELSE adjust_contract ( NG, 1, 0, 6 ) 
                     ENDIF  + IF 
                         Date is NG_N  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 7 ) 
                     ELSE adjust_contract ( NG, 1, 0, 7 ) 
                     ENDIF  + IF 
                         Date is NG_Q  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 8 ) 
                     ELSE adjust_contract ( NG, 1, 0, 8 ) 
                     ENDIF  + IF 
                         Date is NG_U  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 9 ) 
                     ELSE adjust_contract ( NG, 1, 0, 9 ) 
                     ENDIF  + IF 
                         Date is NG_V  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 10 ) 
                     ELSE adjust_contract ( NG, 1, 0, 10 ) 
                     ENDIF  + IF 
                         Date is NG_X  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 11 ) 
                     ELSE adjust_contract ( NG, 1, 0, 11 ) 
                     ENDIF  + IF 
                         Date is NG_Z  expiration_day 
                     THEN adjust_contract ( NG, 2, 0, 12 ) 
                     ELSE adjust_contract ( NG, 1, 0, 12 ) 
                     ENDIF ) / 12 
   WHEN 
       Date is NG  expiration_day 

 

 

 

Another Strip: This strip sums the 2nd contract out through the 13th contract out for each day and divides by 12 for the average.

 

   LET

     ATTR _2through13 =

            (adjust_contract ( NG, 2, 0, 0 ) + adjust_contract ( NG, 3, 0, 0 )

             + adjust_contract ( NG, 4, 0, 0 ) + adjust_contract ( NG, 5, 0,

             0 ) + adjust_contract ( NG, 6, 0, 0 ) + adjust_contract ( NG, 7,

             0, 0 ) + adjust_contract ( NG, 8, 0, 0 ) + adjust_contract ( NG,

             9, 0, 0 ) + adjust_contract ( NG, 10, 0, 0 ) + adjust_contract (

             NG, 11, 0, 0 ) + adjust_contract ( NG, 12, 0, 0 ) +

             adjust_contract ( NG, 13, 0, 0 )

            ) / 12

 

   SHOW

     _2through13: _2through13

     _frontNG: NG

   WHEN

       NG is DEFINED

 

 

 

A Rolling Average Strip:   Takes the sum of the closing price on each months expiration day divides by 12 for a rolling average.

   SHOW 
     Rolling_average: (NG_F on previous NG_F  last_data_day  + NG_G on 
                       previous NG_G  last_data_day  + NG_H on previous NG_H  
                       last_data_day  + NG_J on previous NG_J  last_data_day  
                       + NG_K on previous NG_K  last_data_day  + NG_M on 
                       previous NG_M  last_data_day  + NG_N on previous NG_N  
                       last_data_day  + NG_Q on previous NG_Q  last_data_day  
                       + NG_U on previous NG_U  last_data_day  + NG_V on 
                       previous NG_V  last_data_day  + NG_X on previous NG_X  
                       last_data_day  + NG_Z on previous NG_Z  last_data_day ) 
                      / 12