time-based trading system with trading day of the mounth
Forums › ProRealTime English forum › ProBuilder support › time-based trading system with trading day of the mounth
- This topic has 7 replies, 3 voices, and was last updated 2 years ago by funkytown.
-
-
07/22/2022 at 10:31 AM #197694
I would like to implement the following trading system:
Buy on a certain trading day of the month when the high or low of the previous day is exceeded. Sell after x days at the close of trading if the take profit or stop loss is not reached beforehand.
The correct calculation of the trading day of the month is important. Stock exchange holidays must also be taken into account, i.e. days on which there is no trading on the home exchange, e.g. Cbot, Euwax, CME etc.
07/22/2022 at 10:55 AM #197698It’s not possible to know when there are Holidays. We can only know there was one AFTER that day. So you will have to set the date (or at least the day). In case that day (or date) is a holiday, the trade will not be executed at all that month, or it can be executed the next day.
07/22/2022 at 11:07 AM #197700There must be another possibility. The system knows on which days of the month trading takes place. In a monthly view, each trading day has a candle. Now, for example, the trading system should place an order if the previous day’s high is exceeded on the 5th trading day.
The system therefore only has to count off the trading days starting with the beginning of the month.
07/22/2022 at 11:49 AM #197705Yes, knowing them AFTER they occur is possible:
123456789101112131415161718192021ONCE Tally = 99IF OpenMonth <> OpenMonth[1] THENTally = 0ENDIFTally = Tally + 1IF Tally = 5 AND Not OnMarket THEN //enter on the closing of the 5th trading dayIF high > high[1] THENBUY 1 CONTRACT AT MARKETSET TARGET pPROFIT 300SET STOP pLOSS 100Count = 0ENDIFENDIFIF OnMarket THENCount = Count + 1IF Count = 3 THEN //exit after 3 daysSELL AT MARKETENDIFENDIFgraph Tallygraph Count07/22/2022 at 12:54 PM #197713great. however, one condition is still missing. If Stop Loss or Take Profit are not triggered, the trade should be closed after 10 trading days at market on close. (e.g. 11 pm for the S&P500).
by the way: must the computer be active with prorealtime for the orders or are the orders placed on the IG market?
07/24/2022 at 11:34 AM #197830This will do:
1234567891011121314151617181920212223242526272829303132ONCE TF = GetTimeFrameONCE Tally = 99IF OpenMonth <> OpenMonth[1] THENTally = 0ENDIFIF OpenDay <> OpenDay[1] THENTally = Tally + 1ENDIFIF Tally = 5 AND Not OnMarket THEN //enter on the closing of the 5th trading dayIF high > high[1] THENBUY 1 CONTRACT AT MARKETSET TARGET pPROFIT 300SET STOP pLOSS 100Count = 0ENDIFENDIFIF OnMarket THENIF OpenDay <> OpenDay[1] THENCount = Count + 1ENDIFIF TF = 86400 THENIF Count = 10 THEN //exit after 10 daysSELL AT MARKETENDIFELSEIF Count = 10 AND Time = 230000 THEN //exit after 10 days at closing timeSELL AT MARKETENDIFENDIFENDIFgraph Tallygraph Countbe warned that if it’s run on a intraday TF, the TIME must be that when the last candle of the day closes (on a 4-hour TF there’s NO candle closing at 23, so you will need to use 21).
1 user thanked author for this post.
07/24/2022 at 1:04 PM #197834by the way: must the computer be active with prorealtime for the orders or are the orders placed on the IG market?
@funkytown, No. The orders are placed by PRT servers; your PC can be shut off (after you started the Autotrading System of concern).07/26/2022 at 2:17 PM #197958 -
AuthorPosts
Find exclusive trading pro-tools on