u33m2ha8
 ( 0.00% )
- ago
Good morning.

I'm having a problem with the "Day of the Year" indicator.

For example: I want the system to always buy on January 19th of each year at the open. This means I enter the 18th of the year as the day in the building blocks, since the buy order is placed one day after the signal at the open. If I apply the "equal to" condition, a position is only opened on January 19th if January 18th wasn't a holiday or weekend. With these settings, the system buys for four years: 2023, 2022, 2019, and 2018. In these years, January 18th was always a normal trading day (Monday to Friday).

Now I'm looking at the year 2024. January 18th, 2024, was a Thursday, and the stock market was open. Why doesn't the system buy on Friday, January 19th, 2024 (a regular trading day)?

January 18, 2021, was a Monday, so no purchase was made. January 19, 2020, was a Sunday, so I understand that no purchase could have taken place on January 19, 2020.

If I select the setting "greater than or equal to," the system will buy on January 23, 2025. January 18, 2025, was a Saturday, and the US stock exchanges were closed on January 20, 2025. Therefore, the signal day should actually be January 21, 2025, and the purchase should have taken place on January 22, 2025.

I find all of this somewhat confusing and strange.

The real question is, how can I ensure that the purchase is made on the next possible trading day after my chosen cut-off date?
0
56
3 Replies

Reply

Bookmark

Sort
Glitch8
 ( 11.86% )
- ago
#1
You need to provide a little bit of margin, like 1.1 to 1 to ensure the position can be taken because your position size is a full 100% of equity.
0
u33m2ha8
 ( 0.00% )
- ago
#2
Hmm, could you explain the reason for this? In this example, isn't one symbol always bought at the same time? What role does the position size play in determining the purchase date?

And if that's the case, what do I need to increase: the margin factor or the percentage of equity?
0
Glitch8
 ( 11.86% )
- ago
#3
It's because, like in normal trading, the quantity to purchase is based on the closing price of the signal bar.

However, the open of the next market session might gap up, resulting in a situation where you don't have enough simulated capital to take the trade.

Possible solutions:

- Slightly reduce the position size to compensate
- Add a slight margin factor to simulate trading a margin instead of a cash account
- Change the basis price calculation to Next Bar Open instead of This Bar Close (this presumes that your broker allows you to place a trade in "dollars" instead of "shares." - not all do.
0

Reply

Bookmark

Sort