Hii,
I cant understand how this offset is working can you please explain how not equal to signal is offsetting number of days.
//Set M1 offset to the end of the previous month, ie [2] for 3 days, [3] for 4, etc; IF(M1[2],V1,HIDDEN())
Hii,
I cant understand how this offset is working can you please explain how not equal to signal is offsetting number of days.
//Set M1 offset to the end of the previous month, ie [2] for 3 days, [3] for 4, etc; IF(M1[2],V1,HIDDEN())
Hi Deepak,
I’m not sure what MONTHNUM() M1 is referring to, but it’s probably looking at the bar before [2] bars ago when the signal occured. Put M1 and M1[2] in separate Show Bars and see when the signal occurs.
Sorry i did not put complete script this is optuma’s twitter tweet. In this i am not getting how the line of code is working
//Calculate required period rate of change; V1=ROC(BARS=3); //Month change trigger; M1=MONTHNUM() <> MONTHNUM()[1]; //Set M1 offset to the end of the previous month, ie [2] for 3 days, [3] for 4, etc; IF(M1[2],V1,HIDDEN())
M1 is triggered the on the 1st trading day of the month, but we need to calculate V1 from the close of the day before. So if the last day of the month was 9 days ago the M1 trigger occurred 8 days ago ie M1[8].
Another way to show the MTD% in a timeseries is the following in a Show View:
100*(CLOSE()/(MONTH()[1]))-100
So far this month, NIFTY50 is down -1.65% following a 2.94% gain in July:
Hi,
Great idea from Deepak and a nice script from Darren.
Darren, what is the script to coloring the months in blue and green?
Thanks,
Thomas
Hi Thomas,
That’s the Time Interval colour scheme set to month.
The green bar is m1
Black bar is m1[2]
Here the offset is created in forward direction rather than previous. Can you please tell if sth is wrong.
M1[2] will show on the 3rd trading day of the month - which hasn’t happened yet for September so there won’t be a signal. Using the monthly Time Interval colour scheme you can see the signal on the 3rd bar:
Hi Darren,
I am little confused.
The [n] offset creates an offset backwards. Here its creating a forward offset from signal.
So if i say close() then it shows todays close but when i say close[1] it shows yesterdays close.
Yes it’s a bit confusing, but the the Show Bar arrow is the signal for when MONTHNUM()<>MONTHNUM()[1] was true [n] bars before.
Hii Darren,
Sorry to disturb you again on this same issue. In signal tester its not happening as envisaged. it takes entry on M1[2] day rather than close of month end.
Can it be resolved by modifying sth in formula.
Regards,
Deepak
Can you please check why its not working in signal tester. I wanted to see how first trading day of each month behave.
Use -1 to get the day before the signal in the tester, eg to get signal for every change of month you can use this:
//New month when the Day Number is lower than before, eg 31st changes to 1st;
V1=DAYNUM() IsDown;
//Use close of the day before;
V1[-1]