Heiken Ashi indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #158409 quote
    tstephens
    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
    Vonasi
    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.

    #158495 quote
    robertogozzi
    Moderator
    Master

    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
    IAmShareCrazy
    Participant
    New

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

    #231484 quote
    robertogozzi
    Moderator
    Master

    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.

Heiken Ashi indicator


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by robertogozzi
1 year, 10 months ago.

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