OPEN-SOURCE SCRIPT

RSI Crosses SMA Buy/Sell Strategy-R-AlgoAI

285
Disclaimer:
// This script is for educational and informational purposes only.
// It does not constitute financial or investment advice.
// Trading involves substantial risk and may not be suitable for all investors.
// Always do your own research or consult with a licensed financial advisor
// before making any trading or investment decisions.
// The author is not responsible for any losses incurred using this script

Key Changes:
Buy at High of the Signal Candle:

The strategy.entry("Buy", strategy.long, limit=high, comment="Buy at High of Signal Candle") line places a buy order at the high of the candle that triggered the signal (i.e., the candle where the RSI crosses above the SMA).

How it works:

When the RSI crosses above the SMA and the buy condition is true, the strategy will place a buy order at the high of that candle.

Exit:

The strategy will exit the position if the RSI crosses below the SMA as usual using strategy.close("Buy").

Example:
If the RSI crosses above the SMA at a specific candle, the strategy will enter a buy order at the high of that candle.

When the RSI crosses below the SMA, it will close the long position.

This should now execute a buy order at the high of the signal candle when the RSI crosses above the SMA, as requested.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.