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 Big Mike with 3 posts (3 thanks)
    2. looks_two bobbakerr with 3 posts (0 thanks)
    3. looks_3 vegasfoster with 2 posts (1 thanks)
    4. looks_4 bretter with 2 posts (0 thanks)
    1. trending_up 7,000 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

  #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: 241
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?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Footprint for strategy Builder
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Strategy stop orders partially filled
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
68 thanks
Spoo-nalysis ES e-mini futures S&P 500
21 thanks
Trading with Intuition
18 thanks
GFIs1 1 DAX trade per day journal
15 thanks
The Trading Pit "Futures VIP" Account Journal
15 thanks
  #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
Thanked by:
  #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: 241
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
  #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
  #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
Thanked by:
  #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
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698


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



Join the free Markets Chat beta: one platform, all the trade rooms!

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

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving 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
Thanked by:
  #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
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698


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



Join the free Markets Chat beta: one platform, all the trade rooms!

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

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving 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
Thanked by:
  #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: 241
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
  #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