OPEN-SOURCE SCRIPT

WMA 15 Cross EMA 50 with Stop Loss and Entry

Explanation of the Code:
Inputs:

wma_length: Length for the Weighted Moving Average (default: 15).

ema_length: Length for the Exponential Moving Average (default: 50).

stop_loss_percent: Percentage for the stop loss level (default: 1%).

Indicators:

ta.wma(close, wma_length): Calculates the Weighted Moving Average.

ta.ema(close, ema_length): Calculates the Exponential Moving Average.

Signals:

buy_signal: Generated when WMA crosses above EMA.

sell_signal: Generated when WMA crosses below EMA.

Stop Loss and Entry Price:

For a buy signal, the stop loss is calculated as entry_price * (1 - stop_loss_percent).

For a sell signal, the stop loss is calculated as entry_price * (1 + stop_loss_percent).

The entry price is the closing price at the time of the signal.

Plotting:

WMA and EMA are plotted on the chart.

Buy and sell signals are marked with labels.

Stop loss and entry price levels are plotted as horizontal lines.

Alerts:

Alerts are triggered when buy or sell signals are generated.

Clause de non-responsabilité