답변완료
MACD오실레이터
Input : shortPeriod(12), longPeriod(26), Period(9);
Var : MACDv(0), MACDsig(0),macdosc(0) ;
MACDv = MACD(shortPeriod, longPeriod);
MACDsig = ema(MACDv,Period);
macdosc = MACDv-ema(MACDv,Period);
if macdosc > 0 then
{
plot1(macdosc, "MACDOscillator+");
Plot2(0, "MACDOscillator-");
}
else
{
Plot1(0, "MACDOscillator+");
Plot2(macdosc, "MACDOscillator-");
}
Plot3(MACDv, "MACD");
Plot4(MACDsig, "MACDSignal");
PlotBaseLine1(0, "기준선1");
MACD선이 MACD 시그널 을 상향돌파시 빨간색
MACD선이 MACD 시그널 을 하향돌파시 파란색
색깔이 나오도록 부탁드려요
답변완료
문의드립니다
1,문법에러라고 뜨는데 어떻게 수정해야할지모르겠습니다 수정부탁드립니다
그리고 설명부탁드립니다
Inputs:
N(14), MA_Period(20),
AstroBias(0.75), SpiritFlow(0.6),
Smooth(3), Eps(1e-6),
BuyThr(70), K(5); // 최근 K일 윈도우 (정수)
Vars:
Var_OBV(0), Var_MA(0), Var_RSI(0), AstroFlow(0), SpiritBoost(0),
Combo(0), ComboSm(0),
obvMin(0), obvMax(0), maSeries(0), maMin(0), maMax(0),
CrossNow(false), // ← 여기 담아서 뒤에 [d] 인덱싱
hit(false), d(0),not(0);
//{ --- 시계열 준비 --- }
maSeries = MA(Close, MA_Period);
obvMin = Lowest(OBV, N);
obvMax = Highest(OBV, N);
Var_OBV = 100 * (OBV - obvMin) / MaxList(Eps, obvMax - obvMin);
maMin = Lowest(maSeries, N);
maMax = Highest(maSeries, N);
Var_MA = 100 * (maSeries - maMin) / MaxList(Eps, maMax - maMin);
Var_RSI = RSI(N);
AstroFlow = (Var_RSI / 100) * AstroBias;
SpiritBoost = (Var_OBV / 100) * SpiritFlow;
Combo = (Var_OBV + Var_MA + Var_RSI) / 3 + AstroFlow + SpiritBoost;
ComboSm = MA(Combo, Smooth);
//{ --- 최근 K일 내 "최초" 상향 돌파 탐지 --- }
CrossNow = CrossUp(ComboSm, BuyThr); // 함수결과 → 변수로 보관
hit = false;
For d = 0 to K - 1 begin
// d번째 봉에서 상향돌파가 발생했고, (d+1)번째 봉(그 전 봉)에는 없었으면 "최초"
If CrossNow[d] and not CrossNow[d + 1] then bigin
hit = true;
end;
//{ --- 기본 필터 (예: 종가가 MA 위) --- }
If hit and (Close > maSeries) then
Find(1);
2.5일이평과20일이평이 크로스업 되었을때 텍스트로 주가를 나타내고싶습니다