• LIMITED TIME OFFER: use coupon code PRIMEDAY at checkout to save $50 off VIP membership (down to $149 / year). Valid through Tuesday 6/22.

True Momentum Oscillator for ThinkorSwim

markos

Well-known member
VIP
Hey @Branch, if you should return, please put the original header back in an give it a new revision date w your name.
Thanks!
 

dmillz

Member
VIP
Anyone know how to scan the red to green move under the zero line and above the Oversold line? seems like these moves have the best runs!
 

ssaeed73

Member
For those who use this intraday, five to fifteen minute timeframe, what's the best setting to use in your experience, 21, 14 or 7? I'm assuming the larger numbers are smoother curves but give slower entries?
 

hCaostrader

New member
Have you converted this code to Python, by chance? Or do you know how? I'm not fluent enough in Python to know how to convert the "data" variable. Any help is appreciated!
No, but look at the Pinescript implementation on TradingView. It's much easier to understand than thinkScript. The formula isn't that complicated. You only need to understand the ternary operator.
 

BenTen

Administrative
Staff
VIP
@allanumana1986 By placing "#" in front of the code. That will deactivate it.

For example, here is an active condition:

Code:
def buy = if this then that;

By placing the "#" in front of it, the condition is no longer active.

Code:
#def buy = if this then that;
 

Branch

Member
VIP
Hey @Branch, if you should return, please put the original header back in an give it a new revision date w your name.
Thanks!
@markos: I came up with this code.

Code:
declare lower;

input length = 7;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length  with s do s + (if c > GetValue(o, i) then 1 else if c < GetValue(o, i) then - 1 else 0);
def EMA5 = ExpAverage(data, calcLength);

plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal then Color.GREEN else Color.GREEN);
Signal.AssignValueColor(if Main > Signal then Color.RED else Color.RED);
Signal.HideBubble();
Signal.HideTitle();
AddCloud(Main, Signal, Color.GREEN, Color.BLACK);
plot zero = if IsNaN(c) then Double.NaN else 0;
zero.SetDefaultColor(Color.WHITE);
zero.HideBubble();
zero.HideTitle();
plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.BLUE);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.BLUE);
os.HideBubble();
os.HideTitle();

#BUBBLE---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def CrossBar = if Main crosses Signal then BarNumber() else Double.NaN;

#CLOUD---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AddCloud(ob, length, Color.black, Color.black, no);
AddCloud(-length, os, Color.black, Color.black);

#DOTS and BUBBLES---------------------------------------------------------------------------------------------------------------------------------------------------------------
plot DownSignal = if Main crosses below Signal then Signal else Double.NaN;
DownSignal.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
AddChartBubble((DownSignal) and (DownSignal), DownSignal, "S" , Color.PINK);

plot UpSignal = if Main crosses above Signal then Signal else Double.NaN;
UpSignal.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
AddChartBubble((UpSignal) and (UpSignal), UpSignal, "B" , Color.LIME);

AddLabel (yes, if Main > Signal then "BUY" + "" else "", Color.GREEN);
AddLabel (yes, if Main < Signal then "SELL" + "" else "", Color.RED);

plot MainMomentum = ExpAverage(EMA5, smoothLength);

def CrossBar2 = if MainMomentum crosses MainMomentum then BarNumber() else Double.NaN;
 
@markos: I came up with this code.

Code:
declare lower;

input length = 7;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length  with s do s + (if c > GetValue(o, i) then 1 else if c < GetValue(o, i) then - 1 else 0);
def EMA5 = ExpAverage(data, calcLength);

plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal then Color.GREEN else Color.GREEN);
Signal.AssignValueColor(if Main > Signal then Color.RED else Color.RED);
Signal.HideBubble();
Signal.HideTitle();
AddCloud(Main, Signal, Color.GREEN, Color.BLACK);
plot zero = if IsNaN(c) then Double.NaN else 0;
zero.SetDefaultColor(Color.WHITE);
zero.HideBubble();
zero.HideTitle();
plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.BLUE);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.BLUE);
os.HideBubble();
os.HideTitle();

#BUBBLE---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def CrossBar = if Main crosses Signal then BarNumber() else Double.NaN;

#CLOUD---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AddCloud(ob, length, Color.black, Color.black, no);
AddCloud(-length, os, Color.black, Color.black);

#DOTS and BUBBLES---------------------------------------------------------------------------------------------------------------------------------------------------------------
plot DownSignal = if Main crosses below Signal then Signal else Double.NaN;
DownSignal.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
AddChartBubble((DownSignal) and (DownSignal), DownSignal, "S" , Color.PINK);

plot UpSignal = if Main crosses above Signal then Signal else Double.NaN;
UpSignal.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
AddChartBubble((UpSignal) and (UpSignal), UpSignal, "B" , Color.LIME);

AddLabel (yes, if Main > Signal then "BUY" + "" else "", Color.GREEN);
AddLabel (yes, if Main < Signal then "SELL" + "" else "", Color.RED);

plot MainMomentum = ExpAverage(EMA5, smoothLength);

def CrossBar2 = if MainMomentum crosses MainMomentum then BarNumber() else Double.NaN;
Here it is in action using renko trading TSLA
 

kmg526

Member
VIP
Is there a scan in this forum that can check for True Momentum Oscillator turning from Red/Green and vice versa?
 

BenTen

Administrative
Staff
VIP
@kmg526 You can set it up by creating a condition like this:

4u29dDv.png
 

Similar threads

Top