Inside/Outside bar 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

Inside/Outside bar indicator

Postby Alexander.Gettinger » Tue Aug 17, 2010 2:44 am

Indicator mark inside and outside bars.

InsideOutsideBar.png


Code: Select all
function Init()
    indicator:name("Inside/outside bar Indicator");
    indicator:description("Inside/outside bar Indicator");
    indicator:requiredSource(core.Bar);
    indicator:type(core.Indicator);
   
    indicator.parameters:addColor("clrIn", "Inside bar color", "Inside bar color", core.rgb(255, 255, 0));
    indicator.parameters:addColor("clrOut", "Outside bar color", "Outside bar color", core.rgb(0, 0, 255));
end

local first;
local source = nil;
local buffIn;
local buffOut;

function Prepare()
    source = instance.source;
    Percent=instance.parameters.Percent;
    MaxPeriod=instance.parameters.MaxPeriod;
    first = source:first()+2;
    local name = profile:id() .. "(" .. source:name() .. ")";
    instance:name(name);
    buffIn = instance:createTextOutput ("Inside", "Inside", "Wingdings", 10, core.H_Center, core.V_Center, instance.parameters.clrIn, first);
    buffOut = instance:createTextOutput ("Outside", "Outside", "Wingdings", 10, core.H_Center, core.V_Center, instance.parameters.clrOut, first);
end

function Update(period, mode)
    if (period>first) then
     if source.high[period]>source.high[period-1] and source.low[period]<source.low[period-1] then
      buffOut:set(period, source.high[period], "\159", "");
     end
     if source.high[period]<source.high[period-1] and source.low[period]>source.low[period-1] then
      buffIn:set(period, source.low[period], "\159", "");
     end
    end
end
Attachments
InsideOutsideBar.lua
(1.44 KiB) Downloaded 2674 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Inside/Outside bar indicator

Postby Alexander.Gettinger » Tue Mar 29, 2011 3:00 am

Modification of Inside/Outside bar indicator.
Indicator paints bars in different colors.

InsideOutsideBar2.png


Download:
InsideOutsideBar2.lua
(2.99 KiB) Downloaded 2270 times

InsideOutsideBar2 with Alert.lua
(12.68 KiB) Downloaded 910 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Inside/Outside bar indicator

Postby conejobum » Tue Mar 29, 2011 2:23 pm

you did a great job apprentice ...I am really pleased.

Thank a lot.

conejobum
conejobum
 
Posts: 8
Joined: Sat Apr 24, 2010 8:48 pm

Re: Inside/Outside bar indicator

Postby ginlin84 » Mon Aug 29, 2011 10:32 am

thx..
about this indicator, can make it more variable? as sometime I would just require inside bar only in my chart.
ginlin84
 
Posts: 2
Joined: Mon Aug 29, 2011 9:45 am

Re: Inside/Outside bar indicator

Postby Apprentice » Mon Aug 29, 2011 3:44 pm

Your request I added to our database.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Inside/Outside bar indicator

Postby Alexander.Gettinger » Mon Sep 05, 2011 10:45 am

ginlin84 wrote:thx..
about this indicator, can make it more variable? as sometime I would just require inside bar only in my chart.


Please, see this indicator:
InsideOutsideBar.lua
(1.67 KiB) Downloaded 1430 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Inside/Outside bar indicator

Postby vstrelnikov » Mon Sep 19, 2011 7:00 pm

I've fixed small defect with real time candles.
Updated 'InsideOutsideBar.lua' above and in first post.
vstrelnikov
 
Posts: 59
Joined: Tue Jul 06, 2010 8:31 pm

Re: Inside/Outside bar indicator

Postby nazaar » Mon Nov 28, 2011 5:57 pm

Hi,

this sounds like an excellent indicator tool. What are the criterias for an inside or outside bars?

thanks,
nazaar
nazaar
FXCodeBase: Initiate
 
Posts: 178
Joined: Fri May 27, 2011 2:21 pm
Location: Ontario, Canada

Re: Inside/Outside bar indicator

Postby Apprentice » Mon Nov 28, 2011 6:22 pm

OutSide

if source.high[period]>source.high[period-1] and source.low[period]<source.low[period-1]

InSide
if source.high[period]<source.high[period-1] and source.low[period]>source.low[period-1]
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Inside/Outside bar indicator

Postby crusader1 » Mon Sep 10, 2012 7:57 am

Hi guys nice one but it is little confusing.
It is not possible to do it more easy with only letter above or below the candle.
for outside it will be O for inside it will be I and for same open it will be T?
Because I was trading several years on MT4 and now I have change it ti TS2 and Green and red candle is very important for me ;)

thx
crusader1
 
Posts: 5
Joined: Fri Sep 07, 2012 8:45 am

Next

Return to Custom Indicators

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 52 guests