Stipulate Day of Week in DEFPARAM

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5658 quote
    deletedaccount14122020
    Participant
    New

    Hello,

    I know I can use the DEFPARAM commands FlatBefore and FlatAfter to tell my system the time to start and stop trading but does anyone know how to incorporate the day of the week as well. Example:

    On Monday

    DEFPARAM FlatBefore = 013000 // Cancel any pending orders, close any positions and prevent placement of additional orders by the trading system before 01:30:00 in the time zone of the strategy.

    On Friday

    DEFPARAM FlatAfter = 230000 // Cancel any pending orders, close any positions and prevent placement of additional orders by the trading system after 23:00:00 in the time zone of the strategy.

    Thanks

    #5662 quote
    Nicolas
    Keymaster
    Master

    Sorry it’s not possible to define specific days of week with FlatBefore or FlatAfter. The best you can do is to create a conditional variable that test the days you want to trade or to close your opened orders, like this :

    daytotrade = dayofweek=1 OR dayofweek=2
    
    if condition and daytotrade then ......
    ..
    ...
    ..
    
    ..
    
    endif

     

    Is it ok for you?

    #5670 quote
    deletedaccount14122020
    Participant
    New

    Hi Nicolas, Thanks for the update.and yes I think that works for me. I’ll test it in my system code

    #7550 quote
    mr.brymas
    Participant
    Average

    Hey

    If i don´t want it to take positions on Fridays for example. How do i write it? Something like this?

    k= dayofweek (friday)

    if k then
    allowtrade = 0
    else
    allowtrade = 1
    endif

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

Stipulate Day of Week in DEFPARAM


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by mr.brymas
9 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/19/2016
Status: Active
Attachments: No files
Logo Logo
Loading...