-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_cleaner.js
55 lines (53 loc) · 2.14 KB
/
data_cleaner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//https://github.com/farhad-mohammadi/Indicator-filters-for-tsetmc-site
//telegram : @farhad_m60
true==function()
{
//این برنامه برای تمیز کردن داده های سایت TSETMC برای استفاده
//در برنامه های اندیکاتوری برای دقت بیشتر طراحی شده است.
if ( [ih][0].PriceMax!= (pmax) || [ih][0].PDrCotVal != (pl) || [ih][0].QTotTran5J != (tvol) )
{
if ( typeof [ih][1].fixed == "undefined")
{
[ih].unshift(Object.assign({}, [ih][0]));
[ih][1].fixed=true;
}
[ih][0].PriceFirst=(pf);
[ih][0].PClosing=(pc);
[ih][0].PDrCotVal=(pl);
[ih][0].ZTotTran=(tno);
[ih][0].QTotTran5J=(tvol);
[ih][0].QTotCap=(tval);
[ih][0].PriceChange=(pcc);
[ih][0].PriceMin=(pmin);
[ih][0].PriceMax=(pmax);
[ih][0].PriceYesterday=(py);
}
function clear(data)
{
if ( data.PriceMax!=0 || data.PriceMin!=0) return data;
}
if ( typeof [ih][1].history=="undefined")
{
[ih]=[ih].filter(clear);
[ih][1].history=true;
}// از اینجا به بعد داده های [ih] بروز و تمیز هستند
// تابع زیر برای تشخیص افزایش سرمایه در طول دوره ای که ورودی میگیرد
//برای نماد هایی که در دوره ی period تغییرات بیشتر از 15 درصدی دارند false و درغیر اینصورت true بر میگردانَد
function capital_increase(period)
{
let len = [ih].length;
if ( period>len) return false;
let change_percent=0;
for (let i=0; i<period; i++)
{
change_percent= ([ih][i].PriceYesterday - [ih][i].PDrCotVal)/[ih][i].PriceYesterday;
change_percent= Math.abs( 100 * change_percent);
if ( change_percent > 15)
{
return false;
}
}
return true;
}
//بعد از این خط تابع های اندیکاتوری خود را کپی کرده و با داده تمیز از آنها استفاده کنید
}()