Time Price Opportunity Profile

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

Time Price Opportunity Profile

Postby Nikolay.Gekht » Sun Apr 11, 2010 8:02 pm

The indicator shows how many times the median price of the bar appears during the whole loaded history.

TPO.PNG


Download the indicator:
TPO.lua
(2.33 KiB) Downloaded 1352 times



Code: Select all
-- Indicator profile initialization routine
-- Defines indicator profile properties and indicator parameters
function Init()
    indicator:name("Time Price Opportunity Profile");
    indicator:description("The indicator calculates how often the price appears in the historical data");
    indicator:requiredSource(core.Bar);
    indicator:type(core.Indicator);

    indicator.parameters:addInteger("BoxSize", "Size of price box in pips", "", 5);
    indicator.parameters:addInteger("Per", "Number of points", "Number of points (1 pt = 1/72 of inch) to display histogram", 50);
    indicator.parameters:addColor("S1", "Color", "", core.rgb(127, 127, 127));
end

-- Indicator instance initialization routine
-- Processes indicator parameters and creates output streams
-- Parameters block
local BoxSize;
local Per;
local TPO = {};
local source = nil;
local S1;
local first;

-- Routine
function Prepare()
    BoxSize = instance.parameters.BoxSize;
    Per = instance.parameters.Per;
    S1 = instance.parameters.S1;
    source = instance.source;
    first = source:first();
    source = instance.source;
    local name = profile:id() .. "(" .. source:name() .. ", " .. BoxSize .. ")";
    instance:name(name);
    instance:addStream("H", core.Line, name .. ".H", "H", S1, 0, 20);
end

local prevDate = -1;
local max = 0;

-- Indicator calculation routine
function Update(period)
    if period >= first then
        local date = source:date(period)
        if date < prevDate then
            TPO = {};
            max = 0;
        elseif date == prevDate then
            return ;
        end

        prevDate = date;

        local median;
        median = (source.high[period] + source.low[period] + source.close[period]) / 3;
        -- express in pips
        median = median / source:pipSize();
        median = median - median % BoxSize;
        local v = rawget(TPO, median);
        if v == nil then
            v = 0;
        end
        v = v + 1;
        if v > max then
            max = v;
        end
        local v = rawset(TPO, median, v);

        core.host:execute("removeAll");
        for k, v in pairs(TPO) do
            local length = v / max * Per;
            core.host:execute("drawLine", k, -2, k * source:pipSize(), length, k * source:pipSize(), S1);
        end
    end
end
Nikolay.Gekht
FXCodeBase: Base Builder
 
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Time Price Opportunity Profile

Postby thetruth » Mon Aug 23, 2010 9:08 am

exelent! good work! can you transform this histogram to a line like the line in this link thanks!
http://www.x-trader.net/articulos/siste ... ciona.html
Last edited by thetruth on Fri Jun 15, 2012 10:24 am, edited 1 time in total.
thetruth
 
Posts: 43
Joined: Thu Feb 25, 2010 3:39 pm

Re: Time Price Opportunity Profile

Postby Nikolay.Gekht » Mon Aug 23, 2010 9:19 am

I think yes. However, have you the similar description on English? I'm afraid that using online translators would cause some misreadings.
Nikolay.Gekht
FXCodeBase: Base Builder
 
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Time Price Opportunity Profile

Postby thetruth » Mon Aug 23, 2010 10:49 am

sorry, but i don´t have an english description, but, i tried to traslate the idea, i speak spanish, sorry for mistakes. the idea of this indicator is draw the center of histogram from some number of candles.
thetruth
 
Posts: 43
Joined: Thu Feb 25, 2010 3:39 pm

Re: Time Price Opportunity Profile

Postby dlouisbriggs » Thu Dec 16, 2010 8:37 am

Are you sure that the entire data history (max 300 bars) is utilized to display the TPO bars on the right? When I zoom the screen out, the TPO bars change according to the increased data history (candelsticks) being displayed.
dlouisbriggs
 
Posts: 16
Joined: Thu Nov 11, 2010 10:00 am

Re: Time Price Opportunity Profile

Postby Coondawg71 » Sun Aug 18, 2013 5:30 am

Can we please request this indicator to be updated with gradient coloring.

Perhaps we can fashion it similar to Better Volume version 2 indicator?
search.php



or Rainbow Volume?
viewtopic.php?f=17&t=26221&hilit=rainbow+volume

If this is not feasible, please use your discretion on how to complete that task.

Thanks,

sjc
User avatar
Coondawg71
FXCodeBase: Graduate
 
Posts: 324
Joined: Sat Jan 15, 2011 11:45 am

Re: Time Price Opportunity Profile

Postby Apprentice » Mon Aug 19, 2013 2:10 am

Your request is added to the development list.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18986
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Time Price Opportunity Profile

Postby Apprentice » Mon Feb 05, 2018 10:49 am

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


Return to Custom Indicators

Who is online

Users browsing this forum: 7510109079, Google [Bot] and 13 guests