Market Force Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Another indicator that shows when a stock is overbought or oversold. Not sure why the original source code is no longer available. But I was able to obtain part of the description from an old copy.

This is the best indicator that measures the strength of the market and //predicts its movement.




thinkScript Code

Code:
# Market Force
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/SmMnX3ZK-forcemarket/

declare lower;

input D = 21;
input D1 = 31;

input L1 = 30;
input L2 = 50;
input L3 = 70;

def X = if (close>close[1]) then absValue(close-close[1]) else 0;
def Y = if (close<close[1]) then absValue(close-close[1]) else 0;
def X1 = highest(X, D);
def Y1 = highest(Y, D);
def W = 100 * X1 / (X1 + Y1);
def W1 = 100 * simpleMovingAvg(X, D1) / (simpleMovingAvg(X, D1) + simpleMovingAvg(Y, D1));

plot mf = W1;

plot oversold = L1;
plot middle = L2;
plot overbought = L3;

oversold.setDefaultColor(color.green);
middle.setDefaultColor(color.gray);
overbought.setDefaultColor(color.red);
 
J

john3

Active member
2019 Donor
To plot the arrows.

Code:
plot arrowup = if mf crosses above oversold then mf else double.NaN;

arrowup.setPaintingStrategy(paintingStrategy.ARROW_UP);
arrowup.assignValueColor(color.green);

plot arrowdown = if mf crosses below overbought then mf else double.NaN;

arrowdown.setPaintingStrategy(paintingStrategy.ARROW_DOWN);
arrowdown.assignValueColor(color.magenta);

To plot the arrows on the price chart, comment-out "declare: lower" and add this:

Code:
plot arrowup = if mf crosses above oversold then mf else double.NaN;

arrowup.setPaintingStrategy(paintingStrategy.ARROW_UP);
arrowup.assignValueColor(color.green);

plot arrowdown = if mf crosses below overbought then mf else double.NaN;

arrowdown.setPaintingStrategy(paintingStrategy.ARROW_DOWN);
arrowdown.assignValueColor(color.magenta);

plot SignalUP = if arrowup then HL2 else double.nan;
SignalUP.SetDefaultColor(Color.CYAN);
SignalUP.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

plot SignalDOWN = if arrowdown then HL2 else double.nan;
SignalDOWN.SetDefaultColor(Color.MAGENTA);
SignalDOWN.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 
Last edited by a moderator:
M

marine

New member
Lifetime
good afternoon

what is the different btw this indicator and the rsi
 
BenTen

BenTen

Administrative
Staff
VIP
@marine Both will show overbought and oversold but using different method/calculation.
 
horserider

horserider

Well-known member
VIP
This is the best indicator that measures the strength of the market and //predicts its movement. o_O :ROFLMAO::ROFLMAO::ROFLMAO::ROFLMAO::ROFLMAO::ROFLMAO:
 
BenTen

BenTen

Administrative
Staff
VIP
@horserider Yup! Just kidding, not my saying. Just quoted the original author. :p
 
T

tradebyday

Active member
Threw Tarzan on it for the fun of it, someone else can test and play with it if they wish
Code:
# Market Force Tarzan
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/SmMnX3ZK-forcemarket/
#Modified by TradeByDay

declare lower;

input D = 21;
input D1 = 31;

input L1 = 30;
input L2 = 50;
input L3 = 70;

def X = if (close>close[1]) then absValue(close-close[1]) else 0;
def Y = if (close<close[1]) then absValue(close-close[1]) else 0;
def X1 = highest(X, D);
def Y1 = highest(Y, D);
def W = 100 * X1 / (X1 + Y1);
def W1 = 100 * simpleMovingAvg(X, D1) / (simpleMovingAvg(X, D1) + simpleMovingAvg(Y, D1));

plot mf = W1;

plot oversold = L1;
plot middle = L2;
plot overbought = L3;

oversold.setDefaultColor(color.green);
middle.setDefaultColor(color.gray);
overbought.setDefaultColor(color.red);

input length = 20;
input ma_length = 21;
input koridor  = 5;

input price = close;

def ma = ExpAverage(mf, 50);
plot upper = ma + koridor;
upper.SetDefaultColor(GetColor(8));
plot lower = ma - koridor;
lower.SetDefaultColor(GetColor(8));

plot k = ma;
k.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
k.AssignValueColor(if mf > upper then Color.GREEN else if mf < lower then Color.RED else Color.GRAY);

#End
 
N

Nick

Active member
2019 Donor
VIP
Hi, may i know how to build this as a scan to scan out stock that have arrow up on the chart..many thanks

Hi, I have added the quote but this is what i got...may i know where did i get it wrong? Thank

This is the code i have amended to have the arrows on the chart...but i m not getting right...appreciate any guidance...thank you

 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
@Nick That code is incorrect. What are you trying to scan for?
 
N

Nick

Active member
2019 Donor
VIP
@Nick That code is incorrect. What are you trying to scan for?
Hi @BenTen, what i wanted to do is to have the arrows plotted on the chart and I added the code provided by @john3. I was wondering if we can use the codes to scan out stocks cross below the L3 or L1. Thank you
 
BenTen

BenTen

Administrative
Staff
VIP
@Nick Sorry for getting back to you so late. My wifi has been very unstable. You do not need any additional code to use with the scanner.

Here is an example: this would scan for the blue line (mf) crossing below the Overbought line (red). You can use the same logic for whichever line you wish to use.

 
hectorgasm

hectorgasm

New member
hey @BenTen this indicator is amazing, can you explain a little more what's your reasoning or how you built it so I can contribute with my insights? thank you so much!
 
BenTen

BenTen

Administrative
Staff
VIP
@hectorgasm This indicator was converted from TradingView. I did not build it from scratch.
 
hectorgasm

hectorgasm

New member
@BenTen just tried a new setup and this looks really good with the True Strenght Index but I can't figure out how to get it normalized, do you have any idea?
 
BenTen

BenTen

Administrative
Staff
VIP
@hectorgasm Did you drag/drop multiple indicators into the same lower study? If so, most likely it will create scaling issues.
 
hectorgasm

hectorgasm

New member
@BenTen yes, i just dragged it down, it gives valid signals like that but i wonder if it could be scaled properly into one indicator :)
 
S

stocksniper

Member
Is there a way to put the overbought and oversold arrows on the chart Candles only, any help would be greatly appreciated. Thanks
 
BenTen

BenTen

Administrative
Staff
VIP
@stocksniper Define the condtion. You can the arrow when stock is at overbought and oversold?
 
I

ikpllc

New member
@stocksniper Define the condtion. You can the arrow when stock is at overbought and oversold?
@BenTen , really awesome work on this one. Seems easy and accurate. For the scan portion...thoughts on how to capture any crossover that has sustained for the last day (or 2 days) as opposed to capturing any crossover that has happened just once in the last day?
 

Similar threads

Top