rebasega10

Macd cross over strategy by Reba

FX:NAS100   US 100 Cash CFD
```
//@version=4

strategy("NASDAQ 15-Minute Trading Strategy", overlay=true, margin_long=100, margin_short=100)

// Exponential Moving Average with a period of 1000
ema = ema(close, 1000)

// MACD Indicator
= macd(close)

// Buy and Sell Signals
buySignal = crossover(macdLine, signalLine) and close > ema and macdLine < 0
sellSignal = crossunder(macdLine, signalLine) and close < ema and macdLine > 0

// Stop Loss and Risk-to-Reward Ratio
stopLoss = ema * 0.98
takeProfit = ema * 1.022
risk = abs(close - stopLoss)
reward = abs(close - takeProfit)
riskToRewardRatio = risk / reward

// Execute Buy and Sell Trades
if (buySignal)
strategy.entry("Buy", strategy.long)
strategy.exit("Stop Loss", "Buy", stop=stopLoss)
strategy.exit("Take Profit", "Buy", limit=takeProfit)
strategy.order("Risk-to-Reward", strategy.short, qty=riskToRewardRatio)

if (sellSignal)
strategy.entry("Sell", strategy.short)
strategy.exit("Stop Loss", "Sell", stop=stopLoss)
strategy.exit("Take Profit", "Sell", limit=takeProfit)
strategy.order("Risk-to-Reward", strategy.long, qty=riskToRewardRatio)
```
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.