Heiken Ashi indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #158409 quote
    tstephenststephens
    Participant
    New

    I want to use the Heken Ashi indicator in my Back testing.

    Please provide the Pro Real code that allows me to identify when the Heiken Ashi candles change from green to red, and from red to green.

    #158413 quote
    VonasiVonasi
    Moderator
    Master

    tstephens Welcome to the forums.

    Have you tried using the search box that can be found by hovering over your profile image at top right? There is a ton of Heiken Ashi code in the forums.

    Search-Box.png Search-Box.png
    #158495 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    // Heikin-Ashi definition
    once xOpen = open
    xClose     = (open + close + high + low) / 4
    if barindex > 0 then
        xOpen  = (xOpen + xClose[1]) / 2
    endif
    //xLow     = min(low,min(xClose,xOpen))
    //xHigh    = max(high,max(xClose,xOpen))
    //xTypic   = (xHigh + xLow + xClose) / 3
    //xMed     = (xHigh + xLow) / 2
    //xRange   = xHigh - xLow
    //
    Bullish    = xClose > xOpen
    Bearish    = xClose < xOpen
    Red2Green  = (Bullish AND Bearish[1])
    Green2Red  = (Bearish AND Bullish[1])
    Nobody thanked this post
    #231470 quote
    IAmShareCrazyIAmShareCrazy
    Participant
    New

    How would you add a MACD crossover to the Heiken Ashi? Robert you are a guru on here!

    #231484 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I appended the MACD lines:

    // Heikin-Ashi definition
    once xOpen   = open
    xClose       = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen     = (xOpen + xClose[1]) / 2
    endif
    //xLow       = min(low,min(xClose,xOpen))
    //xHigh      = max(high,max(xClose,xOpen))
    //xTypic     = (xHigh + xLow + xClose) / 3
    //xMed       = (xHigh + xLow) / 2
    //xRange     = xHigh - xLow
    //
    Bullish      = xClose > xOpen
    Bearish      = xClose < xOpen
    Red2Green    = (Bullish AND Bearish[1])
    Green2Red    = (Bearish AND Bullish[1])
    //
    MyMACD       = ExponentialAverage[12](xClose) - ExponentialAverage[26](xClose)
    MySignalLine = ExponentialAverage[9](MyMACD)
    MyHisto      = MyMACD - MySignalLine
    //
    CrossOVER    = MyMACD CROSSES OVER  MySignalLine
    CrossUNDER   = MyMACD CROSSES UNDER MySignalLine
Viewing 5 posts - 1 through 5 (of 5 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

Heiken Ashi indicator


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by robertogozzirobertogozzi
2 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/18/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...