Passing array to function such as average or RSI? - EasyLanguage Programming | futures io social day trading
futures io futures trading


Passing array to function such as average or RSI?
Updated: Views / Replies:1,421 / 7
Created: by maisatomai Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Passing array to function such as average or RSI?

  #1 (permalink)
Trading Apprentice
Singapore
 
Futures Experience: Beginner
Platform: MultiChart
Favorite Futures: ES
 
Posts: 3 since Apr 2014
Thanks: 0 given, 0 received

Passing array to function such as average or RSI?

 
Code
Hivalue10=average(HighDaily[0],2); 
value11=(HighDaily[0]+HighDaily[1])/2;
This works as value10 has same value as value11

 
Code
value10=average(HighDaily[0],3); 
value11=(HighDaily[0]+HighDaily[1]+HighDaily[2])/3;
This don't work as value10 has different value as value11

HighDaily is of type Array. Anyone know why and how can I fix it? I hope to convert array into a PriceSeries as I suspect we need to pass PriceSeries into average for it to work well. I need this to work as I need it to use on other functions like RSI

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,255 received


instead of

 
Code
value10=average(HighDaily[0],3);
I think you should try

 
Code
value10=average(HighDaily,3);
If you call average on HighDaily[0] it's just averaging 1 value I suppose. I'm not a EL programmer but either way it just doesn't look right.

Reply With Quote
 
  #4 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 854 received
Forum Reputation: Legendary

maisatomai,

in my opinion it's just a coincidence that your first example gives the correct result.

 
Code
Arrays:
	HighDaily[2]	(0);
	
once 
begin
	HighDaily[0] = 100 ;
	HighDaily[1] = 200 ;	
	HighDaily[2] = 300 ;
	
	Value1 = Average(HighDaily[0],2); 
	Value2 = (HighDaily[0]+HighDaily[1])/2;
	
	Print("Value1: ", Value1, "; Value2: ", Value2);

end;
The output looks like this: Value1: 50.00; Value2: 150.00

This example also demonstrates why what you are trying doesn't work, the functions don't cycle through your arrays, but reference the previous bar's value for the same position in the array.

You can pass arrays to functions, but you'd need to rewrite those functions to handle the array properly.

Regards,
ABCTG





maisatomai View Post
 
Code
Hivalue10=average(HighDaily[0],2); 
value11=(HighDaily[0]+HighDaily[1])/2;
This works as value10 has same value as value11

 
Code
value10=average(HighDaily[0],3); 
value11=(HighDaily[0]+HighDaily[1]+HighDaily[2])/3;
This don't work as value10 has different value as value11

HighDaily is of type Array. Anyone know why and how can I fix it? I hope to convert array into a PriceSeries as I suspect we need to pass PriceSeries into average for it to work well. I need this to work as I need it to use on other functions like RSI


Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Singapore
 
Futures Experience: Beginner
Platform: MultiChart
Favorite Futures: ES
 
Posts: 3 since Apr 2014
Thanks: 0 given, 0 received

@ABCTG

I understand what you mean. So is there any way I can pass my array into default function such as RSI and average? Or must I write my own RSI as RSI seems to take in NumericSeries and Array is NumericSimple

Reply With Quote
 
  #6 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 854 received
Forum Reputation: Legendary

maisatomai,

in my opinion you'll have to rewrite/adapt the functions.

Regards,
ABCTG

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Singapore
 
Futures Experience: Beginner
Platform: MultiChart
Favorite Futures: ES
 
Posts: 3 since Apr 2014
Thanks: 0 given, 0 received


ABCTG View Post
maisatomai,

in my opinion you'll have to rewrite/adapt the functions.

Regards,
ABCTG

thanks a lot for your help

Reply With Quote
 
  #8 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 854 received
Forum Reputation: Legendary

maisatomai,

you are welcome. In case you run into any issues with the rewrite, just post back here and I am sure someone is able to steer you into the right direction.

Regards,
ABCTG

Reply With Quote

Reply



futures io > > > > > Passing array to function such as average or RSI?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a moving average to RSI Werd ThinkOrSwim 7 January 5th, 2016 07:16 PM
How to use if() function to check value returned from cross() function vampirelord AmiBroker 4 March 28th, 2014 01:23 PM
MA into array no erocla MultiCharts 1 December 19th, 2013 03:06 PM
RSI different between indicator and function ivanyu EasyLanguage Programming 3 August 17th, 2013 10:40 AM
Moving Average of RSI Blz17 NinjaTrader Programming 6 February 12th, 2011 02:52 PM


All times are GMT -4. The time now is 08:28 AM.

Copyright © 2017 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
Page generated 2017-12-15 in 0.12 seconds with 19 queries on phoenix via your IP 54.234.247.118