moving average direction help

Optuma Forums Optuma Scripting moving average direction help

This topic contains 2 replies, has 2 voices, and was last updated by  Tim 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45431

    Tim
    • Topics: 4
    • Replies: 3
    • Posts: 7

    Hi folks just chasing coding for colouring bars etc according to the direction of the moving average, ie up or down.  I am well aware of codes such as 

    MA(BARS=50, STYLE=Exponential, CALC=Close) IsUp etc  but that code works on where bars are above or below average.  I am actually just wanting the direction of the slope irrespective of whether the bars are under or over the moving average.  I am able to code etc according to volatility of moving average but again the problme is it always is relative to over or under the moving average.

    I only care about the direction of the slope

     

    thanks

    #45483
    Darren
    Darren
    • Topics: 20
    • Replies: 83
    • Posts: 103

    Hi Tim,

    That example you gave is only for the direction of the slope of the MA50 – it does not look at where the price is in relation to the moving average. As such, this is all you need to set the bar colours for when the 50EMA is sloping up:

    MA(BARS=50, STYLE=Exponential, CALC=Close) IsUp

    Because of the way exponential moving averages are calculated (ie more weight given to the most recent bars) then it looks like the price is always below the 50EMA when the slope is down. Change to a simple moving average and you will see the difference.

    #45491

    Tim
    • Topics: 4
    • Replies: 3
    • Posts: 7

    Thanks Darren did not think of that difference, much appreciated.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

Share This

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