🛠️ Tools
HomeGet AccessRequest A Feature
  • 🎯Start Here
    • Introduction
      • Disclaimer
      • Get this tool.
    • Overview
      • Why?
      • How To Use This?
      • Limitations
      • FAQ
  • 🎚️Settings
    • Signal Detection
    • Strategy Properties
    • Time Filter
    • Entry Stops
    • Take Profit
    • Visual Info
    • Broker Connector
      • Set up Broker Connector
  • 🤸Tips And Tricks
    • Chart Aesthetics
    • Tweak Your Settings
    • How To Create An Alert?
    • Live Monitoring
    • What Is The Best Trading Strategy?
      • How To Get The Best Strategy Results?
  • 📄Setup Instructions
    • Overview
      • Prerequisites
    • Generate Trading Signals
      • Build your own
      • Presets
        • 2 MA Cross
        • Reversal Signals [LuxAlgo]
        • SuperTrend
    • Connect Trading Signals To PSStrategyX
    • Set Up AutoView
      • Coupons & Referrals
    • Set Up An Exchange Account
      • Supported Exchanges
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Setup Instructions
  2. Generate Trading Signals
  3. Presets

2 MA Cross

PreviousPresetsNextReversal Signals [LuxAlgo]

Last updated 2 years ago

Was this helpful?

//@version=5
indicator(title="[preset] 2 MA Cross", overlay=true, timeframe="", timeframe_gaps=true)
shortlen = input.int(9, "Short MA Length", minval=1)
longlen = input.int(21, "Long MA Length", minval=1)
short = ta.sma(close, shortlen)
long = ta.sma(close, longlen)
plot(short, color = #FF6D00, display = display.pane)
plot(long, color = #43A047, display = display.pane)
buy = ta.crossover(short, long)
sell = ta.crossunder(short, long)
signal = buy ? 1 : sell ? -1 : na
plotshape(buy, '', shape.labelup, location.belowbar, color.green, 0, 'BUY', color.black, display = display.pane)
plotshape(sell, '', shape.labeldown, location.abovebar, color.red, 0, 'SELL', color.black, display = display.pane)
plot(signal, 'Signal', display = display.data_window)
📄