You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thank you for creating this project. It has been a great help. I wanted to request the TMO indicator as it has helped me a lot in my own personal trading. I just started to learn python to backtest my trading strategies, so my knowledge is at a beginner level. I tried using chatgpt to convert the pinescript to python however that wasn't much help. If this could be added in that would be awesome. Thanks!
[https://www.tradingview.com/script/o9BQyaA4-True-Momentum-Oscillator/]
Pinescript:
// @Version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//function for choosing moving averages
f_ma(type, src, len) =>
float result = 0
if type == "EMA"
result := ema(src, len)
if type == "SMA"
result := sma(src, len)
if type == "RMA"
result := rma(src, len)
result
o = open
c = close
s = 0
for i = 0 to length
s := s + (c > o[i] ? 1 : c < o[i] ? - 1 : 0)
data = s
MA = f_ma(lengthType, data, calcLength)
Main = f_ma(calcLengthType, MA, smoothLength)
Signal = f_ma(smoothLengthType, Main, smoothLength)
First of all thank you for creating this project. It has been a great help. I wanted to request the TMO indicator as it has helped me a lot in my own personal trading. I just started to learn python to backtest my trading strategies, so my knowledge is at a beginner level. I tried using chatgpt to convert the pinescript to python however that wasn't much help. If this could be added in that would be awesome. Thanks!
[https://www.tradingview.com/script/o9BQyaA4-True-Momentum-Oscillator/]
Pinescript:
// @Version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// True Momentum Oscillator
// by SparkyFlary
study(title="True Momentum Oscillator", overlay=false)
length = input(14, title="Length")
calcLength = input(5, title="Calc length")
smoothLength = input(3, title="Smooth length")
lengthType = input("EMA", title="Length moving average type", options=["EMA", "SMA", "RMA"])
calcLengthType = input("EMA", title="Calc length moving average type", options=["EMA", "SMA", "RMA"])
smoothLengthType = input("EMA", title="Smooth length moving average type", options=["EMA", "SMA", "RMA"])
//function for choosing moving averages
f_ma(type, src, len) =>
float result = 0
if type == "EMA"
result := ema(src, len)
if type == "SMA"
result := sma(src, len)
if type == "RMA"
result := rma(src, len)
result
o = open
c = close
s = 0
for i = 0 to length
s := s + (c > o[i] ? 1 : c < o[i] ? - 1 : 0)
data = s
MA = f_ma(lengthType, data, calcLength)
Main = f_ma(calcLengthType, MA, smoothLength)
Signal = f_ma(smoothLengthType, Main, smoothLength)
ob = hline(round(length * .7), title="overbought cutoff line", color=color.gray, linestyle=hline.style_solid)
os = hline(-round(length * .7), title="oversold cutoff line", color=color.gray, linestyle=hline.style_solid)
upper = hline(length, title="upper line", color=color.red, linestyle=hline.style_solid)
lower = hline(-length, title="lower line", color=color.green, linestyle=hline.style_solid)
zero = hline(0, title="zero line", color=color.gray, linestyle=hline.style_solid)
mainPlot = plot(Main, title="main line", color=Main>Signal?color.green:color.red, linewidth=2)
signalPlot = plot(Signal, title="signal line", color=Main>Signal?color.green:color.red)
crossPlot = plot(cross(Main,Signal)?Main:na, title="crossover dot", color=Main>Signal?color.green:color.red, style=plot.style_circles, linewidth=3)
fill(mainPlot, signalPlot, title="main and signal area", color=Main>Signal?color.green:color.red)
fill(ob, upper, title="overbought zone", color=color.red)
fill(os, lower, title="oversold zone", color=color.green)
The text was updated successfully, but these errors were encountered: