Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
gen_SATL
//------------------------------------------------------------------
// gen_SATL
// Dmitry Yakovlev
// dmitry_yakovlev@rambler.ru
// WebMoney R865705290089
//------------------------------------------------------------------
// DF Parameters:
// SATL: P1=52, D1=32, A1=40, P2=41, D2=31, A2=10, Ripple=0.0864, Delay=0
#property copyright "Dmitry Yakovlev, Russia,Omsk WM R865705290089"
#property link "dmitry_yakovlev@rambler.ru"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Black
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_width1 0
#property indicator_width2 2
#property indicator_width3 2
#import "shell32.dll" //Connect a dll (provided with Windows)
int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import "user32.dll"
int MessageBoxA(int hWnd ,string lpText,string lpCaption,int uType);
//------------------------------------------------------------------------------------------------------
// ÏÀÐÀÌÅÒÐÛ
extern string _tf="Òàéìôðåéì (0-òåêóùèé)";
extern int tf=0;
extern string _pr="Öåíà 0-cl,1-op,2-hi,3-lo";
extern int pr=0;
extern string _donate1="Äëÿ $ áëàãîäàðíîñòè:";
extern string _donate2="R865705290089";
//---- buffers
double iBuffer[];
double up[];
double dn[];
double trend[];
double F[]=
{
0.0972300859804,+0.0968062969346,+0.0955419164365,+0.0934577611122,+0.0905880510165,+0.0869797096772,+0.0826914069223,
+0.0777923665825,+0.0723609665321,+0.0664831632194,+0.0602507767255,+0.0537596753828,+0.0471079009917,+0.0403937766681,
+0.0337140392862,+0.02716203738993,+0.02082603334880,+0.01478764551201,+0.00912046226174,+0.00388885529508,-0.000852985685581,
-0.00506178027993,-0.00870563597026,-0.01176427325104,-0.01422899856638,-0.01610243213838,-0.01739800330289,-0.01813923109192,
-0.01835881240394,-0.01809754409022,-0.01740310857099,-0.01632875511194,-0.01493191058141,-0.01327275433432,
-0.01141279180993,-0.00941346048840,-0.00733480005313,-0.00523421600395,-0.00316536264050,-0.001177167392015,
+0.000686985962009,+0.002389902406856,+0.00390104132106,+0.00519679976189,+0.00626061537269,+0.00708289540657,
+0.00766078247257,+0.00799777120465,+0.00810319306032,+0.00799158883572,+0.00768199022585,+0.00719713287712,
+0.00656262390426,+0.00580608681889,+0.00495630628786,+0.00404239415109,+0.003092996720318,+0.002135561583368,
+0.001195679980891,+0.0002965183278544,-0.000541650350472,-0.001301807370162,-0.001970437316184,-0.002537663958766,
-0.002997275636143,-0.00334664596644,-0.00358655892238,-0.00372095011838,-0.00375657848736,-0.00370264425443,
-0.00357037017995,-0.00337256344445,-0.003123175378339,-0.002836875741331,-0.002528657914549,-0.002213492109737,
-0.001906047326282,-0.001620512609322,-0.001370567038003,-0.001169534616626,-0.001029918389440,-0.000935870061783,+0.01034202700017
};
int FilterSize=0;
//+------------------------------------------------------------------+
//| Digital filter indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
CheckDonate();
FilterSize=ArraySize(F);
if(tf<Period()) tf=Period();
//---- indicator line
IndicatorShortName("SATL-"+tf);
IndicatorBuffers(4);
//---- indicator line
SetIndexStyle(0,DRAW_NONE);
SetIndexBuffer(0,iBuffer);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(1,up);
SetIndexLabel(1,"Up");
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(2,dn);
SetIndexLabel(2,"Dn");
SetIndexStyle(3,DRAW_NONE);
SetIndexBuffer(3,trend);
SetIndexLabel(3,"trend");
ArraySetAsSeries(iBuffer, true);
ArraySetAsSeries(trend, true);
//----
return(0);
}
//+------------------------------------------------------------------+
double price(int i)
{
if(pr==0) return(iClose(Symbol(),tf,i));
else if(pr==1) return(iOpen(Symbol(),tf,i));
else if(pr==2) return(iHigh(Symbol(),tf,i));
else if(pr==3) return(iLow(Symbol(),tf,i));
}
//+------------------------------------------------------------------+
int start()
{
int k, nn, nn1, i, j, counted_bars=IndicatorCounted();
int koef=(tf/Period());
double res=0, step=0;
// <--- ðàñ÷èòûâàåì çíà÷åíèÿ èíäèêàòîðà
if (FilterSize>0)
{
if(Bars<=FilterSize) return(0);
//-------------------------------
i=(Bars+FilterSize-counted_bars)/koef+1;
//-------------------------------
while(i>=0)
{
res=0;
for (j=0; j<FilterSize; j++) res+=F[j]*price(i+j);
nn=i*koef;
iBuffer[nn]=res;
nn1=(i+1)*koef;
if(iBuffer[nn1]!=EMPTY_VALUE && iBuffer[nn1]!=0)
{
step=(iBuffer[nn1]-iBuffer[nn])/koef;
for(k=1;k<koef;k++) iBuffer[k+nn]=iBuffer[nn]+step*k;
}
i--;
}
} else return;
// ðàñ÷èòûâàåì -->
//-------------------------------------------------------------------------
// <-- ðàñêðàøèâàåì
for(int x=Bars;x>=0;x--)
{
trend[x] = trend[x+1];
if (iBuffer[x]> iBuffer[x+1]) trend[x] =1;
if (iBuffer[x]< iBuffer[x+1]) trend[x] =-1;
if (trend[x]>0)
{ up[x] = iBuffer[x];
if (trend[x+1]<0) up[x+1]=iBuffer[x+1];
dn[x] = EMPTY_VALUE;
}
else
if (trend[x]<0)
{
dn[x] = iBuffer[x];
if (trend[x+1]>0) dn[x+1]=iBuffer[x+1];
up[x] = EMPTY_VALUE;
}
}
// ðàñêðàøèâàåì -->
//-------------------------------------------------------------------------
return(0);
}
void CheckDonate()
{
int fd=0; string pay="0"; datetime dt=0;
string fn="DigFlts1.txt";
fd=FileOpen(fn,FILE_READ|FILE_CSV,";");
if(fd>=1)
{
pay=FileReadString(fd); if(pay!="0" && pay!="1") pay="0";
dt=StrToTime(FileReadString(fd));
}
else
{
dt=TimeCurrent();
fd=FileOpen(fn,FILE_WRITE|FILE_CSV,";");
FileWrite(fd,"0",TimeToStr(dt,TIME_DATE));
}
FileClose(fd);
if(pay=="0" && (TimeCurrent()-dt)>10*24*60*60) // 5 äíåé
{
if(MessageBoxA(0,"Åñëè Âàì ïîíðàâèëñÿ èíäèêàòîð SATL,\n õîòèòå ïîìî÷ü àâòîðó ìàòåðèàëüíî?","Âîïðîñ",4)==6)
{
ShellExecuteA(0,"Open","iexplore.exe","wmk:payto?Purse=R865705290089&Amount=100&Desc=DigitalIndicators&BringToFront=Y&ExecEvenKeeperIsOffline=Y","",7);
pay="1";
}
dt=TimeCurrent();
fd=FileOpen(fn,FILE_WRITE|FILE_CSV,";");
FileWrite(fd,pay,TimeToStr(dt,TIME_DATE));
FileClose(fd);
}
FileClose(fd);
}
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
---