Create time based trading strategies

Introduction

Vestinda is excited to introduce two powerful indicators, "Current Date Time" and "Entry Date Time" designed to help traders create time-based trading strategies with ease. In this simple guide, we'll walk you through the capabilities of these indicators, provide real-world examples, and demonstrate how to leverage them within our no-code environment to build your own strategies.


⚠️ IMPORTANT: Time Indicators are in BETA mode.

When using Time Based indicators in Backtesting, make sure you control the Time Interval of the TimeSeries by using at least one indicator that has a Time Interval parameter.


Eg: Add a ClosePrice indicator with Time Interval of 1hour if you use HourOfDay in your conditions.


Understanding the Current Date Time Indicator

The "Current Date Time" indicator is a real-time clock that returns the current millisecond, allowing you to precisely track the passing of time as your trading strategy unfolds. This indicator serves as the foundation for executing actions based on specific time intervals.


Understanding the Entry Date Time Indicator

The "Entry Date Time" indicator, on the other hand, provides the timestamp of when an open position was entered. It's a valuable tool for traders who want to monitor the duration of their active positions and trigger actions accordingly.


Understanding the Day Of Week Indicator

The "Day Of Week" indicator returns the day-of-week as a numeric value. The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). So if you want to trade on Tuesdays, you would add a condition like DayOfWeek = 2

Understanding the Hour Of Day Indicator

The "Hour Of Day" indicator returns the hour-of the day, from 0 to 23. So if you want to trade on Tuesdays, when the current tick begin time is 22 you would add a condition like DayOfWeek = 2 AND HourOfDay = 22. This would return true for the entire hour from 22:00 to 22:59:59

Understanding the Minute Of Hour Indicator

The "Minute Of Hour" indicator returns the hour-of the day, from 0 to 23. So if you want to trade on Tuesdays, at when the current tick begin time is 22:00 you would add a condition like DayOfWeek = 2 AND HourOfDay = 22 AND MinuteOfHour = 30

Understanding the Date and Time in Interval Indicator

The "Date and Time in Interval" indicator returns true if the current time is part of the interval. Limits are inclusive. So if you want to trade From Monday 9:30 to Wednesday 16:30, then you would add the indicator and set it like below.

⚠️ Time is UTC

A practical example: build, backtest and execute a Time-Based Trading Strategy

Let's explore a practical example of a time-based trading strategy using a condition for how much time passed since the Position was opened.


Objective:

We want to exit a position if it has been open for more than 30 days.


Steps to Create the Strategy:

  1. Create a New Strategy: In the Vestinda platform, navigate to the Strategy Builder to create a new strategy.
  2. Define Entry Conditions: In the Strategy Builder, set your entry conditions based on your preferred trading signals. For instance, you might use technical indicators or a specific price movement as your entry signal. Once your entry conditions are met, a new Position will be opened and the "Entry Date Time" indicator will record the timestamp of the first order.
  3. Set Exit Conditions: To exit a position after 30 days, create an exit condition using the "Current Date Time" and "Entry Date Time" indicators like this: CurrentDateTime > EntryDateTime + 1000 * 60 * 1440 * 30
  4. Combine Conditions: You can also combine the time-based condition with other exit conditions. For example, you might want to exit the position if it reaches a certain profit target or if a specific technical indicator signals an exit.
  5. Save and Backtest: Save your strategy and backtest it using historical data to ensure it performs as expected.
  6. Deploy Your Strategy: Once you're satisfied with the results from backtesting, deploy your strategy in a live trading environment and watch it automatically execute trades based on your time-based conditions.

  • EntryDateTime + 1000 * 60 = 1 minute after the Position was open
  • EntryDateTime + 1000 * 60 * 1440 = 1 day after the Position was open
  • EntryDateTime + 1000 * 60 * 1440 * 30 = 30 days after the Position was open

Conclusion

Vestinda's "Current Date Time" and "Entry Date Time" indicators open up exciting possibilities for time-based trading strategies. Whether you're a seasoned trader or just starting out, our no-code environment empowers you to create and execute sophisticated strategies that leverage the passage of time. Experiment with different time intervals, combine conditions, and fine-tune your strategies to meet your trading goals with precision.


Ready to dive in and start creating your own time-based trading strategies? Head over to the Vestinda platform, access the Strategy Builder, and let your creativity flow.


Happy trading!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us