Determine if MA is sloping up or down

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #187045 quote
    krogenkrogen
    Participant
    New

    Hi again,

    I use a for loop to loop through the bars and determine if a 50 MA is sloping up or down. Is there an easier way to do this? Perhaps a built in function?

    I’m sorry I just can’t find it!

    k

    #187047 quote
    JSJS
    Participant
    Master

    Hi @krogen

    You can make a indicator for this for example with colors.

     

    ma = average[50](Close)
    slope = ma - ma[1]
    
    
    if slope > 0 then
    if slope > slope[1] then
    g = 255
    r = 0
    elsif slope < slope[1] then
    g = 200
    r = 0
    endif
    elsif slope < 0 then
    if slope < slope[1] then
    r = 255
    g = 0
    elsif slope > slope[1] then
    r = 200
    g = 0
    endif
    endif
    
    return slope coloured(r, g, 10) style(histogram, 1)
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Determine if MA is sloping up or down


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
krogen @krogen Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JSJS
4 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/30/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...