true==function()
{
//SMA
//SMA
var CalculateSMA =function(period){
var len = period;
var sum = 0;
for (var j = 10;j < len+10 ;j++) {
sum= [ih][j].PDrCotVal + sum;
}
var average = sum / period;
return average ;
}
//pre9MA
//pre9MA
var pre9CalculateEMA =function(period){
var pre9EMA =( ([ih][9].PDrCotVal – CalculateSMA (period))*(2 / (period + 1))) + CalculateSMA (period);
return pre9EMA ;
}
//preEMA
//preEMA
var pre8CalculateEMA =function(period){
var pre8EMA =( ([ih][1].PDrCotVal – pre9CalculateEMA (period))*(2 / (period + 1))) + pre9CalculateEMA (period);
return pre8EMA ;
}
//preEMA
//preEMA
var pre7CalculateEMA =function(period){
var pre7EMA =( ([ih][1].PDrCotVal – pre8CalculateEMA (period))*(2 / (period + 1))) + pre8CalculateEMA (period);
return pre7EMA ;
}
//preEMA
//preEMA
var pre6CalculateEMA =function(period){
var pre6EMA =( ([ih][1].PDrCotVal – pre7CalculateEMA (period))*(2 / (period + 1))) + pre7CalculateEMA (period);
return pre6EMA ;
}
//preEMA
//preEMA
var pre5CalculateEMA =function(period){
var pre5EMA =( ([ih][1].PDrCotVal – pre6CalculateEMA (period))*(2 / (period + 1))) + pre6CalculateEMA (period);
return pre5EMA ;
}
//preEMA
//preEMA
var pre4CalculateEMA =function(period){
var pre4EMA =( ([ih][1].PDrCotVal – pre5CalculateEMA (period))*(2 / (period + 1))) + pre5CalculateEMA (period);
return pre4EMA ;
}
//preEMA
//preEMA
var pre3CalculateEMA =function(period){
var pre3EMA =( ([ih][1].PDrCotVal – pre4CalculateEMA (period))*(2 / (period + 1))) + pre4CalculateEMA (period);
return pre3EMA ;
}
//preEMA
//preEMA
var pre2CalculateEMA =function(period){
var pre2EMA =( ([ih][1].PDrCotVal – pre3CalculateEMA (period))*(2 / (period + 1))) + pre3CalculateEMA (period);
return pre2EMA ;
}
//preEMA
//preEMA
var pre1CalculateEMA =function(period){
var pre1EMA =( ([ih][1].PDrCotVal – pre2CalculateEMA (period))*(2 / (period + 1))) + pre2CalculateEMA (period);
return pre1EMA ;
}
//EMA
//EMA
var CalculateEMA =function(period){
var EMA =( ([ih][0].PDrCotVal – pre1CalculateEMA (period))*(2 / (period + 1))) + pre1CalculateEMA (period);
return EMA ;
}
var Macd=0
Macd= CalculateEMA (12) – CalculateEMA (26);
(cfield0) = Macd
////////////////////////////////RSI
var CalculateRSI =function(period){
var len=14;
for (var i = 0; i < len ; i++) {
var rec=[ih][len-1-i];
var change=rec.PClosing-rec.PriceYesterday;
if (change> 0) {
rec.gain=change;
rec.loss=0;
}
else
{
rec.gain=0;
rec.loss=-change;
}
}
// Calculate first “average gain” and “average loss”
var gainSum=0;
var lossSum=0;
for (var i = 0; i < period; i++) {
var rec=[ih][len-1-i];
gainSum += rec.gain;
lossSum += rec.loss;
}
var averageGain=gainSum /period;
var averageLoss=lossSum / period;
// Calculate subsequent “average gain” and “average loss” values
for (var i = period + 1; i < len; i++) {
var rec=[ih][len-1-i];
averageGain=(averageGain* (period – 1) + rec.gain) / period;
averageLoss=(averageLoss* (period – 1) + rec. loss)/ period;
rec.averageGain=averageGain;
rec.averageLoss=averageLoss;
}
// Calculate RSI
var RS = 0; // Relative strength
var RSIndex = 0; // Relative strength index
for (var i = period + 1; i < len; i++) {
var rec=[ih][len-1-i];
RS = rec.averageGain/ rec.averageLoss;
RSIndex = 100 – 100 / (1 + RS);
rec.rsi=RSIndex;
}
};
if(typeof [ih][0].rsi==”undefined”)
CalculateRSI(14);
(cfield1)= [ih][0].rsi;
var Rsi=0;
Rsi= [ih][0].rsi;
////////////////////////////VOL
var O=0;
O =((ct).Buy_I_Volume / (ct).Buy_CountI)/((ct).Sell_I_Volume / (ct).Sell_CountI);
(cfield2) = O;
var a=0;
a=Math.round((((pc)*(ct).Buy_I_Volume)/(ct).Buy_CountI)/10000000)
if(Macd>0&&Rsi>40&&(cfield2) >3&&a>20){
return true;
}
}()
این فیلتر خیلی خاصه و باید در تایم های پایانی بازار یعنی حدود ساعت 12 ظهر هم دوباره چک بشه و می تونه سود خوب بین 5 تا 30 درصد در یک بازه 4 روز تا دو هفته بهتون بده.