MACD Trendprediction Strategy V1
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © moritz1301

//@version=4
strategy("MACD Trendprediction Strategy V1", shorttitle="MACD TPS", overlay=true)
sma = input(12,title='DEMA Courte')
lma = input(26,title='DEMA Longue')
tsp = input(9,title='Signal')
dolignes = input(true,title="Lignes")

MMEslowa = ema(close,lma)
MMEslowb = ema(MMEslowa,lma)
DEMAslow = ((2 * MMEslowa) - MMEslowb )

MMEfasta = ema(close,sma)
MMEfastb = ema(MMEfasta,sma)
DEMAfast = ((2 * MMEfasta) - MMEfastb)

LigneMACDZeroLag = (DEMAfast - DEMAslow)

MMEsignala = ema(LigneMACDZeroLag, tsp)
MMEsignalb = ema(MMEsignala, tsp)
Lignesignal = ((2 * MMEsignala) - MMEsignalb )

MACDZeroLag = (LigneMACDZeroLag - Lignesignal)

bgcolor(LigneMACDZeroLag<Lignesignal ? color.red : color.green)

if (LigneMACDZeroLag>Lignesignal)
	strategy.entry("Buy", strategy.long, comment="BUY")
	
if (LigneMACDZeroLag<Lignesignal)
	strategy.close("Buy", strategy.long, comment="SELL")






