NexusFi: Find Your Edge


Home Menu

 





Thinkscript library, popular scripts and studies


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one lukeskywalker1 with 22 posts (13 thanks)
    2. looks_two wldman with 3 posts (0 thanks)
    3. looks_3 futs with 1 posts (0 thanks)
    4. looks_4 GJStrader with 1 posts (0 thanks)
    1. trending_up 33,232 views
    2. thumb_up 15 thanks given
    3. group 17 followers
    1. forum 28 posts
    2. attach_file 18 attachments




 
Search this Thread

Thinkscript library, popular scripts and studies

  #21 (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

"Pin" Candlestick Pattern Indicator

📈 The indicator is similar to PinBar, but differs in that it does not look at the previous trend, but just shows the spires (pins) on the chart. There are no special settings.
________
HTML Code:
#thinkscript indicator: Pin.
#It shows the spires "Pins" on the chart
#by thetrader.top
def low25 = ((high - low) / 100) * 25;
def bSignalDown = open[1] > close[1] and high-open < low25 and high-close <low25;
def bSignalUp = open[1] < close[1] and open-low < low25 and close-low<low25;
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);

Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
32 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #22 (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

"Pin Bar" Candlestick Pattern Indicator

📈 The "Pin Bar" indicator shows with arrows on the chart the situation when "Pin Bar" is drawn after a certain trend (the most probable signal for reversal).

⚙ Settings. Inputs: The ratio of the total length of a candlestick to the candlestick body (i ratio: 2.5) and the number of bars - trends before the PinBar (i-bars: 2).
________
HTML Code:
#thinkscript indicator: Pin_Bar.
#Draws the Pinbars on the chart following the trend.
#by thetrader.top
input iRatio = 2.5; #candle length-to-body ratio
input iBars = 2; #trend number of bars
def iTelo=absValue (close-open);
def bPinUp = (((high - low)/(iTelo)) >iRatio) and high > high[1] and low>low[1] and max(open,close)<high-((high-low)/2);
def bPinDown =(((high - low)/(iTelo)) >iRatio) and high < high[1] and low<low[1] and min(open,close)>low+((high-low)/2);
def bTrendUp = fold TUbar = 1 to iBars+1 with TUsumm=1 do if (close[TUbar]-open[TUbar]>0) then TUsumm*1 else TUsumm*0;
def bTrendUp2 = fold TUbar2 = 1 to iBars with TUsumm2=1 do if (high[TUbar2]==highest(high[TUbar2],iBars)) then TUsumm2*1 else TUsumm2*0;
def bTrendDown = fold TDbar = 1 to iBars+1 with TDsumm=1 do if (open[TDbar]-close[TDbar]>0) then TDsumm*1 else TDsumm*0;
def bTrendDown2 = fold TDbar2 = 1 to iBars with TDsumm2=1 do if (low[TDbar2]==lowest(low[TDbar2],iBars)) then TDsumm2*1 else TDsumm2*0;
def bSignalUp = bPinUp and bTrendUp and bTrendUp2;
def bSignalDown = bPinDown and bTrendDown and bTrendDown2;
plot up = if bSignalUp  then high else double.NaN;
plot down = if bSignalDown then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
up.setDefaultColor(color.LIGHT_red);
down.setDefaultColor(color.LIGHT_green);

Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #23 (permalink)
LSAGL
San Jose + CA/USA
 
Posts: 1 since Jun 2020
Thanks Given: 3
Thanks Received: 0


Hi All,

I am new to thinkscript and try to write my first study after searched in the net.
The script below, the 2nd part is trying to plot arrows. But this messes up the plot. Can somebody help me out here?
The target is to have a green up arrow if the SlowK is coming out of the Oversold, and a red down arrow if it comes down from oversold.
Thanks a lot!

LS

##############
declare lower;

input over_bought = 80;
input over_sold = 20;
input KPeriod = 80;
input DPeriod = 1;
input priceH = HIGH;
input priceL = LOW;
input priceC = CLOSE;
input averageType = "SIMPLE";
input breakoutSignals = "On SlowK & SlowD";

plot SlowK = reference StochasticSlow(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,averageType,breakoutSignals);
SlowK.setDefaultColor(GetColor(1));

plot OverBought = over_bought;
OverBought.SetDefaultColor(GetColor(1));

plot OverSold = over_sold;
OverSold.SetDefaultColor(GetColor(1));

# ARROWS
plot Up = if (Crosses(SlowK,OverSold)and SlowK > OverSold, close,double.nan);
Up.setLineWeight(5);
Up.setDefaultColor(color.green);
Up.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Up.HideBubble();

plot Down = if (Crosses(slowK,OverBought)and slowK < OverBought, close,double.nan);
Down.setLineWeight(5);
Down.setDefaultColor(color.red);
Down.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Down.HideBubble();

Reply With Quote
  #24 (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

"Revers" Candlestick Pattern Indicator

📈 The indicator shows signals with arrows in the chart when such a candlestick pattern appears.
⚙ The arrows are adjustable.
________
HTML Code:
#thinkscript indicator: Revers.
#Shows the pattern of "reverse reversal"
#by thetrader.top
def bSignalUp = high[1]>high[2] and close[1]>high[2] and open>high[1] and close<close[1];
def bSignalDown = high[1]<high[2] and close[1]<low[2] and open<low[1] and close>close[1];
plot up = if bSignalUp  then high else double.NaN;
plot down = if bSignalDown then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
up.setDefaultColor(color.LIGHT_red);
down.setDefaultColor(color.LIGHT_green);

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #25 (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


LSAGL View Post
Hi All,

