NexusFi: Find Your Edge


Home Menu

 





What is wrong with this code?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,032 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

What is wrong with this code?

  #1 (permalink)
dennisconn
Toledo, Ohio
 
Posts: 5 since Jan 2014
Thanks Given: 1
Thanks Received: 1

Howdy all,

I'm trying to create Connie Brown's Composite Indicator in MultiCharts using the TradeStation code provided by Brown. Everything compiles OK, but all the chart values display as zero.

I know next-to-nothing about EL or PL, and I haven't found the indicator code anywhere all ready to go in MultiCharts.

If someone can get this to work in PL, I can then upload it to the forum for others. If the code already exists for PL, then a link to that would be appreciated.



Here is Brown's description/code for the indicator, with some PL mods provided by others:

-Create two functions in EasyLanguage first. The first is a 9-period momentum study of RSI. This can be written as:
RSIDelta = MOMENTUM(RSI(CLOSE,14),9)

-Then a smoothed short period RSI is created,
RSIsma = AVERAGE(RSI(CLOSE,3),3)

-The indicator can then be created:
vars:rsidelta(0),rsisma(0);
Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");


Regards,

DC

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Quantum physics & Trading dynamics
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


DC,

writing the code like this will give you a result. However you might want to clean it up a bit:

 
Code
vars:rsidelta(0),rsisma(0);

RSIDelta = MOMENTUM(RSI(CLOSE,14),9);

RSIsma = AVERAGE(RSI(CLOSE,3),3);

Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");
My guess is your code didn't include the calculations for RSIDelta and RSIsma.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
dennisconn
Toledo, Ohio
 
Posts: 5 since Jan 2014
Thanks Given: 1
Thanks Received: 1


ABCTG View Post
DC,

writing the code like this will give you a result. However you might want to clean it up a bit:

 
Code
vars:rsidelta(0),rsisma(0);

RSIDelta = MOMENTUM(RSI(CLOSE,14),9);

RSIsma = AVERAGE(RSI(CLOSE,3),3);

Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");
My guess is your code didn't include the calculations for RSIDelta and RSIsma.



Regards,
ABCTG

Hi ABCTG,

Thanks for pointing that out - it's all good now!



I didn't realize I had to include the calculations for RSIDelta and RSIsma in the indicator code itself instead of creating them in two separate functions as Brown had...

DC

Reply With Quote
Thanked by:
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

DC,

I suspect you didn't create them as functions properly then. As otherwise it should work the same in EL or PL.
In case RSIdelta and RSIsma are two functions without inputs the following code would work and give the same result as the one I posted.

 
Code
Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");
It might be possible that by declaring two variables with the same name as the two functions you made the code not use the functions.

Regards,
ABCTG


dennisconn View Post
Hi ABCTG,

Thanks for pointing that out - it's all good now!



I didn't realize I had to include the calculations for RSIDelta and RSIsma in the indicator code itself IN ADDITION to already creating them in two separate functions... seems unnecessarily redundant.

Is that an oddity particular to PL that doesn't exist in EL?

DC


Follow me on Twitter Reply With Quote




Last Updated on August 18, 2014


© 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