NexusFi: Find Your Edge


Home Menu

 





Simple M.A. Summing Code - Won't compile in MC


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one bobbakerr with 3 posts (0 thanks)
    2. looks_two Big Mike with 3 posts (3 thanks)
    3. looks_3 vegasfoster with 2 posts (1 thanks)
    4. looks_4 bretter with 2 posts (0 thanks)
    1. trending_up 6,608 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 12 posts
    2. attach_file 1 attachments




 
Search this Thread

Simple M.A. Summing Code - Won't compile in MC

(login for full post details)
  #1 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 240
Thanks Received: 51

I read where Big Mike liked using 6 common Moving Averages and then summing them to plot just 1 combined moving average. I wrote some simple code for it, but MC won't compile it. I get the error message:

errLine 13, errColumn 0, errLineEnd 13, errColumnEnd 0
causal study: (Function)


Here is my code:

inputs: Price(Close),L1(9),L2(34),L3(100),L4(20);
variables: s1(0),s2(0),s3(0),s4(0),s5(0),s6(0),SumAll(0);

s1=AverageFC(Price,L1);
s2=AverageFC(Price,L2);
s3=AverageFC(Price,L3);
s4=XAverage(Price,L4);
s5=XAverage(Price,L2);
S6=Xaverage(Price,L3);

SumAll=(s1+s2+s3+s4+s5+s6)/6

if SumAll>0 then begin
Plot1(SumAll,"All",White,default,1);
end;


What have I done wrong? Thanks for any help.

-- Bob

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ISO Equity Curve Indicator
NinjaTrader
IQFeed MBO data experience
The Elite Circle
Request for MACD with option to use different MAs for fa …
NinjaTrader
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Supertradersams Thread Journal on NQ/MNQ
28 thanks
GFIs1 1 DAX trade per day journal
26 thanks
Diary of a simple price action trader
13 thanks
Tao te Trade: way of the WLD
12 thanks
Deaddogs Stock Trading
12 thanks

(login for full post details)
  #3 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844


I don't use mc (yet), but do you need a semi-colon after SumAll=(s1+s2+s3+s4+s5+s6)/6;

Reply With Quote
The following user says Thank You to vegasfoster for this post:
(login for full post details)
  #4 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 240
Thanks Received: 51

Thank you, vegasfoster. I originally had that in, but in messing around with the code it somehow got left out.

But it still won't compile. I now get the error message:

errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
causal study: (Function).

Started this thread Reply With Quote
(login for full post details)
  #5 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844

Sorry, not sure.

Reply With Quote
(login for full post details)
  #6 (permalink)
 philloo 
Canada
 
Experience: Beginner
Platform: Multichart
Posts: 43 since Feb 2010
Thanks Given: 7
Thanks Received: 27


bobbakerr View Post
I read where Big Mike liked using 6 common Moving Averages and then summing them to plot just 1 combined moving average. I wrote some simple code for it, but MC won't compile it. I get the error message:

errLine 13, errColumn 0, errLineEnd 13, errColumnEnd 0
causal study: (Function)


Here is my code:

inputs: Price(Close),L1(9),L2(34),L3(100),L4(20);
variables: s1(0),s2(0),s3(0),s4(0),s5(0),s6(0),SumAll(0);

s1=AverageFC(Price,L1);
s2=AverageFC(Price,L2);
s3=AverageFC(Price,L3);
s4=XAverage(Price,L4);
s5=XAverage(Price,L2);
S6=Xaverage(Price,L3);

SumAll=(s1+s2+s3+s4+s5+s6)/6

if SumAll>0 then begin
Plot1(SumAll,"All",White,default,1);
end;


What have I done wrong? Thanks for any help.

-- Bob

 
Code
inputs:Price(Close),L1(9),L2(34),L3(100),L4(20);
variables:s1(0),s2(0),s3(0),s4(0),s5(0),s6(0),SumAll(0);
s1=AverageFC(Price,L1);
s2=AverageFC(Price,L2);
s3=AverageFC(Price,L3);
s4=XAverage(Price,L4);
s5=XAverage(Price,L2);
S6=Xaverage(Price,L3);
SumAll=(s1+s2+s3+s4+s5+s6)/6;
if SumAll>0 then begin
Plot1(SumAll,"All",White,default,1);
end;
It should work I try it and it is working

phil

Reply With Quote
The following 2 users say Thank You to philloo for this post:
(login for full post details)
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344


philloo View Post
 
Code
inputs:Price(Close),L1(9),L2(34),L3(100),L4(20);
variables:s1(0),s2(0),s3(0),s4(0),s5(0),s6(0),SumAll(0);
s1=AverageFC(Price,L1);
s2=AverageFC(Price,L2);
s3=AverageFC(Price,L3);
s4=XAverage(Price,L4);
s5=XAverage(Price,L2);
S6=Xaverage(Price,L3);
SumAll=(s1+s2+s3+s4+s5+s6)/6;
if SumAll>0 then begin
Plot1(SumAll,"All",White,default,1);
end;
It should work I try it and it is working

phil

Works fine for me as well.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
(login for full post details)
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344


bobbakerr View Post

errLine 13, errColumn 0, errLineEnd 13, errColumnEnd 0
causal study: (Function)

You seem to have created it as a Function. It should be an indicator.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
(login for full post details)
  #9 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 240
Thanks Received: 51

Thanks philloo and Big Mike. Mike, I clicked on 'New', checked the 'Indicator' box, pasted the code in, compiled it, and it worked. Thanks for your help.

Started this thread Reply With Quote
(login for full post details)
  #10 (permalink)
 bretter 
Austin, TX
 
Experience: Advanced
Platform: Tradestation
Posts: 16 since Sep 2010
Thanks Given: 5
Thanks Received: 12


EDIT: It turns out that MC does not support the "Switch" statement in the code. I have used Switch instead of If..Then to speed up the code in TS, but it looks like MC does not have that capability! Ouch!

Brett

Old below:
I have another code set that works great in TS, but transfer over to MC and I get the compile error - Causal study: (Function).
I have reinstalled... no work.
I have reloaded with making sure Indicator is checked... no work.
I have tried commenting all of the different lines and compiling... no work.
Any ideas?

Reply With Quote





Last Updated on July 22, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts