Q&A 게시판 HOME > Q&A 게시판
작성자 : 풀잎향기 작성일 : 2021-07-10 10:33:35 조회수 : 358
HitTheBullsEye_Line 지표식 적용이 안되는 이유 문의
챠트쉐어 에 있는 코멘트의 아래 지표식을 그데로 복사해서 지표식에 추가 및 오류 검사를 하면 에러부분이 많이 나오고 있습니다.
그 이유를 몰라서 오류나오는 부분을 나름데로 수정해 봐도 제데로 되질 않아서 문의 드립니다.
챠트쉐어에 나오는 것처럼 매수구간, 매도구간, 청산구간, 목표가 등의 색상별 라인을 
HitTheBullsEye의 시스템 식에 같이 나오게 하고 싶습니다.
부탁드립니다.


#[지표식] HitTheBullsEye_Line

Inputs: RangeLength(5), XAvgLength(50), BarstoEnter(5), Factor(3);
Variables: BuyEntry(0), BuySetup(False), BuyCounter(0), LongExitTarget(0);
Variables: SellEntry(0), SellSetup(False), SellCounter(0), ShortExitTarget(0);

Condition1 = High == Highest(High, RangeLength);
Condition2 = Close > High[2];
Condition3 = ema(Close, XAvgLength) > ema(Close, XAvgLength)[1];
Condition4 = Low == Lowest(Low, RangeLength);
Condition5 = Close < Low[2];
Condition6 = ema(Close, XAvgLength) < ema(Close, XAvgLength)[1]; 

If i_MarketPosition <> 1 AND Condition1 AND Condition2 AND Condition3 Then Begin
        BuyEntry = MedianPrice()[2];
        BuyCounter = 0;
        BuySetup = True;
        LongExitTarget = High + Factor * (High - BuyEntry);
End;

If BuyCounter > BarstoEnter Then
        BuySetup = False;
Else
        BuyCounter = BuyCounter + 1;

If i_MarketPosition == 1 Then Begin
        BuySetup = False;
        //ExitLong("EL1", atLimit, LongExitTarget );
End;

/*If BuySetup Then
        Buy("B1", atlimit,  BuyEntry );*/
        
If Condition4 AND Condition5 AND Condition6 Then Begin
        SellEntry = MedianPrice()[2];
        SellCounter = 0;
        SellSetup = True;
        ShortExitTarget = Low - Factor * (SellEntry - Low);
End;

If SellCounter > BarstoEnter Then
        SellSetup = False;
Else
        SellCounter = SellCounter + 1;

if buysetup[1] == true then
 plot1(BuyEntry[1], "매수라인");
if i_marketposition[1] == 1 then
 plot2(LongExitTarget[1], "매수목표가");
if sellsetup[1] == true and i_marketposition[1] == 1  then
 plot3(sellentry[1], "매도라인");

# ATR Protective Stop
Inputs: ProtectiveATRs(3);
var : AtrV(0);

AtrV = ATR(30);
If i_MarketPosition ==1 Then 
 plot4(i_AvgEntryPrice - AtrV*ProtectiveATRs, "ATR청산"); 


#[지표식] HitTheBullsEye_추세조건

Inputs: RangeLength(5), XAvgLength(50), BarstoEnter(5), Factor(3);

Condition1 = High == Highest(High, RangeLength);
Condition2 = Close > High[2];
Condition3 = ema(Close, XAvgLength) > ema(Close, XAvgLength)[1];
Condition4 = Low == Lowest(Low, RangeLength);
Condition5 = Close < Low[2];
Condition6 = ema(Close, XAvgLength) < ema(Close, XAvgLength)[1]; 

If Condition1 AND Condition2 AND Condition3 Then {
 var1 = 1;
 plot1(1, "추세판별" , red);
}
else
 var1 = 0;
     
If Condition4 AND Condition5 AND Condition6 Then {
 var2 = -1;
 plot1(-1, "추세판별", blue);
}
else
 var2 = 0;

if accumN(var1[1], 6) > 0 then
 plot2(0.5, "매수구간");

if accumN(var2[1], 6) < 0 then
 plot3(-0.5, "매도구간");

plotbaseline1(0, "기준선0");


#[지표식] 지수이동평균50

Input : Period1(50);

var1 = ema(C,Period1);

if var1 > var1[1] then
 Plot1(var1, "지수이동평균50", red);
else
 Plot1(var1, "지수이동평균50", blue);


목록 답변