Optuma Forums › Optuma Scripting › Signal Testing example
Tagged: signal test, quarterly performance
- This topic has 5 replies, 2 voices, and was last updated 2 months ago by
Christopher.
-
AuthorPosts
-
April 3, 2023 at 10:22 am #70675
Darren
- Topics: 76
- Replies: 1,059
- Posts: 1,135
For clients with access to the quantitative Signal Testing module, you can run tests on technical and calendar events using scripting.
Here’s an example on 1st quarter performance in the $SPX which we tweeted here: https://twitter.com/Optuma/status/1642534097020162048?s=20
It’s based on the same concept as this January Barometer article but instead we look at performance after the first quarter rather than the first month.
To calculate the performance for the rest of the year when the first quarter has been positive, run this on a monthly timeframe with the Periods Before set to 3 (ie January – March) and the Periods After to 9 (April – December):
12345678//Get quarterly data;Q1 = MONTH(PERIODAMOUNT=3);//Signal when month turns to April and Q1 close is higher;V1=MONTHNUM() ChangeTo 4 and Q1[1] IsUp;//offset by 1 to get the March closing value;V1[-1]2023 was the 47th time this occurred in the $SPX, and the results show that out of the previous 46 events the year closed higher 87% of the time, with an average return of +9.5%. On the results chart the period of -3 to 0 is January to March, and 0 to 9 is April to December:
To change the test for when the first quarter is negative change Q1[1] to IsDown (and for all years delete the Q1 condition)
123V1=MONTHNUM() ChangeTo 4 and Q1[1] IsUp;1 user thanked author for this post.
September 21, 2023 at 1:05 pm #71723Christopher
- Topics: 1
- Replies: 3
- Posts: 4
Can you please provide Guidance on Signal Test Script I can use to test what occurs after a negative return from Sept 1st – Sept 20th. Id like to be able to modify the script for future time frames… I came up with this nonsense that clearly isn’t right after finding a previous forum post
123456789//Get September 1 - 20 data;Sept20 = MONTH(PERIODAMOUNT=9) and DAY(Periodamount = 20);//Signal when turns to September 21 and Septemebr 1 - 20 close is negative;V1=MONTH(PERIODAMOUNT=9) and DAY(PERIODAMOUNT=20) ChangeTo MONTH(PERIODAMOUNT=9) and DAY(PERIODAMOUNT=21) and Sept20 IsDown;V1September 21, 2023 at 4:23 pm #71727Darren
- Topics: 76
- Replies: 1,059
- Posts: 1,135
Hi Christopher,
You could use MONTHNUM()==9 and DAYNUM()==20 but it gets tricky when the 20th falls on a weekend…
I can’t think of an easy way, but here’s a Seasonality chart of the average September for SPX, showing the dropoff at the end of the month:
September 21, 2023 at 11:08 pm #71729Christopher
- Topics: 1
- Replies: 3
- Posts: 4
ok thanks, i have looked into that style that you showed me and that is great for wheat it is … im interested in stats on this type of stuff, probabilities, ROR over period of time after like the signal tester gives… so if im hearing you correctly it is a day ending on the weekend issue… could this be solved if i used say an end of week # like the 3rd (ending) week of september or week 38 of the year. Is there a script for something like that to plug into the Signal tester?
September 22, 2023 at 1:54 pm #71731Darren
- Topics: 76
- Replies: 1,059
- Posts: 1,135
Here’s a solution: we can use DAYNUM() CrossesAbove 19 so it will take the next trading day if the 20th is a weekend:
12345678//Set signal day and month;V1=DAYNUM() CrossesAbove 19 and MONTHNUM() == 9;//Get daily MTD% value;M1=100*(CLOSE()/(MONTH()[1]))-100;//If MTD% value < 0 when V1 occurs, take signal;V1 and VALUEWHEN(M1, V1)<0The Signal Test is set to 13 periods (trading days) before the signal (ie Sept 1st – 20th) and 9 days after to the end of the month. Of the 34 years that the SPX was negative Sept 1st – 20th (avg loss -3.32%) the index went on to lose another 0.42% for the rest of the month, with a Probability of Gain of 45%:
For the 40 times when the SPX is positive for Sept 1st – 20th (change the last line to >0) the results are very similar, with the avg gain from Sept 1st of 2.5%
September 23, 2023 at 12:45 am #71733Christopher
- Topics: 1
- Replies: 3
- Posts: 4
Great thanks!!! I really appreciate the time you took to work this out for me. I should be able to take this frame work and use it for other time frames. Thanks again.
1 user thanked author for this post.
-
AuthorPosts
- You must be logged in to reply to this topic.