Moving Average Conditions

Optuma Forums Optuma Scripting Moving Average Conditions

Tagged: 

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

    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
    DarrenDarren
    • Topics: 63
    • Replies: 555
    • Posts: 618

    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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close