res = 0
i = 0
mm20 = Average[20](close)
tenkan = (Highest[9](High) + Lowest[9](Low)) / 2
kijun = (Highest[26](High) + Lowest[26](Low)) / 2
ssA = (tenkan[26] + kijun[26]) / 2
ssB = (Highest[52](High[26]) + Lowest[52](Low[26])) / 2
kumoUp = Max(ssA,ssB)
//kumoDown = Min(ssA,ssB)
HAclose = (Open + Close + High + Low) / 4
HAopen = (HAopen + HAclose) / 2
IF Close > kumoUp AND (Close < mm20 OR Close < kijun OR Close < tenkan) THEN
KO = 0
strike = 0
strikeExpectedMax = 1
WHILE (i <= strikeExpectedMax + 1 AND KO = 0) DO
IF (HAclose[i] > HAopen[i]) THEN
strike = strike + 1
ELSE
KO = 1
ENDIF
IF strike = strikeExpectedMax + 1 THEN
strike = 10
ENDIF
i = i + 1
WEND
respiration = 0
respirationExpectedMin = 3
respirationExpectedMax = 5
j = 0
KO = 0
WHILE (j <= respirationExpectedMax AND strike < 10 AND KO = 0) DO
IF (HAclose[strike + j] < HAopen[strike + j]) THEN
respiration = respiration + 1
ELSE
KO = 1
ENDIF
j = j + 1
WEND
IF respiration >= respirationExpectedMin AND respiration < respirationExpectedMax THEN
res = 1
ENDIF
ENDIF
Return res AS "Warning" // , strike AS "Strike", respiration AS "Respiration"