커뮤니티
[STAD_02] CCI BollingerBand 문의 드립니다
2014-03-14 22:51:01
200
글번호 73511
Inputs: BBLen(130), BBStDv(3),CCILen(30), CCIAvgLn(2), CCIRange(100), barCount(5), mult(6), Div(36), period(3), stopper(1.2);
Vars: Position(0), TopBand(0), BotBand(0), BBStatus(0), CCIAvg(0);
Vars: CCITurnsUp(false), CCITurnsDown(false);
Vars: StopPrice(0), mp(0), LongCount(0), ShortCount(0), LEP(0), SEP(0);
TopBand = BollBandUp(BBLen, BBStDv);
BotBand = BollBandDown(BBLen, BBStDv);
CCIAvg = ema(CCI(CCILen), CCIAvgLn);
---------------------------------------------------------------------------------
If TopBand <> BotBand then
Position = (Close - BotBand) / (TopBand - BotBand);
If CurrentBar > 1 then Begin
If CrossUp(Position , 0.5) then
BBStatus = 0;
If CrossDown(Position , 0.5) then
BBStatus = 0;
------------------------------------------------------------------------------------
질문1 이부분이 왜 들어갔는지 이해가 안가서요 식상 불필요한내용 아닌가요?
If CrossDown(Low , BotBand) then
BBStatus = -1;
If CrossUp(High , TopBand) then
BBStatus = 1;
end;
CCITurnsUp = SwingLowBar(1, CCIAvg, 1,1, 3) == 1 AND CCIAvg[1] < -CCIRange;
CCITurnsDown = SwingHighbar(1, CCIAvg, 1,1, 3) == 1 AND CCIAvg[1] > CCIRange;
If BBStatus == -1 and CCITurnsUp then Begin
-----------------------------------------------------------------------
LongCount = CurrentBar;
------------------------------------------------------------------------
질문2 currentbar 보다 index가 맞는거 아닌가요? 왜 currentbar가 쓰였는지 궁금합니다
LEP = Highest(high,period);
end;
if CurrentBar < LongCount + barCount and MarketPosition <> 1 then
Buy("B", atstop, LEP );
If BBStatus == 1 and CCITurnsDown then begin
ShortCount = CurrentBar;
SEP = Lowest(low,period);
end;
if CurrentBar < ShortCount + barCount and MarketPosition <> -1 then
Sell("S", atstop,SEP ) ;
If MarketPosition == 1 then
LongCount = -999;
If MarketPosition == -1 then
shortCount = -999;
#청산
mp = marketposition;
if MP == 1 and MP[1] <> 1 then Begin
StopPrice = low - ma(range,40)*mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,40)*mult;
end;
If MP == 1 then begin
exitlong ("ExitLong", atstop,stopprice );
stopprice = stopprice +( low-stopprice )/Div;
end;
If MP == -1 then begin
exitshort ("Exitshort", atstop,stopprice);
stopprice = stopprice - (stopprice-high)/Div;
end;
setstoploss(stopper);
부탁드립니다
답변 1
예스스탁 예스스탁 답변
2014-03-17 12:33:48
안녕하세요
예스스탁입니다.
1.
Position 이 0.5를 상향돌파하거나 하향이탈하는 시점에서
다시 볼밴상단이나 하단돌파를 인지하기 위함입니다.
즉 Position이 0.5를 상향이나 하향하고 다음 볼밴이 상단이나 하단을
돌파하기 전가지는 조건을 충족시키지 않기 위함입니다.
2.
두개 모두 사용가능합니다.
조건만족봉의 봉번호를 저장는 부분이므로
index나 currentbar 중 작성자의 기호에 맞게 사용하시면 됩니다.
즐거운 하루되세요
> cinamon 님이 쓴 글입니다.
> 제목 : [STAD_02] CCI BollingerBand 문의 드립니다
> Inputs: BBLen(130), BBStDv(3),CCILen(30), CCIAvgLn(2), CCIRange(100), barCount(5), mult(6), Div(36), period(3), stopper(1.2);
Vars: Position(0), TopBand(0), BotBand(0), BBStatus(0), CCIAvg(0);
Vars: CCITurnsUp(false), CCITurnsDown(false);
Vars: StopPrice(0), mp(0), LongCount(0), ShortCount(0), LEP(0), SEP(0);
TopBand = BollBandUp(BBLen, BBStDv);
BotBand = BollBandDown(BBLen, BBStDv);
CCIAvg = ema(CCI(CCILen), CCIAvgLn);
---------------------------------------------------------------------------------
If TopBand <> BotBand then
Position = (Close - BotBand) / (TopBand - BotBand);
If CurrentBar > 1 then Begin
If CrossUp(Position , 0.5) then
BBStatus = 0;
If CrossDown(Position , 0.5) then
BBStatus = 0;
------------------------------------------------------------------------------------
질문1 이부분이 왜 들어갔는지 이해가 안가서요 식상 불필요한내용 아닌가요?
If CrossDown(Low , BotBand) then
BBStatus = -1;
If CrossUp(High , TopBand) then
BBStatus = 1;
end;
CCITurnsUp = SwingLowBar(1, CCIAvg, 1,1, 3) == 1 AND CCIAvg[1] < -CCIRange;
CCITurnsDown = SwingHighbar(1, CCIAvg, 1,1, 3) == 1 AND CCIAvg[1] > CCIRange;
If BBStatus == -1 and CCITurnsUp then Begin
-----------------------------------------------------------------------
LongCount = CurrentBar;
------------------------------------------------------------------------
질문2 currentbar 보다 index가 맞는거 아닌가요? 왜 currentbar가 쓰였는지 궁금합니다
LEP = Highest(high,period);
end;
if CurrentBar < LongCount + barCount and MarketPosition <> 1 then
Buy("B", atstop, LEP );
If BBStatus == 1 and CCITurnsDown then begin
ShortCount = CurrentBar;
SEP = Lowest(low,period);
end;
if CurrentBar < ShortCount + barCount and MarketPosition <> -1 then
Sell("S", atstop,SEP ) ;
If MarketPosition == 1 then
LongCount = -999;
If MarketPosition == -1 then
shortCount = -999;
#청산
mp = marketposition;
if MP == 1 and MP[1] <> 1 then Begin
StopPrice = low - ma(range,40)*mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,40)*mult;
end;
If MP == 1 then begin
exitlong ("ExitLong", atstop,stopprice );
stopprice = stopprice +( low-stopprice )/Div;
end;
If MP == -1 then begin
exitshort ("Exitshort", atstop,stopprice);
stopprice = stopprice - (stopprice-high)/Div;
end;
setstoploss(stopper);
부탁드립니다
다음글