Nonlagdot is an indicator, which gives an interpretation of market trends. Notation of trends is conducted in accordance with dominant market forces.
If the bulls (buyers) are dominant, it will be marked with green dots on a chart. In the case of dominance of the bears (sellers) on the schedule this will be indicated by red dots. Please remind of changing the way the returned values are set on chart (set them to points, not lines) and change the color accordingly to the trend direction.
(description found on internet). Converted from Metatrader4 version by request on forums.
//PRC_NonLagDot | indicator
//23.12.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//Converted from MT4 version
// --- parameters
Price = customclose
//Length = 10
//Filter = 0
//Deviation = 0
// ---
cCycle= 4
if barindex>Length then
pi=3.1415926535
Coeff= 3*pi
Phase=Length-1
Len=Length*cCycle + Phase
Weight=0
Sum=0
t=0
for i =0 to Len-1 do
g=1.0/(Coeff*t+1)
if (t<=0.5) then
g=1
endif
beta=Cos(pi*t)
alfa=g * beta
pprice = price[i]//average[1](price)[i]
Sum=Sum+(alfa*pprice)
Weight=Weight+alfa
if(t < 1) then
t=t+(1.0/(Phase-1))
elsif (t < Len-1)then
t=t+((2*cCycle-1)/(cCycle*Length-1))
endif
next
if (Weight > 0) then
MABuffer=(1.0+Deviation/100)*Sum/Weight
endif
if (Filter>0) then
if(Abs(MABuffer-MABuffer[1]) < Filter*Pointsize) then
MABuffer=MABuffer[1]
endif
endif
endif
return MABuffer