Contains a type HTFMA used to return data on six moving averages from a higher timeframe. Several types of MA's are supported.
█ HOW TO USE
Please see instructions in the code (in library description). (Important: first fold all sections of the script: press Cmd + K then Cmd + - (for Windows Ctrl + K then Ctrl + -)
█ FULL LIST OF FUNCTIONS AND PARAMETERS
method getMaType(this) Enumerator function, given a key returns `enum MaTypes` value Namespace types: series string, simple string, input string, const string Parameters: this (string)
method update(this) Namespace types: HTFMAs Parameters: this (HTFMAs)
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps0 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps1 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps2 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps3 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps4 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps5 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (RsParamsMAs) Target object to import prop values to. oCfg (objProps6 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs) oCfg (objProps7 type from moebius1977/CSVParser/1) maCount (int)
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: RsParamsMAs Parameters: this (RsParamsMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps8 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps0 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps1 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps2 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps3 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps4 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps5 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them) Namespace types: HTFMAs Parameters: this (HTFMAs): (HTFMAs) Target object to import prop values to. oCfg (objProps6 type from moebius1977/CSVParser/1): (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects maCount (int): (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1) Returns: this
method importConfig(this, oCfg, maCount) Namespace types: HTFMAs Parameters: this (HTFMAs) oCfg (objProps7 type from moebius1977/CSVParser/1) maCount (int)
method importConfig(this, oCfg, maCount) Namespace types: HTFMAs Parameters: this (HTFMAs) oCfg (objProps8 type from moebius1977/CSVParser/1) maCount (int)
method newRsParamsMAs(this) Namespace types: LO Parameters: this (LO)
method newHTFMAs(this) Namespace types: LO Parameters: this (LO)
RsMaCalcParams Parameters of one MA (only calculation params needed within req.sec(), visual parameters are within htfMAs type) Fields: enabled (series bool) maType (series MaTypes): MA type options: SMA / EMA / WMA / ... src (series string) prd (series int): MA period
RsParamsMAs Collection of parameters of 6 MAs. Used to pass params to req.sec() Fields: ma1CalcParams (RsMaCalcParams) ma2CalcParams (RsMaCalcParams) ma3CalcParams (RsMaCalcParams) ma4CalcParams (RsMaCalcParams) ma5CalcParams (RsMaCalcParams) ma6CalcParams (RsMaCalcParams)
RsReturnMAs Used to return data from req.sec(). Fields: htfBi (series int) ma1 (series float) ma2 (series float) ma3 (series float) ma4 (series float) ma5 (series float) ma6 (series float)
MaDrawing MA's plot parameters plus drawing objects for MA's current level (line and label). Fields: lnClr (series color): (color) MA plot line color (like in plot()) lnWidth (series int): (int) MA plot line width (like in plot()) lnStyle (series string): (string) MA plot line style (like in plot()) showHistory (series bool): (bool) Whether to plot the MA on historical bars or only show current level to the right of the latest bar. showLabel (series bool): (bool) Whether to show the name of the MA to the right of the MA's level ln (series line): (line) line to show MA"s current level lbl (series label): (label) label showing MA's name
HTFMAs Contains data and drawing parameters for MA's of one timeframe (MA calculation parameters for MA's of one timeframe are in a separate object RsParamsMAs) Fields: rsRet (RsReturnMAs): (RsReturnMAs) Contains data returned from req.sec(). Is set to na in between HTF bar changes if smoothing is enabled. rsRetLast (RsReturnMAs): (RsReturnMAs) Contains a copy of data returned from req.sec() in case rsRet is set to na for smoothing. rsRetNaObj (RsReturnMAs): (RsReturnMAs) An empty object as `na` placeholder ma1Drawing (MaDrawing): (MaDrawing) MA drawing properties ma2Drawing (MaDrawing): (MaDrawing) MA drawing properties ma3Drawing (MaDrawing): (MaDrawing) MA drawing properties ma4Drawing (MaDrawing): (MaDrawing) MA drawing properties ma5Drawing (MaDrawing): (MaDrawing) MA drawing properties ma6Drawing (MaDrawing): (MaDrawing) MA drawing properties enabled (series bool): (bool ) Enables/disables all of the MAs of one timeframe. tf (series string): (string) Timeframe showHistory (series bool): (bool ) Plot MA line on historical bars rngAtrQ (series int): (int ) A multiplier for atr(14). Determines a range within which the MA's will be plotted. MA's too far away will not be plotted. showRecentBars (series int): (int ) Only plot MA on these recent bars smoothen (series bool): (bool ) Smoothen MA plot. If false the same HTF value is returned on all chart bars within a HTF bar (intrabars), so the plot looks like steps. lblsOffset (series int): (int ) Show MA name this number of bars to the right off last bar. lblsShow (series bool): (bool ) Show MA name lnOffset (series int): (int ) Start line showing current level of the MA this number of bars to the right off the last bar. lblSize (series string): (string) Label size lblStyle (series string): (string) Label style lblTxtAlign (series string): (string) Label text align bPopupLabel (series bool): (bool ) Show current MA value as a tooltip to MA's name.
LO LO Library object, whose only purpose is to serve as a shorthand for library name in script code. Fields: dummy (series string)
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.