Help with Last Occurring Signal Script

Optuma Forums Optuma Scripting Help with Last Occurring Signal Script

  • This topic has 4 replies, 2 voices, and was last updated 2 months ago by Dan.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #71735
    Dan
    • Topics: 5
    • Replies: 9
    • Posts: 14

    Hi. I am trying to capture the last time a Signal occurred.
    I am capturing a high pivot as a Signal and tried using BARDATE where the Signal occurs and then returning the last BARDATE.
    Nothing appears to happen when I use this in a Show Bar:

    #71738
    Matthew
    • Topics: 5
    • Replies: 688
    • Posts: 693

    Hi,

    I think the issue is with the V3 variable, the two items within the brackets need to swap order.

    • This reply was modified 2 months ago by Matthew.
    #71741
    Dan
    • Topics: 5
    • Replies: 9
    • Posts: 14

    Thanks for the correction. However, I could not get it to work:

    cond1 = HIGH() > HIGH(OFFSET=1);
    cond2 = HIGH() > HIGH(OFFSET=-1);
    sig = cond1 and cond2;
    v2 = BARDATE();
    v3 = VALUEWHEN(v2, sig);
    v4 = v2 == LAST(v3);
    v4

    But when I tried the following instead, it worked:

    cond1 = HIGH() > HIGH(OFFSET=1);
    cond2 = HIGH() > HIGH(OFFSET=-1);
    sig = cond1 and cond2;
    v2 = BARDATE();
    v3 = VALUEWHEN(HIGH(), sig);
    v4 = HIGH() == LAST(v3);
    v4

    The problem with the latter script is that the same High, even if rare, can possibly occur multiple times and I want the last bar where the Signal is true.

    #71742
    Matthew
    • Topics: 5
    • Replies: 688
    • Posts: 693

    Which part of the adjusted script did not work for you?

    I’ve used it here and checked it against the raw output of the SIG variable it is producing the expected result.

    ex18

    #71743
    Dan
    • Topics: 5
    • Replies: 9
    • Posts: 14

    It appears to be working now.
    For some reason it was slow to appear and I had to click somewhere on the chart after applying the Show Bar.
    Might need a reboot.
    Thanks for clarifying.

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

Pin It on Pinterest