Which weekday is Sunday – can code measure bid offer spread?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #219030 quote
    SkySurferBlue
    Participant
    New

    Hi

    I had code running from the beginning of this week and it had the following filter.

    If Dayofweek = 7 then

    TradeOK =0

    else

    Tradeok =1

    endif

    The code proceeded to execute a trade at market open around 10:03pm (Berlin time)

    So my filter did not stop it.

    If I change it to

    If Dayofweek >= 1 then

    TradeOK =1

    else

    Tradeok =0

    endif

    Then it did prevent the trade. But it will create other problems for my code and if Sunday is regarded as 7 then it may still place a trade.

    I do not want to let the algos trade so early at the start of the week as bid offer spreads are too wide and unpredictable.

    Is there maybe another solution where one can create code that measures the current bid offer spread to create a better filter?

    #219031 quote
    Nicolas
    Keymaster
    Master

    There is no way to get the spread by code.

    In order to limit orders during the day, you can add conditions based on TIME:

    gotrade = time>=080000 
    
    if gotrade and BuyCondition then 
     buy at market 
    endif
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Which weekday is Sunday – can code measure bid offer spread?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
2 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/14/2023
Status: Active
Attachments: No files
Logo Logo
Loading...