BWLIC indicator

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

BWLIC indicator

Postby Alexander.Gettinger » Wed Jul 28, 2010 12:30 am

Line1=minimum price for [Days] last days,
Line5=maximum price for [Days] last days;
Line3=medium price for Line1 and Line5,
Line2=medium price for Line1 and Line3,
Line4=medium price for Line3 and Line5.

BWLIC.png


Code: Select all
function Init()
    indicator:name("BWLIC indicator");
    indicator:description("");
    indicator:requiredSource(core.Bar);
    indicator:type(core.Indicator);

    indicator.parameters:addInteger("Days", "Days", "No description", 23);
    indicator.parameters:addColor("Color1", "Color 1", "Color 1", core.rgb(0, 255, 0));
    indicator.parameters:addColor("Color2", "Color 2", "Color 2", core.rgb(0, 255, 0));
    indicator.parameters:addColor("Color3", "Color 3", "Color 3", core.rgb(255, 0, 0));
    indicator.parameters:addColor("Color4", "Color 4", "Color 4", core.rgb(0, 0, 255));
    indicator.parameters:addColor("Color5", "Color 5", "Color 5", core.rgb(0, 0, 255));
end

local first;
local source = nil;
local buff1;
local buff2;
local buff3;
local buff4;
local buff5;
local Days;

function Prepare()
    Days = instance.parameters.Days;
    source = instance.source;
    first = source:first();
    local name = profile:id() .. "(" .. source:name() .. ", " .. Days .. ")";
    instance:name(name);
    buff1 = instance:addStream("line1", core.Line, name .. ".line1", "line1", instance.parameters.Color1, first);
    buff2 = instance:addStream("line2", core.Line, name .. ".line2", "line2", instance.parameters.Color2, first);
    buff3 = instance:addStream("line3", core.Line, name .. ".line3", "line3", instance.parameters.Color3, first);
    buff4 = instance:addStream("line4", core.Line, name .. ".line4", "line4", instance.parameters.Color4, first);
    buff5 = instance:addStream("line5", core.Line, name .. ".line5", "line5", instance.parameters.Color5, first);
end

function Update(period, mode)
    if (period>first) then
     local d,t,d1,t1;
     local TimeDiff;
     local PriceMin=source.low[period];
     local PriceMax=source.high[period];
     d,t=source:date(period);
     for i=first,period-1,1 do
      d1,t1=source:date(i);
      TimeDiff=d-d1;
      if TimeDiff<=Days then
       PriceMin=math.min(PriceMin,source.low[i]);
       PriceMax=math.max(PriceMax,source.high[i]);
      end
     end
     local m=(PriceMin+PriceMax)/2.;
     for i=first,period,1 do
      buff1[i]=PriceMin;
      buff2[i]=(PriceMin+m)/2.;
      buff3[i]=m;
      buff4[i]=(PriceMax+m)/2.;
      buff5[i]=PriceMax;
     end
    end
end


The indicator was revised and updated
Attachments
BWLIC.lua
(2.25 KiB) Downloaded 971 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: BWLIC indicator

Postby fxcyberman » Mon May 27, 2013 11:12 am

can it be modified to use at low time frame. like m5, m30, h1..etc ?
Thanks in advance.
fxcyberman
 
Posts: 45
Joined: Mon Jan 28, 2013 10:15 am

Re: BWLIC indicator

Postby Apprentice » Sun Jun 02, 2013 11:46 am

Untitled.png

Have you try to use Data Source Period Selector
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: BWLIC indicator

Postby fxcyberman » Sun Jun 09, 2013 1:35 pm

Sorry, already tried. It doesn't work for lower time frame.
fxcyberman
 
Posts: 45
Joined: Mon Jan 28, 2013 10:15 am

Re: BWLIC indicator

Postby Apprentice » Mon Jun 10, 2013 3:41 am

For lower time frames, this is not possible,
at least not with this method of presentation.
For example ...
If u use H1 Chart Time Frame.
For every line You'll will have two lines on m30,
four lines on m15 and so on ....
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: BWLIC indicator

Postby Apprentice » Tue May 23, 2017 6:05 am

Indicator was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Custom Indicators

Who is online

Users browsing this forum: No registered users and 48 guests