Script: CrossAbove | Mastock Help



Short Name: CrossAbove

Definition: Returns an array of values representing index of the days where curve1 crosses above curve2 or a specific level

Usage: crossAbove(curve1,curve2) or crossAbove(curve1,level)

Objective:
  • This instruction is used when defining triggers, to signal a buy or sell day
  • Returns an array of days.

Note:
  • The parameters can either be arrays representing a curve, or a value representing a level

Examples:
  • crossAbove(rsi(14),50) returns an array of days when RSI crosses above 50
  • crossAbove(macd(12,26,9),macdAvg(12,26,9)) returns an array of days when macd crosses above its average
  • cross MACD:
  • premier = macd(12,26,9)
  • deuxieme = macdavg(12,26,9)
  • buy = crossabove(premier,deuxieme)
  • sell = crossbelow(premier,deuxieme)
  • notifyresult(buy,sell)