Linsupertrend and PSA (Price Speed Acceleration)
I would like to know MS Excel formula for below mentioned indicators:
Linsupertrend
Factor=param("Factor",3,1,3,1);
Pd=Param("ATR Periods",10,1,100,1);
Up = LinearReg((H+L)*0.5,Pd) + Factor*ATR(Pd);
Dn = LinearReg((H+L)*0.5,Pd) - Factor*ATR(Pd);
iATR=ATR(Pd);
PSA (Price Speed Acceleration)
//---- indicator buffers
extern int period = 240;
extern bool show_speed = TRUE;
int limit;
double speed[];
double acceleration[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);
//---- drawing settings
if (show_speed == TRUE){
SetIndexStyle(0,DRAW_HISTOGRAM);
}else{
SetIndexStyle(0,DRAW_NONE);
}
SetIndexBuffer(0,speed);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,acceleration);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i;
//----
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i=0; i<limit; i++) {
speed
= iClose(Symbol(),0,i)-iClose(Symbol(),0,i+period);
}
for(i=0; i<limit; i++) {
acceleration = speed-speed[i+period];
}
//----
return(0);