TradingView
mastixmc
2020년 7월 29일 오전 11시 10분

MACD Crossover Trend Indicator 

Euro Fx/U.S. DollarFXCM

설명

How this indicator works:

This indicator detects MACD Crossovers based on the current trend. It checks wether the current close price is above or below the 200 EMA and therefore decides whether we are in an up- or down trend.

UP-TREND: If the MACD is below 0 and crosses up the signal line, then this is a BUY signal!

DOWN-TREND: If the MACD is above 0 and crosses down the signal line, then this is a SELL signal!

How to trade this:

First rule: Be consistent!
Second rule: You will have lost trades and losing streaks - deal with it!

  • First set the SL slightly below the last significant low (eventually add/subtract the ATR value to/from it)
  • Then adjust the TP and ALWAYS use a RR ratio of 1.5.
  • NEVER get out of the trade earlier
  • Take every possible trade!


Important: Money management is key... so be consistent!

Have fun! :)
코멘트
madmoneyforex
Hi there,

I hope this reaches you.

Is there a way to add alerts?
I would love it if my trading view app sent me a notification when a buy or sell signal happens.

Thanks.
Love this strategy
DateRaid
@madmoneyforex, Delete line 32 onwards in the script above and replace with this, it modifies it so buy/sell signals don't repeat and it adds the alert. If you do want repeating buy/sell signals, just remove the part "Code to stop repeating buy/sell signals..." between the dashes and change the instances of "longsignal" back to "bullish" and "shortsignal" back to "bearish" as per the original script, but it will still have the alerts :)

// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
bullish = close > EMA50 and EMA200 and macd_crossup
bearish = close < EMA50 and EMA200 and macd_crossdown

// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code to stop repeating buy/sell signals...

// Create variable that saves and doesnt calculate on each bar
var pos = 0

// Save that to a new number when long happens. Long can be 1
if bullish and pos <= 0
pos := 1
// we save it again when short happens. Short can be -1
if bearish and pos >= 0
pos := -1

// Check if there's a newly detetected change from another number to pos number this bar
// Is pos equal to 1 and was it not equal to 1 one bar ago?
longsignal = pos == 1 and (pos != 1)[1]
shortsignal = pos == -1 and (pos != -1)[1]

// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
//Plot
plotshape(longsignal, title='buy', text='Buy', color=color.new(color.green, 0), style=shape.labelup, location=location.belowbar, size=size.small, textcolor=color.new(color.white, 0)) //plot for buy icon
plotshape(shortsignal, title='sell', text='Sell', color=color.new(color.red, 0), style=shape.labeldown, location=location.abovebar, size=size.small, textcolor=color.new(color.white, 0)) //plot for sell icon

alertcondition(longsignal, title='Buy', message='Buy')
alertcondition(shortsignal, title='Sell', message='Sell')

// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
sami0707
HI THERE ,
thanks for your scrip,
just wondering if is there any way you can add a part that plot the EMA 200 on the chart?
as you know on the free version on tradingview you cant add more than 3 indicators,
so it would be great if you can add a scrip that shows the EMA 200 on the chart as well
DateRaid
This is a great script, but is there any way I can edit the script do this:

- If a Buy label is created on the chart, it cannot create another Buy label, unless a Sell label has been created previously?
- If a Sell label is created on the chart, it cannot create another Sell label, unless a Buy label has been created previously?

This would mean there's far less Buy and Sell labels, but if the script was used with an alert, it would only be triggered for one buy, then one sell, so if you were going all-in then it would stop it trying to make repeat buys and sells.

Cheers.
더보기