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

Error Code Help Please

Recommended Posts

I am a newbie in multicharts and easylanguage .

I tried to translate the code I used in metastock to it .

The following is a moving average .

I tested it in the complier but no error return and complied successfully for the first time ,

but when I applied it over a chart , it returned error message and said there are kind of floating calculation error .

Can someone give me a hand ?

(notes , CMO is chande mementum oscillator which was posted here by another kind man earlier )

 

 

{10VIDYA}

inputs: smooth(5);

variable : AbsCMO(0);

variable : SC(0);

variable : vidya10©;

AbsCMO=AbsValue(CMO©)/100;

SC= 2/(smooth+1);

vidya10= (sc*AbsCMO*c)+(1-(SC*AbsCMO))*vidya10[1];

Plot1(vidya10,"vidya10");

:crap:

Share this post


Link to post
Share on other sites

besides a price the cmo needs a period for its calculation,

change

 

AbsCMO=AbsValue(CMO©)/100;

 

by

 

AbsCMO=AbsValue(CMO(C,5))/100;

 

and it should work,

or as you prefere set a input for the CMO's Period

 

good luck

Share this post


Link to post
Share on other sites

Thanks for replying .

I have tried that before . When I added the coma and a figure in it .

It just shown error :

Invalid number of parameters. 1 parameter(s) expected .

 

Did I miss some steps that have to declare the CMO function as it is not built in by the program ?

Share this post


Link to post
Share on other sites

I tried and tried over and over again .

I cannot sure if it is bug or not but it finally seems worked out on some charts only . Some symbols still show same error .....

maybe I have to ask CS for help again ..

Share this post


Link to post
Share on other sites

There are 2 versions of code.

 

if you had imported the PLA version from this thread:

http://www.traderslaboratory.com/forums/f46/cmi-chande-momentum-indicator-6013.html

the CMO function only requires one input.

 

input:

Length(NumericSimple);

 

try 14

 

 

if you had copy and pasted the text code in the 2nd post, you will need 2 inputs:

 

input:

Price(NumericSeries),

Length(NumericSimple);

try

close for price,

and 14 for length.

 

 

.

Edited by Tams

Share this post


Link to post
Share on other sites

dear Tams ,

I used the first one and downloaded there .

Did you try the code I posted if you can see any problem on your computer . As I only success for once but most of the other simbol return error message . I guess maybe it is the problem of MC . If someone tried the code and you can successfully apply to your chart . Please dont mind to tell me .

 

In fact , it is said to be the code of variable index dynamic average of Tuschar Chande which I picked out from my MS program and tried to translate to MC codes . If someone has better way to do it . Please feel free to share .

Share this post


Link to post
Share on other sites
oh , I just found that at MC home page .

There is vidya by Chande, let me see if it is the same old one .

thanks all .

 

 

don't just say "I found it".

For the benefit of all, and as a courtesy,

post a link of your find.

Share this post


Link to post
Share on other sites

this is from tradesignal enterprise should work with ts as well;

is this the vidya you were looking for

 

function "VIDYA"

 

Inputs: 
Price( NumericSeries ), 
Period( NumericSimple ),
Smoothing( NumericSimple );

Variables: 
absCMO, SC;

absCMO = Abs( CMO( Price, Period ) ) / 100;

SC = 2 / ( Smoothing + 1 );

If Currentbar > 1 And IsValid( VIDYA[1] ) Then 
VIDYA = ( SC * absCMO * Price ) + ( 1 - ( SC * absCMO ) ) * VIDYA[1]
Else
VIDYA = Price;

 

function "CMO" for VIDYA's calculation

 

Inputs:
Price( NumericSeries ),
Period( NumericSimple );

Variables:
priceToday, pricePrev, sumUp, sumDown, i;

sumUp = 0; 
sumDown = 0;
For i = 0 To Period - 1 Begin
priceToday = Price[i];
pricePrev = Price[i+1];	
If priceToday > pricePrev Then
	sumUp = sumUp + ( priceToday - pricePrev )
Else If priceToday < pricePrev Then
	sumDown = sumDown + ( pricePrev - priceToday );
End;

If sumUp = 0 Then
CMO = -100
Else If sumDown = 0 Then
CMO = 100
Else If sumUp <> sumDown Then
CMO = 100 * ( ( sumUp - sumDown ) / ( sumUp + sumDown ) )
Else
CMO = 0;

 

VIDYA indicator

 

inputs: Price    ( Close ),
       Period   ( 14 ),
       Smoothing( 4 );

variables: myVIDYA(0);

myVIDYA = VIDYA( Price, Period, Smoothing );

plot1( myVIDYA,"VIDYA" );

Edited by flyingdutchmen

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.