Exclude a signal over a date range

Optuma Forums Optuma Scripting Exclude a signal over a date range

Tagged: 

  • This topic has 4 replies, 2 voices, and was last updated 1 year ago by AvatarDean.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41895
    AvatarDean
    • Topics: 13
    • Replies: 25
    • Posts: 38

    Anyone know if it is possible to stop a signal from firing in a script if the signal falls within a certain date range? e.g. want to find every time LOW() is less than lower Bollinger Band, except between the dates 01-01-2015 and 31-12-2016.

    //Script concept

    Signal = LOW() < BB(BARS=20, DEFAULT=LowerLine);

    RangeStart = BARDATE(01-01-2015);

    RangeEnd = BARDATE(31-12-2016);

    Signal and ((BARDATE(CLOSE()) < RangeStart) or (BARDATE(CLOSE()) > RangeEnd));

    Any alternative ideas or methods welcomed.

    Many thanks, Dean M

     

    #41935
    DarrenDarren
    • Topics: 63
    • Replies: 558
    • Posts: 621

    Hi Dean,

    For entire years you can use the YEARNUM() function, so in your example you could use the following:

    V1 = LOW() < BB(DEFAULT=LowerLine, BARS=20);
    V1 and (YEARNUM() < 2015 or YEARNUM() > 2016)

    For specific dates you can use the BARDATE() function, but you would need to know the value which we specify for each date. The best way to see this value for each bar is to add a custom label to your tool tip label – see video here:

    How to Add Custom Tooltip Labels

    The function to add to the label is simply BARDATE(), and then when you mouse over each bar it will give you the value, eg June 27th 2016 was 42,548:

     

    Capture

     

    This can then be used in a formula as per this example to exclude results between that date and February 7th 2017 (42,773):

    V1 = LOW() < BB(DEFAULT=LowerLine, BARS=20);
    V1 and (BARDATE() < 42548 or BARDATE() > 42773)

     

     

    #42003
    AvatarDean
    • Topics: 13
    • Replies: 25
    • Posts: 38

    Darren, thank you so much, what you have provided is absolutely perfect! Really appreciate the super fast response too.

    Many thanks, Dean M

    #57269
    DarrenDarren
    • Topics: 63
    • Replies: 558
    • Posts: 621

    Instead of having to find the bardate value in a script you can now use the STRDATE() function to select the date from a calendar pop up:

    https://help.optuma.com/kb/faq.php?id=922

    #57283
    AvatarDean
    • Topics: 13
    • Replies: 25
    • Posts: 38

    Darren, thank you for the follow-up as a result of the introduction of new functions with the latest release of Optuma. That is super effective in helping me keep my knowledge current. Really appreciated. Cheers, Dean

    1 user thanked author for this post.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close