FXCM Forex Trading


Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin


Postby TonyMod » Wed Jan 06, 2010 1:58 pm

Hello Everybody,

Here is the STARC Bands indicator that was developed by user's request. Original topic with the request: http://www.fxcodebase.com/code/viewtopic.php?f=18&t=159

Description on how to use this indicator you can find here:

STARC Band.jpg
Screenshot from MarketScope.

Download STARC Bands in .Lua
(2.69 KiB) Downloaded 813 times

Customizable STARC.lua
(5.95 KiB) Downloaded 113 times

Code: Select all
--- Indicator profile initialization routine
-- Defines indicator profile properties and indicator parameters
function Init()
    indicator:name("STARC Band");
    indicator:description("Indicates upper and lower limits of price movement.");
    indicator.parameters:addInteger("USM", "Multiplier", "The deviation multiplier", 2);
    indicator.parameters:addInteger("SMA_N", "Number of MVA periods", "The number of periods used in the Moving Average calculation", 6);
    indicator.parameters:addInteger("ATR_N", "Number of ATR periods", "The number of periods used in the Average True Range calculation", 14);
    indicator.parameters:addColor("UB_color", "Upper line color", "The color of the upper line", core.rgb(0, 255, 0));
    indicator.parameters:addColor("LB_color", "Lower line color", "The color of the lower line", core.rgb(255,0,0));
    indicator.parameters:addColor("AL_color", "Average line color", "The color of the average line", core.rgb(192,192,192));

-- Parameters block
local USM;

local first;
local source = nil;

-- internal indicators
local SMA = nil;
local ATR = nil;

-- Streams block
local UB = nil;
local LB = nil;
local AL = nil;

-- Indicator instance initialization routine
-- Processes indicator parameters and creates output streams
function Prepare()
    USM = instance.parameters.USM;
    source = instance.source;   
    local SMA_N = instance.parameters.SMA_N;
    local ATR_N = instance.parameters.ATR_N;
    local PriceType = instance.parameters.SMA_source;
    local name = profile:id() .. "(" .. source:name() .. ", ".. USM .. ", ".. SMA_N .. ", ".. ATR_N .. ")";
    local pricestream = source.close;
    SMA = core.indicators:create("MVA", pricestream, SMA_N);
    ATR = core.indicators:create("ATR", source, ATR_N);
    first = math.max(SMA.DATA:first(), ATR.DATA:first());
    UB = instance:addStream("UB", core.Line, name, "Uppper Band", instance.parameters.UB_color, first);   
    LB = instance:addStream("LB", core.Line, name, "Lower Band", instance.parameters.LB_color, first);
    AL = instance:addStream("AL", core.Line, name, "Average", instance.parameters.AL_color, first);

-- Indicator calculation routine
-- TODO: Add your code for calculation output values
function Update(period, mode)

    if period >= first and source:hasData(period) then
        local smaVal = SMA.DATA[period];
        local atrVal = USM * ATR.DATA[period];

        UB[period] = smaVal + atrVal;
        LB[period] = smaVal - atrVal;
        AL[period] = smaVal;

Respond to this topic if you have questions.
Best Regards,

(FXCodeBase.com Forum Moderator)
FXCodeBase: Site Admin
Posts: 70
Joined: Wed Oct 21, 2009 1:57 pm
Location: New Jersey

Re: STARC Bands

Postby ausjus18 » Sun May 30, 2010 6:29 am

This is a really useful indicator. Is there a way of allowing multipliers that are 0.1 increments, not just limited to 1,2,3 etc. Thanks.
Posts: 4
Joined: Tue Apr 27, 2010 11:48 pm

Re: STARC Bands

Postby Nikolay.Gekht » Mon May 31, 2010 11:30 am

Yes, it is very easy. Only one line must be replaced
indicator.parameters:addInteger("USM", "Multiplier", "The deviation multiplier", 2);
indicator.parameters:addDouble("USM", "Multiplier", "The deviation multiplier", 2);

Download the modified version.
FXCodeBase: Base Builder
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: STARC Bands

Postby ausjus18 » Tue Jun 01, 2010 8:14 pm

That's fantastic! Thank you Nikolay! Really appreciate your help.
Posts: 4
Joined: Tue Apr 27, 2010 11:48 pm

Re: STARC Bands

Postby Thecity » Sun Apr 26, 2015 4:02 pm

Hello, It would be nice to have the possibility to choose from differents type of the moving average (Ema for example).

The concept "MA + ATR*multiplier" it's really interesting, thank you.
Posts: 6
Joined: Thu Apr 16, 2015 8:39 am

Re: STARC Bands

Postby Apprentice » Mon Apr 27, 2015 2:55 am

Customizable STARC.lua Added.
User avatar
FXCodeBase: Confirmed User
Posts: 17153
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: STARC Bands

Postby Apprentice » Sun Aug 13, 2017 5:53 am

The indicator was revised and updated.
User avatar
FXCodeBase: Confirmed User
Posts: 17153
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot] and 8 guests