Latest News

2022 Start working on a new website

BBS Trading Expert
Watch the Youtube BBS video and here is a crude oil trading example

 

Want to know more about:

NinjaTrader formulas.

MetaStock formulas.

MetaTrader formulas.

My YouTube videos.

AXIOM business books awards, bronze medal! Thank You!

No longer available!

 

 

Favorite articles in 2010, 11, 12, 14 and 2015 S&C Readers' Choice Awards.

readers choice awards

AXIOM Business Books Awards, bronze medal.

AXIOM award

 

 

 

 


 

NinjaTrader Formulas

HOME   Back to NinjaTraderFormulas Overview

Average heikin ashi closing price

Heikin ashi, Japanese for “average bar”, is a technique using a special kind of candle stick bars for better visualizing price trends. This technique has been introduced by Dan Valcu in the February 2004 issue of Stocks & Commodities magazine.

The original calculation of the heikin ashi candle stick is as follows:
xClose = (Open+High+Low+Close)/4; or the average price of the current bar
xOpen = [xOpen(Previous Bar) + Close(Previous Bar)]/2; or the midpoint of the previous bar
xHigh = Max(High, xOpen, xClose); the highest value in the set
xLow = Min(Low, xOpen, xClose); the lowest value in the set

However, since the xClose component is always less than or equal to the High component, it is redundant within the MAX function of xHigh and a modified xHigh can be defined as: 
modified xHigh = Max(High, xOpen);
The same reasoning is valid for the xLow function:
modified xLow = Min(Low, xOpen);

Next I calculate the average heikin ashi closing price as the result of:
(xClose+xOpen+xHigh+xLow)/4

Special offer: "BBS Band Indicators" DVD

 

You can use the following NinjaTrader formula to calculate
the heikin ashi closing price (SVEhaClose):

// SVEhaClose is Copyright (C) 2013, Sylvain Vervoort <stocata.org>.
// stocata.org reserves the right to modify/overwrite this NinjaScript
// with each release.
// Release V1.0 July, 2012.

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// The average heikin-ashi closing price.
/// </summary>
[Description("The average heikin-ashi closing price")]
public class SVEhaClose : Indicator
{
    #region Variables

       private DataSeries         haOpen;       // heikin ashi open price
       private DataSeries         haC;          // heikin ashi closing price

    #endregion

    /// <summary>
    /// Configuring the indicator called once before any bar data.
    /// </summary>
    protected override void Initialize()
    { 
              Add(new Plot(Color.Black, "haC"));
              haOpen        = new DataSeries(this);
              haC           = new DataSeries(this);
             
              PaintPriceMarkers    = false;
              Overlay              = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    { 
      if (CurrentBar < 1) // minimum 2 bars required
             return;
             
      // Create average heikin-ashi closing price
      haOpen.Set((((Open[1] + High[1] + Low[1] + Close[1]) / 4) + haOpen[1]) / 2);
           Value.Set(((Open[0] + High[0] + Low[0] + Close[0]) / 4 + haOpen[0] +
           Math.Max(High[0], haOpen[0]) + Math.Min(Low[0], haOpen[0])) / 4);
    }

#region Properties

#endregion
}
}

 

Download SVEhaClose

 

Special offer: "Capturing Profit with technical Analysis"

The heikin ashi average closing prices (black) smoothing effect compared to the real closing prices (red).

Heikin ashi closing price

 

Search the Internet

 

HOME   Back to NinjaTrader Formulas Overview


 
 

Risk Disclosure: Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones’ financial security or life style. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical Performance Disclosure: Hypothetical performance results have many inherent limitations, some of which are described below. no representation is being made that any account will or is likely to achieve profits or losses similar to those shown; in fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk of actual trading. for example, the ability to withstand losses or to adhere to a particular trading program in spite of trading losses are material points which can also adversely affect actual trading results. There are numerous other factors related to the markets in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all which can adversely affect trading results.

See more 'Legal Disclosures' in the bottom menu bar!

Copyright © 2007 Stocata.org, All rights reserved.
-->