커뮤니티
[STAD_05] Fibonacci
2014-03-29 01:30:00
155
글번호 73946
Inputs: XAvgLen(15), HiLoLen(50), Retrace(0.382), SetUpLen(24);
Vars: XAvg(0), HiHi(0), HiHiBar(0), LoLo(0), LoLoBar(0), Retracement(0), BuySetup(0), SellSetup(0);
//Calculation of the necessary values, and assignment to variables
XAvg = ema(Close, XAvgLen);
HiHi = Highest(High, HiLoLen);
LoLo = Lowest(Low, HiLoLen);
HiHiBar = nthHighestbar(1,High, HiLoLen);
LoLoBar = nthLowestBar(1,Low, HiLoLen);
Retracement = (HiHi - LoLo) * Retrace;
//Conditions for a Buy Setup
IF Close <= HiHi - Retracement AND HiHiBar < LoLoBar Then
BuySetup = 0;
//Conditions for a Sell Setup
IF Close >= LoLo + Retracement AND HiHiBar > LoLoBar Then
SellSetup = 0;
//Accumulates to count the number of bars in the setups
BuySetup = BuySetup + 1;
SellSetup = SellSetup + 1;
//Buy Criteria Evaluation
IF BuySetup <= SetUpLen Then Begin
IF SwingLow(1, XAvg, 1,1, 3) <> -1 OR Close > XAvg Then Begin
Buy();
---------------------------------------------------
BuySetup = SetUpLen;
---------------------------------------------------
이부분이 왜들어갔는지 이해할수 없어서 질문드립니다
부탁드립니다
End;
End;
//Sell Criteria Evaluation
IF SellSetup <= SetUpLen Then Begin
IF SwingHigh(1, XAvg, 1,1, 3) <> -1 OR Close < XAvg Then Begin
Sell();
SellSetup = SetUpLen;
End;
End;
답변 1
예스스탁 예스스탁 답변
2014-03-31 10:24:05
안녕하세요
예스스탁입니다.
//{Conditions for a Buy Setup}
IF Close <= HiHi - Retracement AND HiHiBar < LoLoBar Then BuySetup = 0;
//{Conditions for a Sell Setup}
IF Close >= LoLo + Retracement AND HiHiBar > LoLoBar Then SellSetup = 0;
//{Accumulates to count the number of bars in the setups}
BuySetup = BuySetup + 1;
SellSetup = SellSetup + 1;
BuySetup이나 SellSetup은 위 조건 만족하면 1씩 증가를 하고
매수와 매도신호는 위 조건 만족한 이후 24개봉(BuySetup <= SetUpLen) 안에 발생해야 합니다.
24개봉 안에 조건만족해서 매수나 매도신호가 발생하면
BuySetup이나 SellSetup을 24로 만들어 더이상 진입하지 못하게 하기 위함입니다.
즐거운 하루되세요
> cinamon 님이 쓴 글입니다.
> 제목 : [STAD_05] Fibonacci
> Inputs: XAvgLen(15), HiLoLen(50), Retrace(0.382), SetUpLen(24);
Vars: XAvg(0), HiHi(0), HiHiBar(0), LoLo(0), LoLoBar(0), Retracement(0), BuySetup(0), SellSetup(0);
//Calculation of the necessary values, and assignment to variables
XAvg = ema(Close, XAvgLen);
HiHi = Highest(High, HiLoLen);
LoLo = Lowest(Low, HiLoLen);
HiHiBar = nthHighestbar(1,High, HiLoLen);
LoLoBar = nthLowestBar(1,Low, HiLoLen);
Retracement = (HiHi - LoLo) * Retrace;
//Conditions for a Buy Setup
IF Close <= HiHi - Retracement AND HiHiBar < LoLoBar Then
BuySetup = 0;
//Conditions for a Sell Setup
IF Close >= LoLo + Retracement AND HiHiBar > LoLoBar Then
SellSetup = 0;
//Accumulates to count the number of bars in the setups
BuySetup = BuySetup + 1;
SellSetup = SellSetup + 1;
//Buy Criteria Evaluation
IF BuySetup <= SetUpLen Then Begin
IF SwingLow(1, XAvg, 1,1, 3) <> -1 OR Close > XAvg Then Begin
Buy();
---------------------------------------------------
BuySetup = SetUpLen;
---------------------------------------------------
이부분이 왜들어갔는지 이해할수 없어서 질문드립니다
부탁드립니다
End;
End;
//Sell Criteria Evaluation
IF SellSetup <= SetUpLen Then Begin
IF SwingHigh(1, XAvg, 1,1, 3) <> -1 OR Close < XAvg Then Begin
Sell();
SellSetup = SetUpLen;
End;
End;