NexusFi: Find Your Edge


Home Menu

 





New to TradeStation/easylanguage -- getting bad data back


Discussion in EasyLanguage Programming

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




 
Search this Thread

New to TradeStation/easylanguage -- getting bad data back

  #1 (permalink)
MrRobot
Knoxville
 
Posts: 3 since Jul 2019
Thanks Given: 1
Thanks Received: 0

Hello,

I came over to TradeStation from Thinkorswim bc they seemed to have more advanced developer tools. I'm trying to write a stdDev price spike indicator which needs the values of Close[0], Close[1], Close[2].

I'm always getting a "can't divide by zero" error and I finally figured out its bc, according to the debugger, the value of Close[1] and Close[2] are always the same price. Regardless of which ticker I'm using the two values will always be the same -- they'll differ from ticker to ticker, but the two closing prices are always the same.

Also, the price data coming back for Close[x] is completely wrong. Every ticker its off by 5 or 10% in the dev env..

I'm using the simulated trading, and the chart data is correct, its just the dev environment is pulling bad data.

I appreciate any suggestions.

Sample:

 
Code
Inputs: Length( 20 );
Variables: CLog(0), SDev(0), StdValue(0), Diff(0);

Value1 = Length;
Value2 = Close[0];
Value3 = Close[1];
Value4 = (Value2 - Value3);
Value5 = Close[2];
Value6 = SquareRoot(Value1 / (Value1 - 1));

// close1 / close2
Value7 = (Value3 / Value5)

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Exit Strategy
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
62 thanks
Funded Trader platforms
42 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
Battlestations: Show us your trading desks!
24 thanks
The Program
17 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


MrRobot,

Tradestation is very sensitive when it comes to divisions and it makes sense to check that the denominator is different than 0 for every division within your code.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
MrRobot
Knoxville
 
Posts: 3 since Jul 2019
Thanks Given: 1
Thanks Received: 0


ABCTG View Post
MrRobot,

Tradestation is very sensitive when it comes to divisions and it makes sense to check that the denominator is different than 0 for every division within your code.

Regards,

ABCTG

Yes, that makes sense. However, the only reason the denominator is 0 is bc its pulling in bad Closing bar data and using the same value for Close[1] and Close[2].

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

MrRobot,

from the code you posted the same value for Close[1] and Close[2] shouldn't be able to result in a denominator of 0. Which makes it likely that the error message you are getting is not caused by Close[1] and Close[2] being equal.

 
Code
Inputs: Length( 20 );
Variables: CLog(0), SDev(0), StdValue(0), Diff(0);

Value1 = Length;
Value2 = Close[0];
Value3 = Close[1];
Value4 = (Value2 - Value3);
Value5 = Close[2];
Value6 = SquareRoot(Value1 / (Value1 - 1));

// close1 / close2
Value7 = (Value3 / Value5)
Regards,

ABCTG


MrRobot View Post
Yes, that makes sense. However, the only reason the denominator is 0 is bc its pulling in bad Closing bar data and using the same value for Close[1] and Close[2].


Follow me on Twitter Reply With Quote




Last Updated on July 15, 2019


© 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