Auto draw ATR Lines after placing trade?

Learnbot

Active member
VIP
I am not sure if this is possible but what I am trying to see if there is a way in which TOS automatically draws two lines when I place a buy order. so here are the details:

Let's say I placed and filled a market buy order for 1 stock of TSLA at $1000 at which point the ATR is 1.0. What I am trying to see (if possible) two lines get drawn at this time one stop loss line valued at 1000 - (2*ATR) and profit line valued at 1000+(4*ATR).

i dont think it's possible but maybe some of you smarter individuals than I, know more about me and maybe there is a way...

thank you for your help and time as always.
J
 
Last edited by a moderator:

BenTen

Administrative
Staff
VIP
@Miket Don't know if this is correct but give it a try.

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);

input length = 10;
input averageType = AverageType.WILDERS;

def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);

plot line = open + (ATR / 2);

The blue line represent the 50% of the 10 days ATR.
 

scott69

Member
@Learnbot I have thought about doing what you want with an ATR band for stops, but what I do is I have a 1 min chart with the ATR(5) running. I make the ATR indicator area as small as possible, so that all I can really see is the ATR level bubble. I only want to see that number all day. When I go to put on a position based on indicators, price pattern, S/R levels, etc. (you guys know the drill, :) ) I will look at the ATR # and then set my initial stop as a multiple of that, usually X2. (As an aside, I am somewhat of a disciple of Chuck LeBeau). So if it says 6, for example, I will set the Trail stop at 15 (2 X 6 rounded up).After the trade is going, I will flatten the positions prior to the trail getting hit if price runs into resistance or some other indicator that tells me that the position is running into trouble. I also use the ATR # to keep me out of trades. i.e. if it is 30+, that tells me that the action is too rich for my blood, meaning 2 X 30 would be a 60 point stop. No thank you. Even with one NQ contract, that would be a $1200 stop at one level. So that is my deux centimes about ATRs. To each his/her own. Whatever works. Hope it gives you all something to think about. Talking about stops could take several books full, as you all know....
 

BenTen

Administrative
Staff
VIP
@Mike Take a look at the code above, pay attention to the following:

Code:
plot line = open + (ATR / 2);

You can change + to -
 

Similar threads

Top