FXCM Forex Trading

Non lag Dot 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

Non lag Dot indicator

Postby Alexander.Gettinger » Mon Aug 09, 2010 2:23 pm

viewtopic.php?f=27&t=1705

NonLagDot.png


Code: Select all
function Init()
    indicator:name("NonLagDot indicator");
    indicator:description("NonLagDot indicator");
    indicator:requiredSource(core.Tick);
    indicator:type(core.Indicator);
   
    indicator.parameters:addInteger("Length", "Length", "Length", 10);
    indicator.parameters:addInteger("Filter", "Filter", "Filter", 0);
    indicator.parameters:addInteger("ColorBarBack", "ColorBarBack", "ColorBarBack", 2);
    indicator.parameters:addDouble("Deviation", "Deviation", "Deviation", 0);

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

local first;
local source = nil;
local Length;
local Filter;
local ColorBarBack;
local Deviation;
local buffUP=nil;
local buffDN=nil;
local trend;
local buff;
local Coeff;
local Phase;
local Len;

function Prepare()
    source = instance.source;
    Length=instance.parameters.Length;
    Filter=instance.parameters.Filter;
    ColorBarBack=instance.parameters.ColorBarBack;
    Deviation=instance.parameters.Deviation;
    trend = instance:addInternalStream(0, 0);
    buff = instance:addInternalStream(0, 0);
    first = source:first()+2;
    local name = profile:id() .. "(" .. source:name() .. ", " .. instance.parameters.Length .. ", " .. instance.parameters.Filter .. ", " .. instance.parameters.ColorBarBack .. ", " .. instance.parameters.Deviation .. ")";
    instance:name(name);
    buffUp = instance:createTextOutput ("Up", "Up", "Wingdings", 10, core.H_Center, core.V_Center, instance.parameters.clrUP, first);
    buffDn = instance:createTextOutput ("Dn", "Dn", "Wingdings", 10, core.H_Center, core.V_Center, instance.parameters.clrDN, first);
    Coeff=3.*math.pi;
    Phase=Length-1;
    Len=Length*4.+Phase;
end

function Update(period, mode)
    if (period>first+Len+2) then
     local Weight=0;
     local Sum=0;
     local t=0;
     for i=0,Len-1,1 do
      local g=1./(Coeff*t+1.);
      if t<=0.5 then
       g=1.;
      end
      local beta=math.cos(math.pi*t);
      local alpha=g*beta;
      Sum=Sum+alpha*source[period-i];
      Weight=Weight+alpha;
      if t<1. then
       t=t+1./(Phase-1.);
      elseif t<Len-1. then
       t=t+7./(4.*Length-1.);
      end
     end
     if Weight>0. then
      buff[period]=(1.+Deviation/100.)*Sum/Weight;
     end
     if Filter>0. then
      if math.abs(buff[period]-buff[period-1])<Filter*source:pipSize() then
       buff[period]=buff[period-1];
      end
     end
     trend[period]=trend[period-1];
     if buff[period]-buff[period-1]>Filter*source:pipSize() then
      trend[period]=1;
     end
     if buff[period-1]-buff[period]>Filter*source:pipSize() then
      trend[period]=-1;
     end
     if trend[period]>0 then
      buffUp:set(period, buff[period], "\159", "");
      if trend[period-ColorBarBack]<0 then
       buffUp:set(period-ColorBarBack, buff[period-ColorBarBack], "\159", "");
      end
     end
     if trend[period]<0 then
      buffDn:set(period, buff[period], "\159", "");
      if trend[period-ColorBarBack]>0 then
       buffDn:set(period-ColorBarBack, buff[period-ColorBarBack], "\159", "");
      end
     end

    end
end

NonLagDot.lua
(3.23 KiB) Downloaded 837 times



New Versions By Apprentice
NLD.lua
(3.59 KiB) Downloaded 623 times

NonLagDot.lua
(3.38 KiB) Downloaded 455 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 2707
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Non lag Dot indicator

Postby patick » Wed Aug 11, 2010 5:56 am

Perhaps this was a design flaw in the orig indicator, but looks like there might be a repainting issue:
Attachments
non lag DOT - repainting 8-11-2010.jpg
patick
 
Posts: 36
Joined: Tue Mar 30, 2010 2:11 pm

Re: Non lag Dot indicator

Postby briansummy » Wed Mar 07, 2012 9:08 pm

From your pic I see what you mean however trading an H1 or longer after the close of the candle I do not see this repainting. You will notice that when looking at the dots color there are breaks by a few candles and then the trend may continue. I use this as the signal in my system compared to a condition with a trend indicator. Maybe compare a short term and long term nonlagdot system? That would be an interesting EA.
briansummy
 
Posts: 53
Joined: Wed Feb 08, 2012 8:11 pm

Re: Non lag Dot indicator

Postby briansummy » Thu Mar 08, 2012 9:52 am

I just realized, an MTF Nonlagdot would be amazing. Is this possible?
briansummy
 
Posts: 53
Joined: Wed Feb 08, 2012 8:11 pm

Re: Non lag Dot indicator

Postby aricanderson » Sun Mar 11, 2012 2:22 pm

Is there any way to make a strategy based on this indicator?

Buy after first blue dot and sell after first red dot.
aricanderson
 
Posts: 3
Joined: Sun Mar 11, 2012 2:18 pm

Re: Non lag Dot indicator

Postby Apprentice » Mon Mar 12, 2012 3:15 am

aricanderson:
Can you define the Entry, Exit conditions.
briansummy :
Your request is added to the development list.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 16949
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Non lag Dot indicator

Postby Alexander.Gettinger » Mon Mar 12, 2012 2:56 pm

briansummy wrote:I just realized, an MTF Nonlagdot would be amazing. Is this possible?


Use parameter "Period" for other TF:
Period.PNG
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 2707
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Non lag Dot indicator

Postby briansummy » Tue Mar 13, 2012 9:52 pm

Perfect! Thanks!
briansummy
 
Posts: 53
Joined: Wed Feb 08, 2012 8:11 pm

Re: Non lag Dot indicator

Postby briansummy » Sat Mar 17, 2012 4:50 pm

Can you do a strategy with NonLagDot in agreement with Parabolic SAR where the dot is the signal and SAR sets trend agreement?
briansummy
 
Posts: 53
Joined: Wed Feb 08, 2012 8:11 pm

Re: Non lag Dot indicator

Postby Apprentice » Mon Mar 19, 2012 1:05 am

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

Next

Return to Custom Indicators

Who is online

Users browsing this forum: Google [Bot] and 6 guests