• Get $40 off VIP by signing up for a free account! Sign Up

B-Xtrender Indicator For ThinkOrSwim

mbarcala

Active member
This is BXtrender Indicator from trading view to TOS. This is combination of long and short term trading entry and exit ideas, play by your knowledge, Enjoy!
Link: https://www.tradingview.com/script/YHZimEz8-B-Xtrender-Puppytherapy/

Photo
https%3A//i.imgur.com/0lB61Rt.png[/img]']
0lB61Rt.png


Script
Code:
# BXtrender converted to TOS mbarcala and IgorF
#Link: https://www.tradingview.com/script/YHZimEz8-B-Xtrender-Puppytherapy/

declare lower;

input short_l1 = 5;
input short_l2 = 20;
input short_l3 = 15;
input long_l1 = 20;
input long_l2 = 15;

def shortTermXtrender = RSI(price = ExpAverage(close, short_l1) - ExpAverage(close, short_l2), length = short_l3) - 50;
def longTermXtrender = RSI(price = ExpAverage(close, long_l1), length = long_l2) - 50;

script t3 {
    input src = close;
    input len = 10;
    def xe1_1 = ExpAverage(src, len);
    def xe2_1 = ExpAverage(xe1_1, len);
    def xe3_1 = ExpAverage(xe2_1, len);
    def xe4_1 = ExpAverage(xe3_1, len);
    def xe5_1 = ExpAverage(xe4_1, len);
    def xe6_1 = ExpAverage(xe5_1, len);
    def b_1 = 0.7;
    def c1_1 = -b_1 * b_1 * b_1;
    def c2_1 = 3 * b_1 * b_1 + 3 * b_1 * b_1 * b_1;
    def c3_1 = -6 * b_1 * b_1 - 3 * b_1 - 3 * b_1 * b_1 * b_1;
    def c4_1 = 1 + 3 * b_1 + b_1 * b_1 * b_1 + 3 * b_1 * b_1;
    plot t3 = c1_1 * xe6_1 + c2_1 * xe5_1 + c3_1 * xe4_1 + c4_1 * xe3_1;
}

def maShortTermXtrender = t3( shortTermXtrender, 5);

plot BXtrenderColor = maShortTermXtrender;
BXtrenderColor.AssignValueColor(if maShortTermXtrender > maShortTermXtrender[1] then Color.Lime else color.red);
BXtrenderColor.SetLineWeight(3);
BXtrenderColor.HideBubble();

plot BXtrenderShadow = maShortTermXtrender;
BXtrenderShadow.SetDefaultColor(color.black);
BXtrenderShadow.SetLineWeight(5);
BXtrenderShadow.HideBubble();

plot shape1 = if maShortTermXtrender > maShortTermXtrender[1] and maShortTermXtrender[1] < maShortTermXtrender[2] then maShortTermXtrender else double.nan;
shape1.SetPaintingStrategy(PaintingStrategy.POINTS);
shape1.SetLineWeight(5);
shape1.SetDefaultColor(color.lime);
shape1.HideBubble();

plot shape2 = if maShortTermXtrender < maShortTermXtrender[1] and maShortTermXtrender[1] > maShortTermXtrender[2] then maShortTermXtrender else double.nan;
shape2.SetPaintingStrategy(PaintingStrategy.POINTS);
shape2.SetLineWeight(5);
shape2.SetDefaultColor(color.red);
shape2.HideBubble();

plot BXtrenderTrendLine = longTermXtrender;
BXtrenderTrendLine.SetDefaultColor(color.black);
BXtrenderTrendLine.SetLineWeight(3);
BXtrenderTrendLine.AssignValueColor(if longTermXtrender > longTermXtrender[1] then color.lime else color.red);
BXtrenderTrendLine.HideBubble();

plot BXtrenderTrendLineShadow = longTermXtrender;
BXtrenderTrendLineShadow.SetDefaultColor(color.black);
BXtrenderTrendLineShadow.SetLineWeight(5);
BXtrenderTrendLineShadow.HideBubble();

plot BXtrenderTrendHistogram = longTermXtrender;
BXtrenderTrendHistogram.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BXtrenderTrendHistogram.SetLineWeight(1);
BXtrenderTrendHistogram.AssignValueColor(if longTermXtrender > 0 then (if longTermXtrender > longTermXtrender[1] then color.lime else CreateColor(34, 139, 34)) else if longTermXtrender > longTermXtrender[1] then color.red else CreateColor(139, 0, 0));
BXtrenderTrendHistogram.HideBubble();

plot BXtrenderHistogram = shortTermXtrender;
#BXtrenderHistogram.AssignValueColor(if shortTermXtrender > 0 then (if shortTermXtrender > shortTermXtrender[1] then color.lime else createColor(34, 139, 34)) else if shortTermXtrender > shortTermXtrender[1] then color.red else createColor(139, 0, 0));
BXtrenderHistogram.AssignValueColor(if shortTermXtrender > 0 then Color.DARK_GREEN else Color.DARK_RED);

BXtrenderHistogram.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
BXtrenderHistogram.HideBubble();

plot cline = 0;
cline.SetDefaultColor(Color.GRAY);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
186 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top