ACCSINCESIGNAL problem

Optuma Forums Optuma Scripting ACCSINCESIGNAL problem

  • This topic has 4 replies, 2 voices, and was last updated 1 year ago by AvatarKim.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #57061
    AvatarKim
    • Topics: 15
    • Replies: 18
    • Posts: 33

    Hi,

    I’m trying to use ACCSINCESIGNAL but can’t get it to work, no doubt something simple but I can’t see it.

    I want to count the number of bars where a MA has been down since the MA turned down.

    Any assistance in spotting the obvious error will be greatly appreciated! 🙂

    10MA = MA(Day(), STYLE=Weighted, BARS=10, CALC=HLC) ;
    10MATurn = 10MA TurnsDown ;
    V1 = IF(10MA IsDown, 1, 0) ;
    V2 = BARDATE(10MATurn) ;
    DownCount = ACCSINCESIGNAL(V1, V2) ;
    DownCount < 5

    #57063
    DarrenDarren
    • Topics: 66
    • Replies: 594
    • Posts: 660

    Hi Kim,

    Try the TIMESINCESIGNAL() function instead. This will count days since it turned up (positive number) or since it turned down (negative).

    The blue Show Bars indicate when the 10WMA turns, so SAR:ASX turned up 42 days ago, whereas OML:ASX turned down 23 days ago:

    Capture

    For more TIMESINCESIGNAL examples see here:

    https://forum.optuma.com/topic/timesincesignal-formulas/

    #57069
    AvatarKim
    • Topics: 15
    • Replies: 18
    • Posts: 33

    Thanks Darren, but I haven’t explained my goal properly. I want to know how many of the bars since the signal were down rather than just how long ago it was.

    For example, I’d like the script to tell me it turned 8 bars ago and since then have 5 or more bars been “IsDown”?

    Is that possible?

     

    #57071
    DarrenDarren
    • Topics: 66
    • Replies: 594
    • Posts: 660

    Ah OK sorry. You don’t need to specify a date in the ACCSINCESIGNAL function – it implies the date when the turn is triggered. To count the number of down days since a turn:

    So taking the previous example, both SAR:ASX and OML:ASX have had 15 down days since the 10WMA turned (including signal day):

    Capture

    #57073
    AvatarKim
    • Topics: 15
    • Replies: 18
    • Posts: 33

    So simple yet exactly what I need – many thanks!!

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

Pin It on Pinterest