Miscellaneous
0
Views
0
Downloads
0
Favorites
ang____ãÆ_____┬Á
#property copyright "ANG3110@latchess.com"
//----------------------------------------
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//-------------------------------
#import "af_T3.ex4"
int af_T3( int i,int pt3, double ct3);
//-------------------------------
extern int hrf = 2;
extern int hrT3 = 6;
extern int days = 1;
//-----------------------------------------
double ak[],bk[],fx[],w,ak0,ss,sc,sk,dfx[];
double pi=3.1415926535897932384626433832795;
int T,sm,k;
double t3[],ct3,dc[];
int pt3;
//==========================================
int init() {
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,fx);
SetIndexBuffer(1,t3);
SetIndexBuffer(2,ak);
SetIndexBuffer(3,bk);
SetIndexBuffer(4,dc);
//--------------------------
pt3=hrT3*60/Period();
T=days*1440/Period();
w=2*pi/T;
k=T/(hrf*60/Period());
return(0); }
//***************************************************
int start() {
//-----------------
int n,i,cbi;
//------------------
cbi=Bars-IndicatorCounted()-2;
for(i=cbi; i>=0; i--) {
//---------------------
ct3=Close[i];
t3[i]=af_T3(i,pt3,ct3);
dc[i]=Close[i]-t3[i];
}
//--------------------------
ak0=0.0;
for (n=0; n<=k; n++) { sc=0.0; ss=0.0;
for (i=0; i<=T-1; i++) {
if (n==0) ak0+=dc[i];
if (n!=0) {sc=sc+dc[i]*MathCos(n*i*w); ss=ss+dc[i]*MathSin(n*i*w);} }
ak[n]=sc*2/T; bk[n]=ss*2/T; }
ak0=ak0/T;
//--------------------------
for (i=0; i<=T-1; i++) { sk=0.0;
for (n=1; n<=k; n++) {
sk=sk+ak[n]*MathCos(n*i*w)+bk[n]*MathSin(n*i*w);}
fx[i]=ak0+sk+t3[i];
}
//---------------------------
return(0); }
//****************************************************
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---