Exclude a signal over a date range

Optuma Forums Optuma Scripting Exclude a signal over a date range

This topic contains 2 replies, has 2 voices, and was last updated by  Dean 1 month, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41895

    Dean
    • Topics: 2
    • Replies: 1
    • Posts: 3

    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
    Darren
    Darren
    • Topics: 13
    • Replies: 51
    • Posts: 64

    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

    Dean
    • Topics: 2
    • Replies: 1
    • Posts: 3

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

    Many thanks, Dean M

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

Share This