Close < 50% of last 6 months range

Optuma Forums Optuma Scripting Close < 50% of last 6 months range

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #67399
    Marc
    • Topics: 21
    • Replies: 34
    • Posts: 55

    hi,

    I am looking for the stocks with a close > 50% of their last 6 Months range.
    I use the following formula:

    v1= last(high(month(PERIODAMOUNT=1))[6]);
    v2= last(low(month(PERIODAMOUNT=1))[6]);

    6M50=(v1+v2)*0.5;

    close() > 6M50

    I got a bunch of results (ACC,, ADP, ACI…)  where the close is below the 50% line.
    Why isn’t it working pls?

    Thanks
    Marc

    #67401
    Darren
    • Topics: 71
    • Replies: 880
    • Posts: 951

    Hi Marc,

    If you plot your V1 and V2 variables you will see the values returned – ie the monthly highest and lowest prices 6 months ago (remember [6] is an offset, not a lookback).

    Try using the HIGHESTHIGH() and LOWESTLOW() functions to create the range instead.

    #67403
    Marc
    • Topics: 21
    • Replies: 34
    • Posts: 55

    Thanks but I see no difference.  I still have results I should not have.: ACI, ACN, ADP, AEHR…

    v1= last(highesthigh(month(PERIODAMOUNT=6))[1]);
    v2= last(lowestlow(month(PERIODAMOUNT=6))[1]);
    6M50=(v1+v2)*0.5;
    close() > 6M50

    What formula do you use?

    Tanks
    Marc

    #67405
    Darren
    • Topics: 71
    • Replies: 880
    • Posts: 951

    That’s not the syntax for the function… you can’t just type the text – you need to add the function and then click on it to set the required properties from the pop-up box, and it will then fill in the correct text for you ie HIGHESTHIGH(BACKTYPE=Months, BARS=6, INCBAR=True) to get the 6 month high.

    Capture

    You also don’t need the LAST() or the [1] offset, so use LOWESTLOW(BACKTYPE=Months, BARS=6, INCBAR=True) for V2 and it should work.

    See here for other examples of calculating ranges and levels:

    https://forum.optuma.com/topic/50-all-time-high-all-time-range/

    #67407
    Marc
    • Topics: 21
    • Replies: 34
    • Posts: 55

    Ok Thanks Darren. Now I got it 🙂

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

Pin It on Pinterest