Announcement

Collapse
No announcement yet.

Chaikin Money Flow

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chaikin Money Flow

    Hello,

    I am trying to create the Chaikin Money Flow Percent Oscillator. It is not the Chaikin oscillator which is the MACD of Accumulation/Distribution indicator.


    Below is the standard Accumulation/Distribution formula and I need help with the last line of code ( CMF = (90 day SUM OF dSum / 90 DAY SUM OF dvolume)

    The CMF is a 90 sum of the Accumulation Distribution/ 90 day sum of the instruments volume.

    Can some help?


    function preMain() {
    setStudyTitle("Accumulation/Distribution");
    setCursorLabelName("AccDist");

    }

    // these variables stay "alive" between calls to main()
    var dLastSum = 0.0;
    var dSum = 0.0;

    function main() {
    var nBarState = getBarState();

    if(nBarState == BARSTATE_ALLBARS) {
    dLastSum = 0.0;
    dSum = 0.0;
    }

    var dClose = close(0);
    var dLow = low(0);
    var dHigh = high(0);
    var dVolume = volume(0);

    if(dClose == null || dLow == null || dHigh == null || dVolume == null) {
    return;
    }

    // if a new bar is about to be built, remember
    // the last sum (OBV is an accumulative indicator)
    if(nBarState == BARSTATE_NEWBAR) {
    dLastSum = dSum;
    }

    // restore sum to previous value.
    dSum = dLastSum;

    if( (dClose == dLow && dClose == dHigh) || dHigh == dLow) {
    // do nothing
    } else {
    dSum += (((dClose-dLow)-(dHigh-dClose))/(dHigh-dLow))*dVolume;
    }
    } else {
    CMF = (90 day SUM OF dSum / 90 DAY SUM OF dvolume;
    }
    Attached Files

  • #2
    signalrp1
    Do a search for the keywords “chaikin money flow” and you will find the formula as this has already been done
    Alex


    Originally posted by signalrp1 View Post
    Hello,

    I am trying to create the Chaikin Money Flow Percent Oscillator. It is not the Chaikin oscillator which is the MACD of Accumulation/Distribution indicator.


    Below is the standard Accumulation/Distribution formula and I need help with the last line of code ( CMF = (90 day SUM OF dSum / 90 DAY SUM OF dvolume)

    The CMF is a 90 sum of the Accumulation Distribution/ 90 day sum of the instruments volume.

    Can some help?


    function preMain() {
    setStudyTitle("Accumulation/Distribution");
    setCursorLabelName("AccDist");

    }

    // these variables stay "alive" between calls to main()
    var dLastSum = 0.0;
    var dSum = 0.0;

    function main() {
    var nBarState = getBarState();

    if(nBarState == BARSTATE_ALLBARS) {
    dLastSum = 0.0;
    dSum = 0.0;
    }

    var dClose = close(0);
    var dLow = low(0);
    var dHigh = high(0);
    var dVolume = volume(0);

    if(dClose == null || dLow == null || dHigh == null || dVolume == null) {
    return;
    }

    // if a new bar is about to be built, remember
    // the last sum (OBV is an accumulative indicator)
    if(nBarState == BARSTATE_NEWBAR) {
    dLastSum = dSum;
    }

    // restore sum to previous value.
    dSum = dLastSum;

    if( (dClose == dLow && dClose == dHigh) || dHigh == dLow) {
    // do nothing
    } else {
    dSum += (((dClose-dLow)-(dHigh-dClose))/(dHigh-dLow))*dVolume;
    }
    } else {
    CMF = (90 day SUM OF dSum / 90 DAY SUM OF dvolume;
    }

    Comment


    • #3
      Originally posted by Alexis C. Montenegro View Post
      signalrp1
      Do a search for the keywords “chaikin money flow” and you will find the formula as this has already been done
      Alex
      Hi Alexis,

      The work that has been done is on the Chaikin Oscillator which is a MACD of the Accumulation/Distribution.

      This is not what we are looking for.

      We are looking for the Chaikin Money Flow Percent Oscillator which is a spread Oscillator based off the Accumulation/Distribution. the equation is below from Stock charts .com. We want to make it a 90 day instead of a 20 day.

      1. Money Flow Multiplier = [(Close - Low) - (High - Close)] /(High - Low)

      2. Money Flow Volume = Money Flow Multiplier x Volume for the Period

      3. 20-period CMF = 20-period Sum of Money Flow Volume / 20 period Sum of Volume



      If this has already been done that please show me because I've already looked.

      Thanks.

      Comment


      • #4
        signalrp1
        FYI I am well aware of the difference between the two and as I said in my previous reply the formula has already been done.
        Review the results of the following search for the keywords "chaikin money flow" [image enclosed below illustrates how to set up the same search in case the link is not working]

        Alex




        Originally posted by signalrp1 View Post
        Hi Alexis,

        The work that has been done is on the Chaikin Oscillator which is a MACD of the Accumulation/Distribution.

        This is not what we are looking for.

        We are looking for the Chaikin Money Flow Percent Oscillator which is a spread Oscillator based off the Accumulation/Distribution. the equation is below from Stock charts .com. We want to make it a 90 day instead of a 20 day.

        1. Money Flow Multiplier = [(Close - Low) - (High - Close)] /(High - Low)

        2. Money Flow Volume = Money Flow Multiplier x Volume for the Period

        3. 20-period CMF = 20-period Sum of Money Flow Volume / 20 period Sum of Volume



        If this has already been done that please show me because I've already looked.

        Thanks.

        Comment

        Working...
        X