Identify big Average true range - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


Identify big Average true range
Updated: Views / Replies:649 / 4
Created: by russ12345 Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Identify big Average true range

  #1 (permalink)
Elite Member
brooklyn new york/usa
 
Futures Experience: Beginner
Platform: tos
Favorite Futures: futures
 
Posts: 9 since Jan 2013
Thanks: 0 given, 0 received

Identify big Average true range

Hello,

I am new to think or swim programming and am trying to create an indicator that colors the average true range bar (with a 1 bar period) red if it is a down bar that is 20% greater than the 14 period atr. Same thing for an Up bar - color it green if it is a 20% greater than the 14 period atr. Basically i am just trying to identify big range bars.

Thank you and I appreciate any help with this.

peace

russ123

Reply With Quote
 
  #2 (permalink)
Trading Apprentice
albuquerque nm/usa
 
Futures Experience: Intermediate
Platform: thinkorswim
Favorite Futures: forex
 
Posts: 29 since Aug 2015
Thanks: 3 given, 8 received


russ12345 View Post
Hello,
I am new to think or swim programming and am trying to create an indicator that colors the average true range bar (with a 1 bar period) red if it is a down bar that is 20% greater than the 14 period atr. Same thing for an Up bar - color it green if it is a 20% greater than the 14 period atr. Basically i am just trying to identify big range bars.
Thank you and I appreciate any help with this.
peace
russ123

russ123 , does this meet your needs? My experience is that TOS won't display more than one "color bar" at a time. So I think you have to run two separate studies at the same time, unless somebody knows a workaround to run both in one study. So in the below code, run one as-is and run a copy of it but remove the # from the AssignPriceColor for downbar and move it to the AssignPriceColor for upbar. Interesting, I just finished writing a TS tutorial and covered this or I wouldn't have known about only one colorbar being displayable. Hope this helps.
P.S.- I used "magenta" not red so I could see it on my charts. Just change magenta to red.
 
Code
def myATR = reference ATR;
def downbar = close<open;
def upbar = close>open;
def downbar20 = close>=myATR*1.20;
def upbar20 = close>=myATR*1.20;
AssignPriceColor(if downbar AND downbar20 then color.magenta else Color.CURRENT);
#AssignPriceColor(if upbar AND upbar20 then color.green else Color.CURRENT);

Reply With Quote
The following user says Thank You to tangerine for this post:
 
  #3 (permalink)
Trading Apprentice
cologne / nrw
 
Futures Experience: Intermediate
Platform: not found yet
Favorite Futures: YM,FXDM,6J
 
Posts: 2 since Jul 2013
Thanks: 2 given, 0 received

background color


Hi
i'm also new to tos script-writing and i want to create a similar script like russ:
i want the background color of the main chart to become (e.g.) green when the macd line is above zero and above the signal line, and red if it goes vice versa. in all other cases the color of the background should stay as default (neutral).
this would be an enormous step up to my strategy.
does someone know how to...?

upfront thanks

Ross

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
albuquerque nm/usa
 
Futures Experience: Intermediate
Platform: thinkorswim
Favorite Futures: forex
 
Posts: 29 since Aug 2015
Thanks: 3 given, 8 received

spywon and Russ12345:

spywon View Post
Hi
i'm also new to tos script-writing and i want to create a similar script like russ:
i want the background color of the main chart to become (e.g.) green when the macd line is above zero and above the signal line, and red if it goes vice versa. in all other cases the color of the background should stay as default (neutral).
this would be an enormous step up to my strategy.
does someone know how to...?
upfront thanks
Ross

spywon, this works (I put the code I added to MACD at the end in bold blue, so you understand how to do this with any other indicator):
 
Code
declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close,
slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up")
else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down")
else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
def mycolor1 = VALUE>ZEROLINE AND VALUE>AVG;
def mycolor2 = VALUE<ZEROLINE AND VALUE<AVG;
AssignBackgroundColor(if mycolor1 then color.green else if mycolor2 then color.red
else Color.CURRENT);
And Russ12345, I learn something every day. Turns out you CAN put more than one colorbar in the study, like this:
 
Code
def myATR = reference ATR;
def downbar = close<open;
def upbar = close>open;
def downbar20 = close>=myATR*1.20;
def upbar20 = close>=myATR*1.20;
AssignPriceColor(if downbar AND downbar20 then color.magenta else if upbar AND upbar20
then color.green else Color.CURRENT);

Reply With Quote
The following user says Thank You to tangerine for this post:
 
  #5 (permalink)
Trading Apprentice
cologne / nrw
 
Futures Experience: Intermediate
Platform: not found yet
Favorite Futures: YM,FXDM,6J
 
Posts: 2 since Jul 2013
Thanks: 2 given, 0 received

thx for the quick response, i'll definitley checkt that out

Reply With Quote

Reply



futures io > > > > > Identify big Average true range

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Average True Range Data 2 Waterstreet TradeStation 4 February 18th, 2017 02:15 PM
AVERAGE TRUE RANGE louisville NinjaTrader 21 January 8th, 2016 09:39 AM
ATR Average True Range indicator expressed as a number? w00dmann NinjaTrader 5 March 17th, 2015 06:03 PM
Average True Range is Number billsingh NinjaTrader 2 January 30th, 2015 07:25 PM
True No Gap Range Bars? Techfan1128 NinjaTrader Programming 18 June 6th, 2012 02:31 AM


All times are GMT -4. The time now is 05:47 PM.

Copyright © 2017 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
Page generated 2017-12-17 in 0.10 seconds with 19 queries on phoenix via your IP 54.163.210.170