TrendLord Indicator [Upd Oct, 05]

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

TrendLord Indicator [Upd Oct, 05]

Postby Alexander.Gettinger » Sun Sep 05, 2010 10:29 pm

Update Oct, 05 2010. The indicator performance is improved and additional features are provided for in-strategies and in-signal usage.

The indicator is a port of Metatrader TrendLord indicator.

Trendlord indicator shows the trend direction. A green bar means uptrend and a red bar means down trend.

A green bar appears when TrendLordFunction is above the previous value and a red bar appears when it's below the previous value.

Important! The indicator repaints one bar back when direction is switched. So, the signal and/or strategy will show the signal two bars back against the displayed value.

The function is
LWMA(LWMA(close, N), SquareRoot(N))
where N is the indicator parameters.



TrendLord.png


Download indicator:


Code: Select all
function Init()
    indicator:name("Trend lord");
    indicator:description("Trend lord");
    indicator:requiredSource(core.Tick);
    indicator:type(core.Oscillator);

    indicator.parameters:addGroup("Calculation");
    indicator.parameters:addInteger("Period", "Period", "Period", 50);
    indicator.parameters:addBoolean("StrategyMode", "Don't change, parameter is for strategies only!!!", "", false);

    indicator.parameters:addGroup("Style");
    indicator.parameters:addColor("clrUP", "UP color", "UP color", core.rgb(0, 255, 0));
    indicator.parameters:addColor("clrDN", "DN color", "DN color", core.rgb(255, 0, 0));
end

local first;
local source = nil;
local Period;
local MA;
local buffUP=nil;
local buffDN=nil;
local array1;
local array2;

function Prepare(onlyName)
    source = instance.source;
    Period=instance.parameters.Period;

    local name = profile:id() .. "(" .. source:name() .. ", " .. instance.parameters.Period .. ")";
    instance:name(name);

    if onlyName then
        return ;
    end

    MA = core.indicators:create("LWMA", source, Period);
    firstMA = MA.DATA:first();
    MA2 = core.indicators:create("LWMA", MA.DATA, math.sqrt(Period));
    array1 = MA2.DATA;
    first = array1:first() + 1;

    if instance.parameters.StrategyMode then
        array2 = instance:addStream("D", core.Line, name .. ".D", "D", core.rgb(0, 0, 0), first);
        array2:setStyle(core.LINE_NONE);
    else
        array2 = instance:addInternalStream(first, 0);
    end

    buffUP = instance:addStream("UP", core.Bar, name .. ".UP", "UP", instance.parameters.clrUP, first);
    buffDN = instance:addStream("DN", core.Bar, name .. ".DN", "DN", instance.parameters.clrDN, first);
end

function Update(period, mode)
    MA:update(mode);
    MA2:update(mode);

    if period >= first then
        array2[period] = array2[period - 1];
        if array1[period] > array1[period - 1] then
            array2[period] = 1;
        elseif array1[period] < array1[period - 1] then
            array2[period] = -1;
        end

        if array2[period] > 0 then
            buffUP[period] = array1[period];
            if array2[period - 1] < 0 then
                buffUP[period - 1] = array1[period - 1];
                buffDN[period - 1] = nil;
            end
        elseif array2[period] < 0 then
            buffDN[period]=array1[period];
            if array2[period - 1] > 0 then
                buffDN[period - 1] = array1[period - 1];
                buffUP[period - 1] = nil;
            end
        end
     end
end

TrendLord.lua
(3.08 KiB) Downloaded 1786 times


TrendLord with Higher Time Frame Confirmation.png

TrendLord with Higher Time Frame Confirmation will add Higher Time Frame TrendLord,
to confirm the chart time frame indications.

TrendLord with Higher Time Frame Confirmation.lua
(8.7 KiB) Downloaded 407 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3340
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: TrendLord Indicator (make a signal?)

Postby virgilio » Fri Sep 24, 2010 4:37 pm

Is it possible to create a signal for this indicator with a sound associated to buys and sells?
virgilio
 
Posts: 66
Joined: Mon Aug 23, 2010 12:16 pm

Re: TrendLord Indicator

Postby Apprentice » Sat Sep 25, 2010 4:42 am

Added to development cue.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 19421
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: TrendLord Indicator

Postby Apprentice » Sat Sep 25, 2010 5:02 pm

This Signal / Strategy can be found here.
viewtopic.php?f=31&t=2262&p=4786#p4786
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 19421
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: TrendLord Indicator [Upd Oct, 05]

Postby ancient-school » Thu Jun 09, 2011 2:59 pm

Is it possible to plot this Indicator on Price?
Going for it is more important than winning or losing!
User avatar
ancient-school
 
Posts: 20
Joined: Tue Apr 13, 2010 1:56 pm

Re: TrendLord Indicator [Upd Oct, 05]

Postby sunshine » Sun Jun 12, 2011 11:58 pm

ancient-school wrote:Is it possible to plot this Indicator on Price?

To place the indicator on main chart area:
1) Double-click the indicator line. The Properties dialog will appear.
2) In the Properties dialog, go to the Location tab. Select the chart area in the list of available areas:
location.PNG

3) The confirmation box will appear. Click OK.
4) In the dialog click OK.
Your indicator will be moved to the main chart area:
trendlord.PNG
sunshine
 

Re: TrendLord Indicator [Upd Oct, 05]

Postby davidnwatson » Thu Oct 02, 2014 2:12 pm

Can you add a MA timeframe confirmation?

Thank you
davidnwatson
 
Posts: 29
Joined: Thu May 01, 2014 10:34 am

Re: TrendLord Indicator [Upd Oct, 05]

Postby Apprentice » Sat Oct 04, 2014 2:36 am

Sure. Will try to write something for you tomorrow.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 19421
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: TrendLord Indicator [Upd Oct, 05]

Postby Apprentice » Mon Oct 06, 2014 12:06 pm

TrendLord with Higher Time Frame Confirmation Added.

by davidnwatson » Thu Oct 02, 2014 9:12 pm
Can you add a MA timeframe confirmation?

Something like this.
Your request is not eloquent at best,
and It is difficult to decipher it.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 19421
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: TrendLord Indicator [Upd Oct, 05]

Postby davidnwatson » Mon Oct 06, 2014 1:27 pm

Something like this.
Your request is not eloquent at best,
and It is hard to difficult to decipher it.


Sorry about that...
1. I download the new file and it will not show up under my strategies.. check it on your end..

2. After looking at other strategies I think I was asking for was a MA Filter based on a timeframe..This may be what you did, once I can load it and look..

So a Buy trade would be as (1 min chart)
Trendlord green
if price above 1hr 50 MA
Buy

Trendlord green
if price below 1hr 50 MA
do nothing

Trendlord red
if price below 1hr 50 MA
sell

Trendlord red
if price above 1hr 50 MA
do nothing
davidnwatson
 
Posts: 29
Joined: Thu May 01, 2014 10:34 am

Next

Return to Custom Indicators

Who is online

Users browsing this forum: No registered users and 19 guests