Moving Average Conditions

Optuma Forums Optuma Scripting Moving Average Conditions

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #62685
    Dan
    • Topics: 5
    • Replies: 0
    • Posts: 5

    I am trying to come up with a simple trend model:
    v1 = MA(BARS=8, CALC=Close);
    v2 = MA(BARS=21, CALC=Close);
    v3 = MA(BARS=89, STYLE=Exponential, CALC=Close);

    if v1 > v2 and v2 > v3 = 1
    if v1 > v2 and v2 < v3  = 2
    if v1 < v2 and v2 > v3 = 3
    if v1 < v2 and v2 < v3 = 4

    What would be the best way to handle these if statements?

    Thanks,
    Dan

    #62697
    Darren
    • Topics: 70
    • Replies: 871
    • Posts: 941

    Hi Dan,

    For IF statement logic see this post: https://forum.optuma.com/topic/using-the-if-function-to-create-a-ranking-value/

    In your example you need to nest two IF statements inside of the first:

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

Pin It on Pinterest