NexusFi: Find Your Edge


Home Menu

 





How to get S&P500's ATR when writing code to create strategy on a stock?


Discussion in TradeStation

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




 
Search this Thread
  #1 (permalink)
hgchcw
Hong Kong + Hong Kong
 
Posts: 18 since Feb 2019
Thanks Given: 9
Thanks Received: 0

I am writing codes to create strategy on a stock. I hope to read the ATR indicator of S&P 500 to use the information of the big market in my strategy. Which commands should I use?

Thanks,
Raymond


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
Oil Surges ~18% in One Week as Iran Conflict Disrupts Gl …
Commodities
Coinbase Launches Regulated Crypto Futures Across 26 Eur …
Cryptocurrency
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

Raymond,

if you are working with Multicharts this can be accomplished by adding an additional data stream to your chart and by referencing this data stream's values. For example "Close of Data2" would access the value for Close of data stream two for a bar.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
hgchcw
Hong Kong + Hong Kong
 
Posts: 18 since Feb 2019
Thanks Given: 9
Thanks Received: 0


ABCTG,

Thanks for your quick reply. But I have tried to write "Close of SPY". It prompts error in tradestation.

Regards,
Raymond


Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

Raymond,

you reference the values by data stream numbers, not by symbol names. Therefore "Close of Data2" is the correct statement to get the close for a data 2 bar (regardless of the symbol name).

Regards,

ABCTG


hgchcw View Post
ABCTG,

Thanks for your quick reply. But I have tried to write "Close of SPY". It prompts error in tradestation.

Regards,
Raymond


Follow me on X Reply With Quote
Thanked by:
  #5 (permalink)
hgchcw
Hong Kong + Hong Kong
 
Posts: 18 since Feb 2019
Thanks Given: 9
Thanks Received: 0

Hi ABCTG,

Thanks, I can read Close of Data2. Since ATR(period) only calculate the ATR of the stock, are there any method to calculate the ATR of Data2 instead of Data1?

Thanks,
Raymond


Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

Raymond,

you are welcome. When working with multiple data streams you need to tie variables to the specific data streams
and also make sure to call the function on the desired data stream.
You can find a good example for the ADX here: https://community.tradestation.com/discussions/Topic_Archive.aspx?Topic_ID=28896

Regards,

ABCTG

P.S.: By the way you can show your appreciation for posts on NexusFi by clicking the "Thanks" button next to a post.


hgchcw View Post
Hi ABCTG,

Thanks, I can read Close of Data2. Since ATR(period) only calculate the ATR of the stock, are there any method to calculate the ATR of Data2 instead of Data1?

Thanks,
Raymond


Follow me on X Reply With Quote
Thanked by:




Last Updated on June 7, 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