라이브러리
[PHP] trader_cdleveningstar - 이브닝 스타
Trader CDLEveningStar: PHP Implementation
Trader CDLEveningStar은 Technical Analysis에서 사용하는 패턴 중 하나입니다. 이 패턴은 Evening Star 패턴을 의미하며, 상승장에서 반전을 예상할 때 사용됩니다.
패턴 설명
Trader CDLEveningStar 패턴은 3개의 candlestick으로 구성됩니다.
1. Large White Candle: 첫 번째 candlestick은 상승장의 시작을 나타내며, 큰 흰색 캔들입니다.
2. Small Black Candle: 두 번째 candlestick은 첫 번째 캔들의 반전을 나타내며, 작은 검은색 캔들입니다.
3. Large White Candle: 세 번째 candlestick은 두 번째 캔들의 반전을 나타내며, 큰 흰색 캔들입니다.
PHP Implementation
PHP에서 Trader CDLEveningStar 패턴을 구현하는 방법은 다음과 같습니다.
#hostingforum.kr
php
class TraderCDLEveningStar {
private $candles;
public function __construct($candles) {
$this->candles = $candles;
}
public function isEveningStar() {
// 첫 번째 캔들의 길이
$firstCandleLength = $this->candles[0]->getLength();
// 두 번째 캔들의 길이
$secondCandleLength = $this->candles[1]->getLength();
// 세 번째 캔들의 길이
$thirdCandleLength = $this->candles[2]->getLength();
// 첫 번째 캔들이 두 번째 캔들의 반전을 나타내는지 확인
if ($this->candles[0]->getColor() == 'white' && $this->candles[1]->getColor() == 'black') {
// 두 번째 캔들이 세 번째 캔들의 반전을 나타내는지 확인
if ($this->candles[1]->getColor() == 'black' && $this->candles[2]->getColor() == 'white') {
// 첫 번째 캔들의 길이와 세 번째 캔들의 길이의 비율이 2:1 이상인지 확인
if ($firstCandleLength >= 2 * $thirdCandleLength) {
return true;
}
}
}
return false;
}
}
class Candle {
private $color;
private $length;
public function __construct($color, $length) {
$this->color = $color;
$this->length = $length;
}
public function getColor() {
return $this->color;
}
public function getLength() {
return $this->length;
}
}
// 예제
$candles = array(
new Candle('white', 50),
new Candle('black', 10),
new Candle('white', 70)
);
$eveningStar = new TraderCDLEveningStar($candles);
if ($eveningStar->isEveningStar()) {
echo "Trader CDLEveningStar 패턴이 발견되었습니다.";
} else {
echo "Trader CDLEveningStar 패턴이 발견되지 않았습니다.";
}
예제 결과
Trader CDLEveningStar 패턴이 발견되었습니다.
참고
Trader CDLEveningStar 패턴은 Technical Analysis에서 사용하는 패턴 중 하나입니다. 이 패턴은 상승장에서 반전을 예상할 때 사용됩니다. PHP에서 Trader CDLEveningStar 패턴을 구현하는 방법은 위의 예제와 같이 candlestick 객체를 생성하고, isEveningStar() 메서드를 호출하여 패턴을 확인할 수 있습니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.