NexusFi: Find Your Edge


Home Menu

 





Help understanding Tradestation output


Discussion in TradeStation

Updated
    1. trending_up 1,539 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 2 attachments




 
Search this Thread

Help understanding Tradestation output

  #1 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296

I can't believe i am asking this question, but can anyone please tell me what Tradestation is doing here? I am going to show a very simple example rather than my code.

Why does an strategy have different values than an indicator is they use the exact same code? For example, plot the monthly SPY with 2 exponential moving averages (10 & 20).

Here is the indicator and screen capture of the print log:
 
Code
inputs:
	FastPrice(Close),
	SlowPrice(Close),
	FastLength(10),
	SlowLength(20),
	Displace(0);

variables:
	FastAvg(0),
	SlowAvg(0);

FastAvg = XAverage(FastPrice,FastLength);
SlowAvg = XAverage(SlowPrice,SlowLength);
	
Plot1[Displace](FastAvg,"FastAvg",default,default,1);
Plot2[Displace](SlowAvg,"SlowAvg",default,default,1); 

Print(ElDateToString(Date), "; FastPrice: ",FastPrice, "; SlowPrice: ",SlowPrice, "; FastAvg: ",FastAvg, "; SlowAvg: ",SlowAvg);




And here is the strategy with orders removed for brevity:
 
Code
inputs:
	FastPrice(Close),
	SlowPrice(Close),
	FastLength(10),
	SlowLength(20),
	Displace(0);
	
variables:
	FastAvg(0),
	SlowAvg(0);
	
FastAvg = XAverage(FastPrice,FastLength);
SlowAvg = XAverage(SlowPrice,SlowLength);
	
Print(ElDateToString(Date), "; FastPrice: ",FastPrice, "; SlowPrice: ",SlowPrice, "; FastAvg: ",FastAvg, "; SlowAvg: ",SlowAvg); //


Why does the print log show different values for the fast and slow MA's. Yes, before you ask, both are set at 10 & 20?

The strategy values are obviously wrong and throwing off backtesting any strategy.

Alright, let me have it. What foolish mistake am I making?

Thanks in advance. Also, why does Tradestation show a moving average before enough time has elapsed to develop (18 month moving average before 18 data bars)?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #2 (permalink)
 tpredictor 
North Carolina
 
Experience: Beginner
Platform: NinjaTrader, Tradestation
Trading: es
Posts: 644 since Nov 2011

Change the inputs to variables and see if that fixes it. Tradestation does not reset inputs on rebuilds. The other consideration is Exponential Average uses all historical data. The strategy has a MaxBars setting that it uses to determine the start date.

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


Hi GoldenRatio,

the difference might be caused by different max bars back settings for the indicator and strategy. Make sure to set both to the same value and check if the values are the same then. Keep in mind that you are using a start point dependent average (exponential) and the values will not match 100% if the start point is different (although over time they will match close enough most likely).

To answer your question of "Also, why does Tradestation show a moving average before enough time has elapsed to develop (18 month moving average before 18 data bars)?", this depends on the study. The exponential average doesn't look at X bars back only, the length sets the alpha value (smoothing) and it can theoretically be plotted from the first bar on.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296


ABCTG View Post
the difference might be caused by different max bars back settings for the indicator and strategy.

That was it, thanks ABCTG!

I should have known!

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

Hi GoldenRatio,

you are welcome and thank you for the update. No worries, I tend to fall into one of the max bars back pitfalls every once in a while, too.

Regards,

ABCTG


GoldenRatio View Post
That was it, thanks ABCTG!

I should have known!


Follow me on Twitter Reply With Quote




Last Updated on July 23, 2018


© 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