# Privitan Ma Indicator

**URL:** <https://community.tradovate.com/t/privitan-ma-indicator/7477>\
**Category:** Custom Indicators\
**Created:** [July 4, 2023, 3:58pm UTC](https://community.tradovate.com/t/privitan-ma-indicator/7477 "2023-07-04T15:58:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![privitan](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@privitan](https://community.tradovate.com/u/privitan)\
**Post date:** [July 4, 2023, 3:58pm UTC](https://community.tradovate.com/t/privitan-ma-indicator/7477/1 "2023-07-04T15:58:26Z")

</div>

Hi all,  
I’m trying to use my custom indicator.  
Can’t find how to load it into my graph.

My code is written.  
How do I use it on Tradovate chart?  
It is under my File tree, how can I add it to the community indicators or builtin indicators?

thanks

---

<div class="post-metadata">

**Author:** ![privitan](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@privitan](https://community.tradovate.com/u/privitan)\
**Post date:** [July 4, 2023, 4:26pm UTC](https://community.tradovate.com/t/privitan-ma-indicator/7477/2 "2023-07-04T16:26:47Z")

</div>

Here the code. Looking other code from the community seems I miss the class type. How can I fix it?

study(“Privitan Overlay”, “Privitan Overlay”, overlay=true);

// ### Four Smoothed Moving Averages

var len1 = 10;  
var src1 = close;  
var smma1 = 0.0;  
var sma\_1 = sma(src1, len1);  
smma1 = na(smma1[1]) ? sma\_1 : (smma1[1] \* (len1 - 1) + src1) / len1;

plot(smma1, “21 SMMA”, color=color.white, linewidth=2);

var len2 = 20;  
var src2 = close;  
var smma2 = 0.0;  
var sma\_2 = sma(src2, len2);  
smma2 = na(smma2[1]) ? sma\_2 : (smma2[1] \* (len2 - 1) + src2) / len2;  
plot(smma2, “50 SMMA”, color=color.new(color.rgb(106, 255, 0), 0), linewidth=2);

var h100 = input(true, “Show 100 Line”, group=“Smoothed MA Inputs”);  
var len3 = 50;  
var src3 = close;  
var smma3 = 0.0;  
var sma\_3 = sma(src3, len3);  
smma3 = na(smma3[1]) ? sma\_3 : (smma3[1] \* (len3 - 1) + src3) / len3;  
var sma3plot = plot(h100 ? smma3 : na, “100 SMMA”, color=color.new(color.yellow, 0), linewidth=2);

var len4 = 100;  
var src4 = close;  
var smma4 = 0.0;  
var sma\_4 = sma(src4, len4);  
smma4 = na(smma4[1]) ? sma\_4 : (smma4[1] \* (len4 - 1) + src4) / len4;  
var sma4plot = plot(smma4, “200 SMMA”, color=color.new(color.rgb(255, 5, 0), 0), linewidth=2);

// Trend Fill

var trendFill = input(true, “Show Trend Fill”, group=“Smoothed MA Inputs”);  
var ema2 = ema(close, 2);  
var ema2plot = plot(ema2, “EMA(2)”, color=color.rgb(46, 204, 113), transp=100, linewidth=1);

fill(ema2plot, sma4plot, color=ema2 \> smma4 && trendFill ? color.green : ema2 \< smma4 && trendFill ? color.red : na, transp=85, title=“Trend Fill”);

// End ###

// ### Trading Session

var ts = input(true, “Show Trade Session”, group=“Trade Session”);

var tz = input(“America/Chicago”, “Timezone”, options=[“Asia/Sydney”, “Asia/Tokyo”, “Europe/Frankfurt”, “Europe/London”, “UTC”, “America/New\_York”, “America/Chicago”], group=“Trade Session”);  
var label = input(“CME Open”, “Label”, group=“Trade Session”);

var startHour2 = input(8, “Session Start hour”, minval=0, maxval=23, group=“Trade Session”);  
var startMinute2 = input(30, “Session Start minute”, minval=0, maxval=59, group=“Trade Session”);  
var endHour2 = input(12, “Session End hour”, minval=0, maxval=23, group=“Trade Session”);  
var endMinute2 = input(0, “Session End minute”, minval=0, maxval=59, group=“Trade Session”);

var rangeColor = input(color.new(color.rgb(25, 118, 210), 31), “Color”, group=“Trade Session”);  
var showMon = input(true, “Monday”, group=“Trade Session”);  
var showTue = input(true, “Tuesday”, group=“Trade Session”);  
var showWed = input(true, “Wednesday”, group=“Trade Session”);  
var showThu = input(true, “Thursday”, group=“Trade Session”);  
var showFri = input(true, “Friday”, group=“Trade Session”);  
var showSat = input(false, “Saturday”, group=“Trade Session”);  
var showSun = input(false, “Sunday”, group=“Trade Session”);

var tzYear = year(time, tz);  
var tzMonth = month(time, tz);  
var tzDay = dayofmonth(time, tz);  
var tzDayOfWeek = dayofweek(time, tz);  
var startTime2 = timestamp(tz, tzYear, tzMonth, tzDay, startHour2, startMinute2);  
var endTime2 = timestamp(tz, tzYear, tzMonth, tzDay, endHour2, endMinute2);

var active2 = startTime2 \<= time && time \<= endTime2 && ts &&  
((tzDayOfWeek === dayofweek.monday && showMon) ||  
(tzDayOfWeek === dayofweek.tuesday && showTue) ||  
(tzDayOfWeek === dayofweek.wednesday && showWed) ||  
(tzDayOfWeek === dayofweek.thursday && showThu) ||  
(tzDayOfWeek === dayofweek.friday && showFri) ||  
(tzDayOfWeek === dayofweek.saturday && showSat) ||  
(tzDayOfWeek === dayofweek.sunday && showSun));

bgcolor(color=active2 ? rangeColor : na, title=“Session Background”);

// End ###

// eof

---

<div class="post-metadata">

**Author:** ![rh7](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@rh7](https://community.tradovate.com/u/rh7)\
**Post date:** [July 12, 2023, 12:19am UTC](https://community.tradovate.com/t/privitan-ma-indicator/7477/3 "2023-07-12T00:19:22Z")

</div>

> [@privitan](#):
>
> How do I use it on Tradovate chart?  
> It is under my File tree,

Hopefully you’ve figured it out already, but look at the built-in indicators. Copy one, adjust for the changed directory. See if you can get it to work and go from there. You need module.exports code at the bottom of every indicator that will provide information like the indicator name and a tag to say where the indicator should show up when selecting it on a chart.
