// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © mountain_man //@version=5 strategy("~mm PRO", overlay = false) //_______ SPOT trading signal. 2H timeframe. // Inputs fastest = input( 6, "Fastest lookback") faster = fastest * 2 slow = input( 20, "Slow lookback" ) slower = faster * 2 signalLength_macd = input (7, "MACD signal length") //=== Calculations [ macdLine, signal_fastest, _ ] = ta.macd(close, fastest, faster, signalLength_macd) [ macdLine_faster, signal_faster, _ ] = ta.macd(close, faster, slower, signalLength_macd) // close LONG if ( ta.falling(signal_fastest, 1)) strategy.close("long") // open LONG if( ta.rising(signal_fastest, 2) ) strategy.entry("long", strategy.long, 0.3, close - 2.0 ) // === plotting === p_signal_faster = plot(signal_faster, title="MACD signal faster", color= ta.rising(signal_faster, 2) ? #4DB6AC : #CF0000, linewidth = 3, style=plot.style_line) //=== Color the background to give early alert bgcolor(color=ta.rising(signal_fastest, 2) ? #D0D3D4 : #000000 ) barcolor( color=ta.falling(signal_fastest, 1) ? #FE2E64 : #00BFFF)