NexusFi: Find Your Edge


Home Menu

 





adding labels that always stay on the left on horizonal lines


Discussion in ThinkOrSwim

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




 
Search this Thread

adding labels that always stay on the left on horizonal lines

  #1 (permalink)
maindoor
sfo + CA
 
Posts: 7 since Feb 2016
Thanks Given: 3
Thanks Received: 0

Hi,
I have the following code to draw line on previous close:
 
Code
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
 PrevDayClose = Double.NaN;
} else { 
 PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}
PrevDayClose.SetDefaultColor(GetColor(9));
PrevDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
1) How do I programmatically draw a label that always stays to the left on the chart. I created
one manually like so:

How do I do it programmatically ?

2) This draws a line further away from the start of the close on the previous day.
How do I draw the line all the way from the actual close point ?

Thanks.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
51 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
31 thanks

  #2 (permalink)
halcyonguy
fertile
 
Posts: 2 since Aug 2019
Thanks Given: 1
Thanks Received: 0

I don't think you can program the name of a line and it's orientation in thinkscript.
You could add a chart bubble and have it appear x bars back.

Reply With Quote
  #3 (permalink)
 
lukeskywalker1's Avatar
 lukeskywalker1 
Los Angeles (CA)
 
Experience: Master
Platform: ThinkOrSwim
Trading: Currency Future, Stocks
Posts: 34 since Apr 2019
Thanks Given: 1
Thanks Received: 40



maindoor View Post
Hi,
I have the following code to draw line on previous close:
 
Code
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
 PrevDayClose = Double.NaN;
} else { 
 PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}
PrevDayClose.SetDefaultColor(GetColor(9));
PrevDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
1) How do I programmatically draw a label that always stays to the left on the chart. I created
one manually like so:

How do I do it programmatically ?

2) This draws a line further away from the start of the close on the previous day.
How do I draw the line all the way from the actual close point ?

Thanks.

Hey. If I understand you correctly, this code will help you.
This is a very useful indicator that I would install first.
it can be modified for you



 
Code
#Study:Info
#by thetrader.top

input ATRLength = 14;        

input ShowATR = {default "1", "0"};       
input AvgVolume = {default "1", "0"};    
input Volume_ = {default "1", "0"};    
input ATRPlay = {default "1", "0"};    
input VolumePlay = {default "1", "0"};    

def _ATR_D = TrueRange(high(period = "DAY"), close(period = "DAY"), low(period = "DAY"));
def iATR_D = Round(Average(_ATR_D, ATRLength)[1], 2);
AddLabel (!ShowATR, "ATR("+ATRLength+") " + iATR_D, Color.GRAY);

def iAvgVolume = Round(Average (volume(period = "DAY")[1], 65) / 1000, 0);
AddLabel (!AvgVolume, "AvgVol " + iAvgVolume + "k", Color.GRAY);

def iVolume = Round(volume(period = "DAY") / 1000, 0);
AddLabel (!Volume_, "Vol " + iVolume + "k", Color.LIGHT_GREEN);

def iATRPlay = Round((high(period = "DAY") - low(period = "DAY")) / iATR_D, 1);
AddLabel (!ATRPlay, "ATRPlay " + iATRPlay + "(" + Round(high(period = "DAY") - low(period = "DAY"), 2) + ")", Color.LIGHT_GREEN);

def iVolumePlay = Round(iVolume / iAvgVolume, 2);
AddLabel (!VolumePlay, "VolPlay " + iVolumePlay, Color.LIGHT_GREEN);

def Gap = Round((Open(period = "DAY")-Close(period = "DAY")[1])/Close(period = "DAY")[1]*100, 2);
AddLabel (Yes, "Gap " + Gap+"%", Color.LIGHT_GREEN);

def ATRcur = Round (Average(TrueRange(high, close, low)[1],5));
AddLabel (Yes, "ATR(5) " + ATRcur, if(ATRcur<=0.20) then Color.GREEN else Color.Red);

2020-04-24_18-34-28
[

Visit my NexusFi Trade Journal Reply With Quote





Last Updated on April 24, 2020


© 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