NexusFi: Find Your Edge


Home Menu

 





Xaverage


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one sam028 with 2 posts (2 thanks)
    2. looks_two banana10 with 2 posts (0 thanks)
    3. looks_3 ABCTG with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,073 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
banana10
New york NY USA
 
Posts: 2 since Sep 2016
Thanks Given: 0
Thanks Received: 0

Hello,

I am trying to find out how to find a similar function "Xaverage" in python.

This is what I have in easylanguage: test = XAverage( Close, Length ) and I am trying to change it into python.

Thank you very much.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
EA
Platforms and Indicators
Datafeed for Atas
Platforms and Indicators
No book, only a stair: journaling fills where price move …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
My Rant with AMP Futures
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,775 since Jun 2009
Thanks Given: 3,837
Thanks Received: 4,703



banana10 View Post
Hello,

I am trying to find out how to find a similar function "Xaverage" in python.

This is what I have in easylanguage: test = XAverage( Close, Length ) and I am trying to change it into python.

Thank you very much.

In pure Python, with NumPy, with another library?


Success requires no deodorant! (Sun Tzu)
Reply With Quote
  #4 (permalink)
banana10
New york NY USA
 
Posts: 2 since Sep 2016
Thanks Given: 0
Thanks Received: 0


sam028 View Post
In pure Python, with NumPy, with another library?

I have installed both libraries:
import matplotlib.pyplot as plt
# import numpy as np

either ones work for me. Thanks a lot.


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

banana10

XAverage is simply an exponential average. I am pretty sure that is either available already or you can easily program it or find code via google.

Regards,

ABCTG


Follow me on X Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,775 since Jun 2009
Thanks Given: 3,837
Thanks Received: 4,703


banana10 View Post
I have installed both libraries:
import matplotlib.pyplot as plt
# import numpy as np

either ones work for me. Thanks a lot.

You can find good examples here.

An easy to understand one is:
 
Code
                            
def moving_average(x, n, type):

    
x = np.asarray(x)
    if 
type=='simple':
        
weights = np.ones(n)
    else:
        
weights = np.exp(np.linspace(-1., 0., n))

    
weights /= weights.sum()

    
a =  np.convolve(x, weights, mode='full')[:len(x)]
    
a[:n] = a[n]
    return 
a 


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:




Last Updated on September 14, 2016


© 2026 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 - Downloads - Top
no new posts