Jump to content

req:need alert for this indicator... i-cai


Recommended Posts

There you go. Translation looks a bit iffy.

 

//+------------------------------------------------------------------+

//| The strength of the Corrected Average (CA) is to

//|that the current value of the time series of the current one

//|excess volatility dependent threshold must

//|this increases the filter and falls, making false signals

//|be avoided in trendschwachen phases.

//|-A.Uhl-

//+------------------------------------------------------------------+

//|Germany, 23.03.2007

#property copyright "A.Uhl, © RickD 2006, Alexander Piechotta"

#property link "http://onix-trade.net/forum/"

//----

#define major 1

#define minor 0

//----

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Gold

//----

extern int MA.Period=35;

extern int MA.method=MODE_SMA;

extern int MA.applied_price=PRICE_CLOSE;

//----

double MABuf[];

double CABuf[];

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void init()

{

IndicatorBuffers(2);

SetIndexStyle(2, DRAW_LINE, STYLE_SOLID,1);

SetIndexDrawBegin(0, MA.Period);

//

SetIndexBuffer(0, CABuf);

SetIndexBuffer(1, MABuf);

IndicatorShortName("Corrected Average (CA) ("+MA.Period+")");

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void deinit()

{}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void start()

{

int counted=IndicatorCounted();

if (counted < 0) return(-1);

if (counted > 0) counted--;

int limit=Bars-counted;

double v1, v2, k;

//----

for(int i=limit-1; i>=0; i--)

{

MABuf=iMA(NULL, 0, MA.Period, 0, MA.method, MA.applied_price, i);

if (i==Bars-1)

{

CABuf=MABuf;

continue;

}

v1=MathPow(iStdDev(NULL, 0, MA.Period, 0, MA.method, MA.applied_price, i), 2);

v2=MathPow(CABuf[i+1] - MABuf, 2);

//----

k=0;

if (v2 < v1 || v2==0) k=0; else k=1 - v1/v2;

 

CABuf=CABuf[i+1] + k*(MABuf-CABuf[i+1]);

}

if (Close[0] >= CABuf[0] && Close[1] <= CABuf[1]) Alert("Close crossed above signal line");

if (Close[0] <= CABuf[0] && Close[1] >= CABuf[1]) Alert("Close crossed below signal line");

 

}

//+------------------------------------------------------------------+

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...