NexusFi: Find Your Edge


Home Menu

 





Need help with XAverage and so on...


Discussion in EasyLanguage Programming

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




 
Search this Thread

Need help with XAverage and so on...

  #1 (permalink)
OperaMask
Davis, CA/USA
 
Posts: 1 since Apr 2014
Thanks Given: 0
Thanks Received: 0

Hi all,

I program XAverage in my TradeStation. However, some strange things happened:
(1) XAverage(Close, 3) is not what the chart shows EMA(3).
(2) Second, XAverage(Close,3)[1] gives me "0", also for [2][3]...

In addition, similar things happen when I want to code for some indicators turning up or turning down:
Average(ADX(25), 3) is ok, but Average(ADX(25), 3)[1] is 0.

I have some training in programing, but I am new to TradeStation syntax.

Can you give me some help insights?

Thank you very much!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
22 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
15 thanks
GFIs1 1 DAX trade per day journal
15 thanks
EG Indicators
11 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


OperaMask,

I am not exactly sure what is happening on your end, but this code
 
Code
Plot1(XAverage(Close, 3));
Plot2(XAverage(Close, 3)[1]);
produces two EMAs where the second one is returning the previous bar's value from the first XAverage.

What do you mean with " XAverage(Close, 3) is not what the chart shows EMA(3)."?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 ReximusMaximus 
SAINT LOUIS
 
Experience: Advanced
Posts: 40 since Aug 2019
Thanks Given: 7
Thanks Received: 23


ABCTG View Post
OperaMask,

I am not exactly sure what is happening on your end, but this code
 
Code
Plot1(XAverage(Close, 3));
Plot2(XAverage(Close, 3)[1]);
produces two EMAs where the second one is returning the previous bar's value from the first XAverage.

What do you mean with " XAverage(Close, 3) is not what the chart shows EMA(3)."?

Regards,
ABCTG

I am having an issue that sounds like it's related to OP's:

Using this code to produce a 21 EMA:

 
Code
ema = XAverage(close,21);

I print the variable "ema" on a daily chart, and the value printed doesn't match the value shown on the chart.

I noticed this when trades were being placed that looked wrong, and started troubleshooting with the print function.

Is this an issue with the daily bars, or is it some sort of known issue, or am I just missing something very obvious?

Reply With Quote
Thanked by:
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

ReximusMaximus,

keep in mind that some indicators like EMAs have a starting point dependency. When you compare strategy calculations to indicator results that use starting point dependent calculations you will want to make sure that they both start on the same bar. By default the "MaxBarsBack" feature might cause them to start at different points and in turn the values on a given bar can be different due to that. Therefore, it can make sense to manually set the indicator to the same "MaxBarsBack" value as the strategy.
You can read more about this here in the Tradestation wiki:

Starting Point Dependence
The surprising MACD indicator
Understanding MaxBarsBack

Regards,

ABCTG


ReximusMaximus View Post
I am having an issue that sounds like it's related to OP's:

Using this code to produce a 21 EMA:

 
Code
ema = XAverage(close,21);

I print the variable "ema" on a daily chart, and the value printed doesn't match the value shown on the chart.

I noticed this when trades were being placed that looked wrong, and started troubleshooting with the print function.

Is this an issue with the daily bars, or is it some sort of known issue, or am I just missing something very obvious?


Follow me on Twitter Reply With Quote




Last Updated on November 25, 2020


© 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