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.


  • Topics

  • Posts

    • ...hallucinates.... Student: “What if we gave the monkey LSD?” Guru: “The monkey already did LSD”
    • Question: To those that had/have cancer, what were the signs that made you think “something is not right here” to make you go see a doctor? Answer: So, 5/25/2018, I woke up, got ready for work, and as I walked to my car, I started gagging. Like something was stuck in my throat and I needed to clear it. And then it went away.   But 10 minutes after that, I was T-boned at 40mph on the driver side door. But what made me see a doctor was while my muscles felt better and bruises were going away, the gagging still continued, I started having fevers, my neck felt swollen, I was having such a hard time breathing, and I'd have random sharp pains in my chest, but not from where the seat belt saved me.   2 weeks after the accident, I finally see an urgent care doctor, who looks me over, tells me I'm fine, but luckily requests a neck X-ray. And I ask for a chest X-ray, which he rolls his eyes but let me have (most of my pain was in the neck, so I understand).   The very next day, he calls and says “So, that chest X-ray shows there's a 4 inch mass on your heart and lungs, and your lungs have been filling up with fluid, as well as in your pericardial (heart) wall. We need you to come in tomorrow.”   Turns out the big mass, due to the accident, caused my heart and lungs to tear and fill with fluid, the swollen neck and gagging was caused by 2 metastasized tumors, and the fevers and weight loss were symptoms. Stage 4b Hodgkin's Lymphoma.   But thankfully, we went very aggressive with chemo (and had a lot of bad side effects that don't normally happen to patients), and now I'm about 16 months cancer-free. Yay lucky X-rays! Rachel Jurina, Quora Source: https://www.quora.com/To-those-that-had-have-cancer-what-were-the-signs-that-made-you-think-something-is-not-right-here-to-make-you-go-see-a-doctor   Profits from free accurate cryptos signals: https://www.predictmag.com/  
    • As a man, the reality of life is the harshest part. I don’t mind looking older or becoming weaker over time; it’s nature.   Have you ever heard that the only people who will be loved unconditionally are women and children? Men will only be loved as long as they can provide until they are no longer needed. It doesn’t matter if you already did your best to get your kids to the best school or get the best things for them, if you stop before they’re done with it, there will be no thank you. The only thing they will remember is that they have to quit school at 15, ignoring all the previous 15 years of life you provided for them. The only people who will accept you, no matter what, are your parents. But in this situation, you might be that ungrateful child.   EDIT: Wow, I didn’t think this would get so much attention.   For those who disagree, I can only say that everyone has their problem. If you don’t get the chance to face such a thing, be grateful. Remember, sometimes what you throw in the garbage is something that someone wishes ever to have.” – ElZee, Quora   Profits from free accurate cryptos signals: https://www.predictmag.com/    
    • The good thing i had noticed so far is that the traderpot value is also on the rise..
    • yup its a gradual rollout the right way in my opinion, its really good and its exciting for the sto in 2027
×
×
  • Create New...

Important Information

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