gFancyMA
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GalacticS2021

//@version=5

// @description: Contains reusable functions/ labeled moving average
library("GalacticS2021", true)

// @function : Connects label to ma
// @param y : add parameter y coordinate
// @param x : add paramete length
// @param c : add parameter c add the label color
// @param m : add parameter mode of the moving averagee
// @param a : add parameter a bool to toggle the ma visibility
// @param b : add parameter b bool to toggle the label visibility
// @param o : add parameter o bool lablel offset
// @returns : function returns the label 


bool a = true
bool b = true
color c = na
var src = close

string m = na
float y = na
loffset = 5
Xoffset = time_close + loffset * timeframe.multiplier * 60 * 1000

export printLbl(float y,int x,color c,string m,bool b) =>
    var label labelX = na
    int o = Xoffset
    if a and b and barstate.isrealtime
        labelX := label.new(x=o, y=y, xloc=xloc.bar_time,style = label.style_none, textalign=text.align_right,size = size.small)
        //labelX.set_x(labelX, arg2)
        label.set_text(labelX, str.tostring(x)+' '+ m)
        label.set_textcolor(labelX, c)
        label.delete(labelX[1])
        labelX


    

