Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

emptyvault

Chaikin Money Flow Index in MC

Recommended Posts

I found the following code from a web page , but unluckily , it did not plot anything in the multicharts .

Anyone know what is the bug ? I am using in on index so there is volume . After I read the code, I can't sure if the mistake caused by the volume" if and else " . Here is the code ;

 

inputs: len(21) ;

 

var: den(0), den2(0);

 

// Currencies don't always track volume, so this sets the value to zero if there isn't volume

den = summation(V,len);

den2 = H-L;

 

if den = 0 or den2 = 0 then begin

value1 = 0;

end

else begin

value1 = summation(((( C-L ) - ( H-C )) / ( H-L )) * V,len) / den;

end;

 

if value1 > 0 then begin

plot1(value1, "CMF_Hist", red);

plot2(value1, "CMF_Line", red);

end

else begin

plot1(value1, "CMF_Hist", blue);

plot2(value1, "CMF_Line", blue);

end;

 

plot5(0, "Mid");

Share this post


Link to post
Share on other sites
I found the following code from a web page , ...

 

 

 

First order in forum etiquette:

 

Always give credit.

i.e. cite the source !

 

 

Second order in forum etiquette:

 

Give as much info as possible, so that people can start helping you immediately.

i.e. annotated charts, notes, inputs variables, samples outputs, expectations, etc.,

don't expect people to read your mind, or to search for the info you already have.

 

 

Third order in forum etiquette:

 

Don't ASSUME anything

because when you ass-u-me, you make an Ass out of U and Me

 

 

.

Edited by Tams

Share this post


Link to post
Share on other sites

hello ;

Finally I got the help from the Customer Service of multicharts and here is the solution .

Before this there is error at the first time I receive help from them too and after several times of ask and help it was fixed .

The problem maybe because of tick and minutes data . The following codes work in MC , both intraday data and EOD data .

Wish it can help to all MC users . thanks

 

 

{ Chaikin Money Flow }

inputs: len(20);

var: den(0), den2(0);

 

var: vol(0);

if BarType >= 2 then

vol = Volume

else

vol = Ticks;

 

den = summation(vol,len);

den2 = H-L;

if den = 0 or den2 = 0 then begin

value1 = 0;

end

else begin

value2 = ((( C-L ) - ( H-C )) / ( H-L ) * vol);

value1 = summation(value2, len) / den;

end;

if value1 > 0 then begin

plot1(value1, "CMF_Hist", green);

plot2(value1, "CMF_Line", green);

end

else begin

plot1(value1, "CMF_Hist", darkmagenta);

plot2(value1, "CMF_Line", darkmagenta);

end;

plot5(0, "Mid");

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.