Moving Average Conditions

Optuma Forums Optuma Scripting Moving Average Conditions


Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #62685
    • 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?


    • Topics: 63
    • Replies: 555
    • Posts: 618

    Hi Dan,

    For IF statement logic see this post:

    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.