Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

True Momentum indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    True Momentum indicator

    Can anyone code this for NT8? It is a true momentum indicator. Here is the code from TradingView.

    // TMO ((T)rue (M)omentum (O)scilator)
    //Mobius V01.05.2018
    //#hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

    //@version=6
    indicator("TMO (True Momentum Oscillator)", shorttitle="TMO", overlay=false)
    // Inputs
    length = input.int(14, title="Length")
    calcLength = input.int(5, title="Calculation Length")
    smoothLength = input.int(3, title="Smooth Length")
    // Calculate the TMO value using the same logic as the ThinkScript version
    data = 0.0
    for i = 0 to length
    priceChange = close > open[i] ? 1 : close < open[i] ? -1 : 0
    data := data + priceChange
    // EMA calculations
    ema5 = ta.ema(data, calcLength)
    main_val = ta.ema(ema5, smoothLength)
    signal_val = ta.ema(main_val, smoothLength)
    // Color logic for the lines
    mainColor = main_val > signal_val ? color.green : color.red
    signalColor = main_val > signal_val ? color.green : color.red
    // Plot the main and signal lines and assign their plot handles
    p_main = plot(main_val, title="Main", color=mainColor, linewidth=2)
    p_signal = plot(signal_val, title="Signal", color=signalColor, linewidth=1)
    // Add cloud between main and signal using the plot handles
    fill(p_main, p_signal, color = main_val > signal_val ? color.new(color.green, 80) : color.new(color.red, 80))
    // Plot horizontal reference line
    p_zero = plot(0, title="Zero Line", color=color.gray, linewidth=1, style=plot.style_line)
    // Overbought and oversold levels
    ob = math.round(length * 0.7)
    os = -math.round(length * 0.7)
    // Plot the overbought/oversold levels (handles used for the cloud fill later)
    p_ob = plot(ob, title="Overbought", color=color.gray, linewidth=1, style=plot.style_line)
    p_os = plot(os, title="Oversold", color=color.gray, linewidth=1, style=plot.style_line)
    // Additional lines for the cloud area
    obLine_val = length
    osLine_val = -length
    p_obLine = plot(obLine_val, title="Overbought Line", color=color.gray, linewidth=1, style=plot.style_line)
    p_osLine = plot(osLine_val, title="Oversold Line", color=color.gray, linewidth=1, style=plot.style_line)
    // Add overbought and oversold clouds using the plot handles
    fill(p_ob, p_obLine, color=color.new(color.red, 90))
    fill(p_osLine, p_os, color=color.new(color.green, 90))

Latest Posts

Collapse

Topics Statistics Last Post
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
598 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
343 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
103 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
557 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
556 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X