NexusFi: Find Your Edge


Home Menu

 





Average True Range Data 2


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one Waterstreet with 2 posts (0 thanks)
    2. looks_two happymichael21 with 1 posts (0 thanks)
    3. looks_3 bobb with 1 posts (1 thanks)
    4. looks_4 manev31 with 1 posts (0 thanks)
    1. trending_up 5,979 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

Average True Range Data 2

  #1 (permalink)
Waterstreet
Miami FL
 
Posts: 2 since Feb 2013
Thanks Given: 0
Thanks Received: 0

i am trying to create the indicator for the ATR of data2 here is the code:

 
Code
inputs: ATRLength(14);
variables: TrueHigh2(0), TrueLow2(0),TrueRange2(0);

if Close[1]of data2 > High of data2 then
	TrueHigh2 = Close[1] of data2
else
	TrueHigh2 = High of data2  ;
	
if Close[1] of data2  < Low of data2  then 
	TrueLow2 = Close[1] of data2  
else
	TrueLow2 = Low of data2  ;
	  
TrueRange2 = TrueHigh2 - TrueLow2 ;

ATR = Average( TrueRange2, ATRLength );

but it seems to produce different results then running the ATR directly on daily bars... can anyone see anything wrong with the code?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
Waterstreet
Miami FL
 
Posts: 2 since Feb 2013
Thanks Given: 0
Thanks Received: 0

i see what its doing... if you apply it to a daily chart it works fine.. its because im trying to get the daily ATR using data2 that im having the problems cause of when its trying to update the indicator.

Reply With Quote
  #3 (permalink)
 
bobb's Avatar
 bobb 
near Vienna Austria
 
Experience: Intermediate
Platform: TradeStation, MultiCharts
Trading: Stocks, Forex
Posts: 6 since Apr 2012
Thanks Given: 1
Thanks Received: 1


@Waterstreet

found this in TS Forum and it works fine for me, but it's not writen for data 2 so you must adapt it.
Shows 3 different Ranges

1. previous days lookback periode
2. previous days range
3. todays range intraday ...this what you are looking for

Hope it helps

Attached Files
Elite Membership required to download: DAILY TRUE RANGE.ELD
Reply With Quote
Thanked by:
  #4 (permalink)
 manev31 
Switzerland
 
Experience: Intermediate
Platform: Tradestation, Python
Trading: Forex
Posts: 12 since Aug 2014
Thanks Given: 2
Thanks Received: 1

Hi, I was wondering if someone could help me with adding ATR data2 in this strategy:


 
Code
inputs: Price(      Close), FastLength(      50), SlowLength(    55), BuyLevel (25), ATRLength (14) ;
variables: FastAvg( 0 ), SlowAvg( 0 ), ATR( 0 ) ;

FastAvg = AverageFC( Price, FastLength ) ;
SlowAvg = AverageFC( Price, SlowLength ) ;


if CurrentBar > 1 and FastAvg crosses over SlowAvg and AvgTrueRange(data2, ATRLength ) < BuyLevel  then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
	Buy ( "MA2CrossLE" ) next bar at market ;
I have tired something but it doesn't work.

Any help is appreciated

Thanks

Reply With Quote
  #5 (permalink)
happymichael21
Rocky Hill + NJ/USA
 
Posts: 1 since Feb 2017
Thanks Given: 0
Thanks Received: 0

Waterstreet and Manev,

I created an ATR of data2 by doing this:

1) First I created a new Function called ATR_D2:

Two relevant lines are in it. The key part of the new function is calling TrueRange of data2.

inputs: Length( numericsimple ) ;

ATR_D2 = Average( TrueRange of data2, Length ) ;

2) Then from wherever you want to call the new ATR_D2 (from a strategy or function or indicator):

Inside the strategy I named a variable for the ATR for data2 and called it 'ATR_d2'.

ATR_d2 = ATR_D2 (Atr_length); // of data2

Hopefully that will work for you.

Wishing you good luck.

Reply With Quote




Last Updated on February 18, 2017


© 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