I am new to thinkscript and try to write my first study after searched in the net.
The script below, the 2nd part is trying to plot arrows. But this messes up the plot. Can somebody help me out here?
The target is to have a green up arrow if the SlowK is coming out of the Oversold, and a red down arrow if it comes down from oversold.
Thanks a lot!

LS

##############
declare lower;

input over_bought = 80;
input over_sold = 20;
input KPeriod = 80;
input DPeriod = 1;
input priceH = HIGH;
input priceL = LOW;
input priceC = CLOSE;
input averageType = "SIMPLE";
input breakoutSignals = "On SlowK & SlowD";

plot SlowK = reference StochasticSlow(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,averageType,breakoutSignals);
SlowK.setDefaultColor(GetColor(1));

plot OverBought = over_bought;
OverBought.SetDefaultColor(GetColor(1));

plot OverSold = over_sold;
OverSold.SetDefaultColor(GetColor(1));

# ARROWS
plot Up = if (Crosses(SlowK,OverSold)and SlowK > OverSold, close,double.nan);
Up.setLineWeight(5);
Up.setDefaultColor(color.green);
Up.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Up.HideBubble();

plot Down = if (Crosses(slowK,OverBought)and slowK < OverBought, close,double.nan);
Down.setLineWeight(5);
Down.setDefaultColor(color.red);
Down.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Down.HideBubble();

Can you add screenshot what you need?

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #26 (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

"Label" Indicator

📈 The indicator shows an inscription in the upper left corner of the chart on certain parameters of the action. Grey readings during the day are static (almost unchanged), while bright green readings change (dynamic).

⚙ Inputs are available: the average volume for 14 days, atr for 65 days, volume play indicator, atr play indicator and the current volume indicator (volume).
________
HTML Code:
#thinkscript indicator: Label.
#Draws the stock characteristics right on the chart.
#by thetrader.top
input AvgVolume14 = {default "1", "0"};
input ATR65 = {default "1", "0"};
input VolumePlay = {default "1", "0"};
input ATRPlay = {default "1", "0"};
input Volume_ = {default "1", "0"};
def length = 65;
def length2 = 14;
AddLabel (yes,"TOS Library©", color.DARK_GRAY);
def iATR = round((Average(high(period = "DAY"), 65 )-Average(low(period = "DAY"),65 )),2);
AddLabel (!ATR65,"ATR " + iATR, color.GRAY);
def iAvgVolume = round(Average (volume(period = "DAY")[1], length2),0);
AddLabel (!AvgVolume14,"AvgVol " + iAvgVolume, color.GRAY);
def iVolume = volume(period="DAY");
AddLabel (!Volume_,"Vol " + iVolume, color.light_green);
def iATRPlay = round((high(period = "DAY")-low(period = "DAY"))/iATR,1);
AddLabel (!ATRPlay,"ATRPlay " + iATRPlay, color.light_green);
def iVolumePlay = round(iVolume/ Average(volume(period="DAY"),65),1);
AddLabel (!VolumePlay,"VolPlay " + iVolumePlay, color.light_green);

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #27 (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

Alligator and Fractals indicator
📈 The Alligator and Fractals indicator is drawn on the chart. If you trade on this strategy, then this indicator is for you.
⚙ The type of price is adjusted, according to which the periods of the lines, the offset of the Alligator lines and the period (type) of averaging for the lines are calculated.

HTML Code:
#thinkscript indicator: FractalsAlligator.
#Shows fractals and alligator.
#by thetrader.top
input price = hl2;
input l1 = 13; # jaw period
input l2 = 8; # tooth period
input l3 = 5; # lips period
input disp1 = -8; # jaw displacement
input disp2 = -5; # tooth displacement
input disp3 = -3; # lip displacement
input averageType = AverageType.WILDERS;
plot Jaw = MovingAverage(averageType, price[-disp1], l1);
plot Teeth = MovingAverage(averageType, price[-disp2], l2);
plot Lips = MovingAverage(averageType, price[-disp3], l3);
Jaw.SetDefaultColor(Color.BLUE);
Teeth.SetDefaultColor(Color.RED);
Lips.SetDefaultColor(Color.GREEN);
def FractalUp = high[-2]<high[-1] and high[-1]<high[0] and high[0]>high[1] and high[1]>high[2];
def FractalDown = low[-2]>low[-1]and low[-1]>low[0]and low[0]<low[1]and low[1]<low[2];
def bSignalUp =  FractalUp ;
def bSignalDown = FractalDown;
plot up = if bSignalUp  then high else double.NaN;
plot down = if bSignalDown then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down); 
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up); 
up.setDefaultColor(color.LIGHT_red);
down.setDefaultColor(color.LIGHT_green);

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #28 (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

VWAP Indicator with Period Setting in TOS

📈 Indicator is used by traders, often as an additional tool designed for intraday trading and showing a weighted average volume price. You should keep in mind that the fewer touches per day with VWAP, the better and more accurate the data will be displayed.

⚙ The chart is possible to build on weekly, daily, hourly data. The report of points on the basis of which the curve is built is carried out from the beginning to the end of a certain selected period.

HTML Code:
#Thinkscript indicator: VWAP with period
#by thetrader.top
input cumulativePeriod = 14;
def typicalPrice = (high + low + close) / 3;
def typicalPriceVolume = typicalPrice * volume;
def cumulativeTypicalPriceVolume = sum(typicalPriceVolume, cumulativePeriod);
def cumulativeVolume = sum(volume, cumulativePeriod);
def vwapValue = cumulativeTypicalPriceVolume / cumulativeVolume;
plot warp = vwapValue;

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #29 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,168 since Jan 2013
Thanks Given: 57,468
Thanks Received: 26,279

Moderator Notice
Moderator Notice


When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
Thanked by:




Last Updated on September 6, 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