1.
SuperTrend를 상향돌파하는 종목검색
Input : period(10),multiplier(3);
Var : src(0), alpha(0),ATRV(0),upperBand(0),lowerBand(0),direction(0),SuperTrend(C);
src = (H+L)/2;
if CurrentBar > 1 Then
{
alpha = 1 / period ;
ATRV = IFf(IsNan(ATRV[1]) == true, ma(TrueRange,period) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATRV[1])==true,0,ATRV[1]));
upperBand = src + multiplier * ATRV;
lowerBand = src - multiplier * ATRV;
if lowerBand > lowerBand[1] or close[1] < lowerBand[1] Then
lowerBand = lowerBand;
Else
lowerBand = lowerBand[1];
if upperBand < upperBand[1] or close[1] > upperBand[1] Then
upperBand = upperBand;
Else
upperBand = upperBand[1];
if C > UpperBand Then
direction = 1;
if C < LowerBand Then
direction = -1;
if direction == 1 Then
SuperTrend = lowerband;
Else
SuperTrend = upperband;
if CrossUp(C,SuperTrend) Then
Find(1);
}
JavaScript
복사
2.
Supertrend를 돌파하는 봉의 종가를 저장하고
이후 다시 해당 종가를 상향돌파하는 종목을 검색
Input : period(10),multiplier(3);
Var : src(0), alpha(0),ATRV(0),upperBand(0),lowerBand(0),direction(0),SuperTrend(C);
var : value(0);
src = (H+L)/2;
if CurrentBar > 1 Then
{
alpha = 1 / period ;
ATRV = IFf(IsNan(ATRV[1]) == true, ma(TrueRange,period) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATRV[1])==true,0,ATRV[1]));
upperBand = src + multiplier * ATRV;
lowerBand = src - multiplier * ATRV;
if lowerBand > lowerBand[1] or close[1] < lowerBand[1] Then
lowerBand = lowerBand;
Else
lowerBand = lowerBand[1];
if upperBand < upperBand[1] or close[1] > upperBand[1] Then
upperBand = upperBand;
Else
upperBand = upperBand[1];
if C > UpperBand Then
direction = 1;
if C < LowerBand Then
direction = -1;
if direction == 1 Then
SuperTrend = lowerband;
Else
SuperTrend = upperband;
if CrossUp(C,SuperTrend) Then
value = C;
if value > 0 and CrossUp(C,value) Then
Find(1);
}
JavaScript
복사