Best Scalping Tool For ThinkOrSwim

Author states:
This script is a comprehensive indicator that combines three essential technical analysis tools: Money Flow Index (MFI), Relative Strength Index (RSI), and Bollinger Bands (Bollinger %B). It provides insights into market conditions related to cross points of mfi,rsi and B%B.

A buy condition is created when the last candle RSI and MFI are under the bollinger bands, and then in the actual candle the RSI cross up the bollinger low band.

A sell condition is created when the last candle RSI and MFI are above the bollinger bands, and then in the actual candle the RSI cross down the bollinger high band.

Key Components:

MFI (Money Flow Index):

Utilizes the MFI indicator based on a specified length.
Overbought and oversold levels (80 and 20, respectively).

RSI (Relative Strength Index): (Adapted to the mfi chart)

Allows selection of different moving average types (SMA, EMA, etc.) for the RSI calculation.
RSI along with upper and lower bands (70 and 30).

Bollinger Bands:

Provides upper and lower Bollinger Bands based on the RSI's standard deviation.


014m77B.png


Here is the original Tradingview code:
https://www.tradingview.com/v/G223gi3z/


For the new ThinkOrSwim code, you must scroll down to the next post
 
Last edited by a moderator:
check below:

CSS:
#// Indicator for TOS
#//@diegorccp
#indicator(title="Best scalping tool", shorttitle="MFI+RSI+B%B",overlay = true, format=format.price,
# Converted by Sam4Cok@Samer800    - 03/2025

input timeframe = AggregationPeriod.MIN;
input mfiSrc = FundamentalType.HLC3;
input mfiLength = 14; #"Length", defval=14, minval=1, maxval=2000)
input rsiSrc = FundamentalType.CLOSE;
input rsiLength = 14; #"Length", defval=14, minval=1, maxval=2000)
input mult = 1.6; #, minval=0.001, maxval=50)
input useRsi = no; #(false, title="Draw RSI?")
input useMfi = yes; #(true, title="Draw MFI?")

def na = Double.NaN;
def last = isNaN(close);
def GAP = GetAggregationPeriod();
def tf = Max(GAP, timeframe);
def DrawMFI = if (!useMfi and !useRsi) then yes else useMfi;
def DrawRSI = if (useMfi and useRsi) then no else useRsi;

#// the same on pine
Script pine_mfi {
input src0 = hlc3;
input src1 = hlc3;
input vol = volume;
input length = 14;
    def change = src0 - src1;
    def upper = sum(vol * (if change <= 0.0 then 0.0 else src0), length);
    def lower = sum(vol * (if change >= 0.0 then 0.0 else src0), length);
    def mfi = 100.0 - (100.0 / (1.0 + upper / lower));
    plot out = mfi;
}
def rsi = rsi(Price = Fundamental(rsiSrc, Period = tf), Length = rsiLength);
def rsiMultiplier = if rsi <= 50 then rsi * 0.8 else rsi * 1.2;
def mf = pine_mfi(Fundamental(mfiSrc, Period = tf), Fundamental(mfiSrc, Period = tf)[1], volume(Period = tf), mfiLength);

#// Draw BB on indices
#def bb_s = if DrawRSI then rsi else if DrawMFI then mf else na;
def basis; # = Average(bb_s, mfiLength);
def dev; # = mult * stdev(bb_s, mfiLength);
if DrawRSI {
    basis = Average(rsi, rsiLength);
    dev = mult * stdev(rsi, rsiLength);
} else if DrawMFI {
    basis = Average(mf, mfiLength);
    dev = mult * stdev(mf, mfiLength);
} else {
    basis = na;
    dev = na;
}
def upper = basis + dev;
def lower = basis - dev;

def rsiCrossUp = (rsiMultiplier > lower) and (rsiMultiplier[1] <= lower[1]);
def rsiCrossDn = (rsiMultiplier < upper) and (rsiMultiplier[1] >= upper[1]);
def mfiCrossUp = (mf > lower) and (mf[1] <= lower[1]);
def mfiCrossDn = (mf < upper) and (mf[1] >= upper[1]);

def mfiSigUp = (mf[1] < lower[1]) and (rsiMultiplier[1] < lower[1]) and mfiCrossUp;
def rsiSigUp = (mf[1] < lower[1]) and (rsiMultiplier[1] < lower[1]) and rsiCrossUp and (!mfiSigUp or isNaN(mfiSigUp));


def mfiSigDn = (mf[1] > upper[1]) and (rsiMultiplier[1] > upper[1]) and mfiCrossDn;
def rsiSigDn = (mf[1] > upper[1]) and (rsiMultiplier[1] > upper[1]) and rsiCrossDn and (!mfiSigDn or isNaN(mfiSigDn));


AddChartBubble(rsiSigUp and !rsiSigUp[1], low, "RSI", Color.GREEN, no);
AddChartBubble(mfiSigUp and !mfiSigUp[1], low, "MFI", Color.GREEN, no);
AddChartBubble(mfiSigDn and !mfiSigDn[1], high, "MFI", Color.RED);
AddChartBubble(rsiSigDn and !rsiSigDn[1], high, "RSI", Color.RED);

#-- END of CODE
 

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
900 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