NexusFi: Find Your Edge


Home Menu

 





XAverage array in EasyLanguage


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 6 posts (0 thanks)
    2. looks_two ValutaTrader with 5 posts (2 thanks)
    3. looks_3 zhangrenchang with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 9,490 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 13 posts
    2. attach_file 0 attachments




 
Search this Thread

XAverage array in EasyLanguage

  #11 (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,469 since Jun 2009
Thanks Given: 33,246
Thanks Received: 101,669


ValutaTrader View Post
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.

What method are you using to add values to the array on each bar? The default seems to add to the end of the array, not the beginning.

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 Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Quantum physics & Trading dynamics
The Elite Circle
 
  #12 (permalink)
 
ValutaTrader's Avatar
 ValutaTrader 
Oslo,Norway
 
Experience: Intermediate
Platform: NinjaTrader
Trading: EUR/USD
Posts: 66 since Apr 2011
Thanks Given: 4
Thanks Received: 52

The function that got me started on this, was actually ill written, to some extent, and I could have managed without the array (in that case I put values into it in the wrong order).
So when I was testing the XAverage_a I just made a copy of the price numeric series copying the data into the array for test purposes; and hence getting the 0..N order with 0 being the last. I can see that the normal use of arrays would be to append values at the end of the array at each bar and that would require your function to calc EMA over it.

Follow me on Twitter Reply With Quote
Thanked by:
  #13 (permalink)
dnsarkis
Hong Kong
 
Posts: 2 since Dec 2014
Thanks Given: 0
Thanks Received: 0


Hi,

I've been looking at how to pass the values of an array out of a function in Multicharts so that it can be used in an indicator. I have read this in the Multicharts Programming Guide;

Usage Example (function named "MaxValArray"):
Input: MyNumericArray[M](NumericArray);
Variable: Result(0);
Result = MyNumericArray[0]; //Reset variable each time.
For Value1 = 1 To M begin
if MyNumericArray[Value1] > Result Then Result = MyNumericArray[Value1];
end;
MaxValArray = Result;

However it seems that we are just passing the value of M to this function. Will the Array MyNumericArray now have values that can be used by the indicator when it calls MaxValArray? I can't seem to get this working and getting

------ Compiled with error(s): ------
Invalid array dimension value.
line -1, column -1

Does anyone have an example of a function that can be called by an indicator where the value of an array can be passed in/out of this function?

Many Thanks

Reply With Quote
  #14 (permalink)
zhangrenchang
new york
 
Posts: 1 since Dec 2015
Thanks Given: 0
Thanks Received: 0

you should use
"Input: MyNumericArray[10](NumericArray);"
instead of
Input: MyNumericArray[M](NumericArray);

use real number not a variable


dnsarkis View Post
Hi,

I've been looking at how to pass the values of an array out of a function in Multicharts so that it can be used in an indicator. I have read this in the Multicharts Programming Guide;

Usage Example (function named "MaxValArray"):
Input: MyNumericArray[M](NumericArray);
Variable: Result(0);
Result = MyNumericArray[0]; //Reset variable each time.
For Value1 = 1 To M begin
if MyNumericArray[Value1] > Result Then Result = MyNumericArray[Value1];
end;
MaxValArray = Result;

However it seems that we are just passing the value of M to this function. Will the Array MyNumericArray now have values that can be used by the indicator when it calls MaxValArray? I can't seem to get this working and getting

------ Compiled with error(s): ------
Invalid array dimension value.
line -1, column -1

Does anyone have an example of a function that can be called by an indicator where the value of an array can be passed in/out of this function?

Many Thanks


Reply With Quote




Last Updated on December 16, 2015


© 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