rebasega10

Macd cross over strategy by Reba

FX:NAS100   美国100现金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)
```
免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。