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



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


Discussion in TradeStation

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

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

(login for full post details)
  #1 (permalink)
Hong Kong + Hong Kong
 
 
Posts: 18 since Feb 2019
Thanks: 9 given, 0 received

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 futures io?
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
Regarding Multicharts strategy trigger
MultiCharts
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
Cross border fund flows / fx correlations
Treasury Notes and Bonds
ZigZag with Depth and Backstep
EasyLanguage Programming
 
 
(login for full post details)
  #2 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

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 Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #3 (permalink)
Hong Kong + Hong Kong
 
 
Posts: 18 since Feb 2019
Thanks: 9 given, 0 received


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
 
(login for full post details)
  #4 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

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 Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #5 (permalink)
Hong Kong + Hong Kong
 
 
Posts: 18 since Feb 2019
Thanks: 9 given, 0 received

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
 
(login for full post details)
  #6 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

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 futures.io 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 Twitter Reply With Quote
The following 2 users say Thank You to ABCTG for this post:


futures io Trading Community Platforms and Indicators TradeStation > How to get S&P500's ATR when writing code to create strategy on a stock?


Last Updated on June 7, 2019


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts