Hi,
I want to track the performance of a custom index though time. The components of the custom index change at the start of next month. How do I string the months together through time?
I’ve tried a few things, but doubt they will work…
Attempt 1: can I use an operator to string Plot1 and plot 2 together?
//Define Month 1 M1 = MONTHNUM() == 1 and YEARNUM() == 2022 ; //Define Index for Month 1 Plot1 = POWER(XLRE:US * XLP:US * XLB:US * XLK:US ,POWER=0.25) ; // Display Plot1 During Month 1 V1 = VALUEWHEN(M1) == Plot1 ; //Define Month 2 M2 = MONTHNUM() == 2 and YEARNUM() == 2022 ; //Define Index for Month 2 Plot2 = POWER(XLF:US * XLY:US * XLB:US * XLK:US ,POWER=0.25) ; // Display Plot2 During Month 2 V2 = VALUEWHEN(M2) == Plot2 ; //String the Plots Together through time?????? How??? Plot1, Plot2
Attempt 2: will some type of If statement work?
//Define Month 1 M1 = MONTHNUM() == 1 and YEARNUM() == 2022 ; // Define Month 1 Custom Index Plot1 = POWER(XLRE:US * XLP:US * XLB:US * XLK:US ,POWER=0.25) ; // Get Data From Custom Index 1 During Month 1 V1 = VALUEWHEN(M1) == Plot1 ; //Define Month 2 M2 = MONTHNUM() == 2 and YEARNUM() == 2022 ; // Define Month 2 Custom Index Plot2 = POWER(XLI:US * XLF:US * XLB:US * XLK:US ,POWER=0.25) ; // Get Data From Custom Index 2 During Month 2 V2 = VALUEWHEN(M2) == Plot2 ; //Plot Custom Index through time If(M1, M2, Plot1, Plot2)
Hopefully you understand what I am trying to do. I thought about the changeto function. What do you recommend? Thank you.