time-based trading system with trading day of the mounth

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #197694 quote
    funkytown
    Participant
    New

    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.

    #197698 quote
    robertogozzi
    Moderator
    Master

    It’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.

    #197700 quote
    funkytown
    Participant
    New

    There 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.

    #197705 quote
    robertogozzi
    Moderator
    Master

    Yes, knowing them AFTER they occur is possible:

    ONCE Tally = 99
    IF OpenMonth <> OpenMonth[1] THEN
       Tally = 0
    ENDIF
    Tally = Tally + 1
    IF Tally = 5 AND Not OnMarket THEN    //enter on the closing of the 5th trading day
       IF high > high[1] THEN
          BUY 1 CONTRACT AT MARKET
          SET TARGET pPROFIT 300
          SET STOP   pLOSS   100
          Count = 0
       ENDIF
    ENDIF
    IF OnMarket THEN
       Count = Count + 1
       IF Count = 3 THEN    //exit after 3 days
          SELL AT MARKET
       ENDIF
    ENDIF
    graph Tally
    graph Count
    #197713 quote
    funkytown
    Participant
    New

    great. 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?

    #197830 quote
    robertogozzi
    Moderator
    Master

    This will do:

    ONCE TF = GetTimeFrame
    ONCE Tally = 99
    IF OpenMonth <> OpenMonth[1] THEN
    Tally = 0
    ENDIF
    IF OpenDay <> OpenDay[1] THEN
    Tally = Tally + 1
    ENDIF
    IF Tally = 5 AND Not OnMarket THEN           //enter on the closing of the 5th trading day
    IF high > high[1] THEN
    BUY 1 CONTRACT AT MARKET
    SET TARGET pPROFIT 300
    SET STOP   pLOSS   100
    Count = 0
    ENDIF
    ENDIF
    IF OnMarket THEN
    IF OpenDay <> OpenDay[1] THEN
    Count = Count + 1
    ENDIF
    IF TF = 86400 THEN
    IF Count = 10 THEN                     //exit after 10 days
    SELL AT MARKET
    ENDIF
    ELSE
    IF Count = 10 AND Time = 230000 THEN   //exit after 10 days at closing time
    SELL AT MARKET
    ENDIF
    ENDIF
    ENDIF
    graph Tally
    graph Count

    be 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).

    atxeel thanked this post
    #197834 quote
    PeterSt
    Participant
    Master

    by 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).

    #197958 quote
    funkytown
    Participant
    New

    Great, thank you very much.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

time-based trading system with trading day of the mounth


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
funkytown @funkytown Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by funkytown
3 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/22/2022
Status: Active
Attachments: No files
Logo Logo
Loading...