What is wrong with this code? - futures io
futures io



What is wrong with this code?


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

What is wrong with this code?

(login for full post details)
  #1 (permalink)
dennisconn
Toledo, Ohio
 
 
Posts: 5 since Jan 2014
Thanks: 1 given, 1 received

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

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(106 thanks from 17 posts)
looks_twoSalao's Journalby Salao
(32 thanks from 8 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(28 thanks from 11 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(14 thanks from 9 posts)
looks_5Maybe a little bit different journalby Malykubo
(9 thanks from 8 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Would You Sell Your System?
73 thanks
The Crude Dude Oil Trading System
42 thanks
Big Mike in Ecuador
40 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
25 thanks
futures io site changelog and issues/problem reporting
24 thanks
 
(login for full post details)
  #3 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,236 since Apr 2013
Thanks: 415 given, 1,486 received


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
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #4 (permalink)
dennisconn
Toledo, Ohio
 
 
Posts: 5 since Jan 2014
Thanks: 1 given, 1 received


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
The following user says Thank You to dennisconn for this post:
 
(login for full post details)
  #5 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,236 since Apr 2013
Thanks: 415 given, 1,486 received

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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > What is wrong with this code?


Last Updated on August 18, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April

Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts