prevent weekend trading

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #173484 quote
    nonetheless
    Participant
    Master

    Is there a better way to do this? I’ve added

    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    but it just opened a position at 21:15 Sunday eve (Eur/USD).

    #173485 quote
    robertogozzi
    Moderator
    Master

    Add this indicator to your chart, to apot what is wrong:

    Return OpenDayOfWeek
    nonetheless thanked this post
    #173490 quote
    nonetheless
    Participant
    Master

    You mean add that line to the code? it’s giving me a yellow triangle for ‘missing characters’

    also tried

    Return OpenDayOfWeek COLOURED(210,105,30) AS "tradingdays"
    #173500 quote
    robertogozzi
    Moderator
    Master

    It’s a single line indicator that will return the day of the week, so you can better tell when your condition in your strategy differs, maybe comparing that indicator with the output of GRAPH OpenDayOfWeek.

    #173503 quote
    nonetheless
    Participant
    Master

    Adding or removing

    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    makes no difference at all, loads of Sunday trades either way. In the UK the Forex restart is 21:00 Sunday, but it looks as if PRC treats it as Monday already.

    #173511 quote
    robertogozzi
    Moderator
    Master

    Both on a 4h and Daily TF, OpenDayOfWeek returns 0 for the sunday bar.

    Try this:

    daysForbiddenEntry = OpenDayOfWeek > 5 OR OpenDayOfWeek < 1

    or you may have misused variable daysForbiddenEntry, in your code.
    Have you used NOT with daysForbiddenEntry ?

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

prevent weekend trading


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/11/2021
Status: Active
Attachments: No files
Logo Logo
Loading...