XAverage array in EasyLanguage - EasyLanguage Programming | futures io social day trading
futures io futures trading


XAverage array in EasyLanguage
Updated: Views / Replies:4,518 / 13
Created: by Big Mike 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
 

XAverage array in EasyLanguage

  #1 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

XAverage array in EasyLanguage

Anyone have some helpful code for XAverage of an array in EasyLanguage?

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

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)
Elite Member
Oslo,Norway
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
ValutaTrader's Avatar
 
Posts: 66 since Apr 2011
Thanks: 4 given, 50 received


I think this is close to what you are looking for (function XAverage_a). I am struggling myself to come to terms with the syntax of EasyLanguage, while trying to implement the QQE indicator, so please test it to see if you are comfortable with the result compared to the ordinary EMA

inputs:
PriceValue[M](numericArrayRef),
Len( numericsimple ) ;

variables:
factor( 2 / ( Len + 1 ) ) ;
if CurrentBar = 1 then
XAverage_a = PriceValue[M]
else
XAverage_a = XAverage_a[1] + factor * ( PriceValue[1] - XAverage_a[1] ) ;

Reply With Quote
The following user says Thank You to ValutaTrader for this post:
 
  #4 (permalink)
Elite Member
Oslo,Norway
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
ValutaTrader's Avatar
 
Posts: 66 since Apr 2011
Thanks: 4 given, 50 received

I created a test myself, and I am disappointed to see that they are not 100% identical. The code is based on XAverage, and I cannot yet see where the small difference come from, but it is slightly different. Perhaps I will know when I have gained more experience with EasyLanguage myself.
Here is the indicator used to compare the two

inputs:
Price( Close ),
Value1Color( green ),
Value2Color( Yellow ) ;
Arrays:
buffer[100](0);
variables:
emaNormal( 0 ), j(0) , emaArr(0);

emaNormal=XAverage(Price,13);

For j=0 to 99
begin
buffer[j]=Price[j];
end;

emaArr=XAverage_a(buffer,13);

Plot1( emaNormal[0], "EMA normal" ) ;
Plot2( emaArr[0], "EMA array" ) ;

SetPlotColor( 1, Value1Color);
SetPlotColor( 2, Value2Color);

Reply With Quote
 
  #5 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received


ValutaTrader View Post
I think this is close to what you are looking for (function XAverage_a). I am struggling myself to come to terms with the syntax of EasyLanguage, while trying to implement the QQE indicator, so please test it to see if you are comfortable with the result compared to the ordinary EMA

inputs:
PriceValue[M](numericArrayRef),
Len( numericsimple ) ;

variables:
factor( 2 / ( Len + 1 ) ) ;
if CurrentBar = 1 then
XAverage_a = PriceValue[M]
else
XAverage_a = XAverage_a[1] + factor * ( PriceValue[1] - XAverage_a[1] ) ;

I tried this at first glance, too. But I think the problem is that the XAverage code is looking at the previous value in the dataseries [1], whereas when you use the array it is incremented so that the most recent value is not [0] or [1] but is instead the currentbar number.

So you would need to inverse the array, or the XAverage math, and this is where I got stuck.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

This code works, but it is painfully slow.

 
Code
// function
inputs:
PriceValue[M](numericArrayRef),
Len( numericsimple ) ;

variables:
factor( 2 / ( Len + 1 ) ) ;
if CurrentBar = 1 then
XAverage_Array = PriceValue[M]
else
XAverage_Array = XAverage_Array[1] + factor * ( PriceValue[Array_GetMaxIndex(PriceValue)-1] - XAverage_Array[1] ) ;
It matches the built-in XAverage EMA. But it is unusable because it is so slow.

The small change is:
PriceValue[Array_GetMaxIndex(PriceValue)-1]

I also tried creating a new array and just copying the last 'length' into it, but because this happens on every new bar, it is equally as slow. The issue seems to be moving to the end of array backwards.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #7 (permalink)
Elite Member
Oslo,Norway
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
ValutaTrader's Avatar
 
Posts: 66 since Apr 2011
Thanks: 4 given, 50 received

Played around with it, and referring to index 0 of price seems to do the trick. Not sure why though

XAverage_a = XAverage_a[1] + factor * ( PriceValue[0] - XAverage_a[1] ) ;

Reply With Quote
 
  #8 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received


ValutaTrader View Post
Played around with it, and referring to index 0 of price seems to do the trick. Not sure why though

XAverage_a = XAverage_a[1] + factor * ( PriceValue[0] - XAverage_a[1] ) ;

Not for me, that produced very wrong results.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #9 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

If your array size matches the currentbar figure, you could skip the Array_GetMaxIndex() function and just use currentbar, it is faster - but still somewhat slow.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #10 (permalink)
Elite Member
Oslo,Norway
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
ValutaTrader's Avatar
 
Posts: 66 since Apr 2011
Thanks: 4 given, 50 received


Ok, I see why we got different results. Your function did not give the correct result on my side, and it is because the array that I tested with had the last price in index 0 and not the other way around. Not sure how to speed up the lookup of the last/max index when the data is stored the other way around.

Reply With Quote

Reply



futures io > > > > > XAverage array in EasyLanguage

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
Filling an array with all trades done onava EasyLanguage Programming 5 April 27th, 2012 06:10 AM
EasyLanguage vs NinjaScript Traderji Platforms and Indicators 2 October 22nd, 2010 02:00 AM
Two dimensional array in EasyLanguage Big Mike EasyLanguage Programming 6 August 17th, 2010 07:23 PM
Easylanguage vs. C++ Cogito ergo sum EasyLanguage Programming 10 August 2nd, 2010 03:12 PM


All times are GMT -4. The time now is 08:29 PM.

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-16 in 0.12 seconds with 19 queries on phoenix via your IP 54.160.245.121