NexusFi: Find Your Edge


Home Menu

 





New to TradeStation/easylanguage -- getting bad data back


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
No book, only a stair: journaling fills where price move …
Cryptocurrency
My Rant with AMP Futures
Trading Reviews and Vendors
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Datafeed for Atas
Platforms and Indicators
Trump Media to sell instant access to market-moving soci …
Traders Hideout
 
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)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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 X Reply With Quote




Last Updated on July 15, 2019


© 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