Click here to Login

                                                   How to determine if the a given day is a trading day?


Dave Walton
2013-07-08 07:39:23

I'm trying to implement a monthly system that buys the top 3 ETFs on a certain day of the month. If I just use the formula Rule1 = (Day()) == (1)); sometimes I don't get a buy signal because the first trading day of the month is either on a weekend or a holiday. How can I determine if this is the case?

2013-07-08 19:29:44


Rule1 = Day() > 1 and Day() < 7;

Dave Walton
2013-07-08 23:08:20


Actually that doesn't work because Rule1 will be active for multiple days. After I posted I figured out how to do it: I created a C# function called FirstTradingDOM.

Then the system uses: Rule1 = FirstTradingDOM;

2013-07-09 02:57:17


Best Answer
You can also use:

rule1 = month() != ref(month(), 1);

2015-02-24 23:37:01


What if I want to buy/sell on another trading day of the month (e.g. eighteenth day of the month)?

2015-02-25 01:37:52


rule1 = month() != ref(month(), 1);
rule1 = ref(month(), 7); // For the eighteenth day of the month

2016-06-09 17:20:46


I don't understand why it would work, can you explain this simple code?

2016-06-09 18:18:56


My mistake. It should be:

rule1 = month() != ref(month(), 1);
buy = ref(rule1, 6); // For the bar number 7 after the new month

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Time-series Sum for the first Minutes/Hours of a Trading Day
The Best trading rules for the ADX technical indicator
Number of Times an Event Occurred in the First N-Minutes of a Tra...
Stock Trading Rules - Percentage That Passed in the Last Trading ...
Moving Average Crossovers In the Past Trading Days

How-to Lessons
How to plot the number of stock tweets per day
How to download a trading item from the Sharing Server
How to optimize the stop limit of a trading system
How to add a metric in the trading system simulation report
How to debug a trading system using the money management tool

Related Forum Threads
How to get the last day of the month in C#
How to read the number of positions in trading system
how to remove non trading day entries
How to download the trading software
Intraday Trading with the "Create a Trading System" tool.

Blog Posts
Buy the best/top rated stocks or how to create powerful rank base...
How to use the new Market Regimes Feature in QuantShare Trading S...
The Ultimate Guide to Create Trading Systems in QuantShare
How to Select the Best Market Indicator for your Trading System
Day Trading: A trading system that combines intraday and EOD data

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2023
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.