커뮤니티
오류메세지 수정 부탁드립니다.
2017-03-15 11:53:10
161
글번호 107813
감사합니다.
//==========================================
// Indicator Name : FibonacciRetracement
// Written by : yahoosir
// Blog : http://yahoosir.blog.me
//==========================================
Input:length(10),ClsPxUseBit(0),inRange(10),waveLineSize(2),displPRC(1);
Var:j(0),jj(0),jjj(0),HH(0),LL(0),lastHi(0),lastLo(0),lastVertex(""),procBit(""),
TL1(0),TL2(0);
Array:PK[50,4](0),VL[50,4](0), // 1:Price, 2:BarNumber, 3:Date, 4:Time
basePK[5](0),baseVL[5](0); // 0:N/A, 1:Price, 2:BarNumber, 3:Date, 4:Time
//==========================================
HH = IFF(ClsPxUseBit == 1,C,H);
LL = IFF(ClsPxUseBit == 1,C,L);
If CurrentBar == 1 Then Begin
PK[1,1] = HH;
VL[1,1] = LL;
End ;
Condition1 = Highest(HH,length) = HH and lastHi <> HH;
Condition2 = Lowest (LL,length) = LL and lastLo <> LL;
procBit = "";
If Condition1 and Condition2 Then Begin
If lastVertex == "Valley" Then procBit = "Peak" ;
Else procBit = "Valley";
End
Else If Condition1 Then procBit = "Peak" ;
Else If Condition2 Then procBit = "Valley";
//==========================================
If procBit == "Peak" Then Begin
lastHi = HH;
If lastVertex == "Valley" Then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
PK[j,jj] = PK[j-1,jj];
End ;
End ;
PK[1,1] = HH;
PK[1,2] = BarNumber;
PK[1,3] = Date;
PK[1,4] = Time;
TL1 = TL_New(VL[1,3],VL[1,4],VL[1,1],PK[1,3],PK[1,4],PK[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,RED);
basePK[1] = 0;
For j = 1 To inRange Begin
If basePK[1] < PK[j,1] Then Begin
For jjj = 1 To 4 Begin
basePK[jjj] = PK[j,jjj];
End ;
End ;
End ;
End
Else If PK[1,1] < HH Then Begin
PK[1,1] = HH;
PK[1,2] = BarNumber;
PK[1,3] = Date;
PK[1,4] = Time;
TL_SetEnd(TL1,PK[1,3],PK[1,4],PK[1,1]);
End ;
lastVertex = "Peak";
End ;
//==========================================
If procBit == "Valley" Then Begin
lastLo = LL;
If lastVertex == "Peak" then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
VL[j,jj] = VL[j-1,jj];
End ;
End ;
VL[1,1] = LL;
VL[1,2] = BarNumber;
VL[1,3] = Date;
VL[1,4] = Time;
TL1 = TL_New(PK[1,3],PK[1,4],PK[1,1],VL[1,3],VL[1,4],VL[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,BLUE);
baseVL[1] = 0;
For j = 1 To inRange Begin
If baseVL[1] > VL[j,1] or baseVL[1] = 0 Then Begin
For jjj = 1 To 4 Begin
baseVL[jjj] = VL[j,jjj];
End ;
End ;
End ;
End
Else If VL[1,1] > LL then Begin
VL[1,1] = LL;
VL[1,2] = BarNumber;
VL[1,3] = Date;
VL[1,4] = Time;
TL_SetEnd(TL1,VL[1,3],VL[1,4],VL[1,1]);
End ;
lastVertex = "Valley";
End ;
//==========================================
Array: fr[7,4](0); // 1:Rate, 2:Price, 3:Trendline ID, 4:Text ID
If CurrentBar == 1 Then Begin
fr[1,1] = 0;
fr[2,1] = 0.236;
fr[3,1] = 0.382;
fr[4,1] = 0.50;
fr[5,1] = 0.618;
fr[6,1] = 0.764;
fr[7,1] = 1;
End ;
If basePK[1] > 0 and baseVL[1] > 0 Then Begin
If baseVL[2][1] <> baseVL[2] or basePK[2][1] <> basePK[2] Then Begin
If TL2 > 0 Then TL_Delete(TL2);
TL2 = TL_New(baseVL[3],baseVL[4],baseVL[1],basePK[3],basePK[4],basePK[1]);
TL_SetSize(TL2,4);
TL_SetColor(TL2,Magenta);
If baseVL[2] < basePK[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = basePK[1] - ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(baseVL[3],baseVL[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(baseVL[3],baseVL[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End
Else If basePK[2] < baseVL[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = baseVL[1] + ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(basePK[3],basePK[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(basePK[3],basePK[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End ;
End
Else Begin
for j = 1 to 7 Begin
TL_SetEnd(fr[j,3],Date,Time,fr[j,2]);
End ;
End ;
End ;
답변 1
예스스탁 예스스탁 답변
2017-03-15 13:40:35
안녕하세요
예스스탁입니다.
//==========================================
// Indicator Name : FibonacciRetracement
// Written by : yahoosir
// Blog : http://yahoosir.blog.me
//==========================================
Input:length(10),ClsPxUseBit(0),inRange(10),waveLineSize(2),displPRC(1);
Var:j(0),jj(0),jjj(0),HH(0),LL(0),lastHi(0),lastLo(0),lastVertex(""),procBit(""),
TL1(0),TL2(0);
Array:PK[50,4](0),VL[50,4](0), // 1:Price, 2:BarNumber, 3:Date, 4:Time
basePK[5](0),baseVL[5](0); // 0:N/A, 1:Price, 2:BarNumber, 3:Date, 4:Time
//==========================================
HH = IFF(ClsPxUseBit == 1,C,H);
LL = IFF(ClsPxUseBit == 1,C,L);
If CurrentBar == 1 Then Begin
PK[1,1] = HH;
VL[1,1] = LL;
End ;
Condition1 = Highest(HH,length) == HH and lastHi <> HH;
Condition2 = Lowest (LL,length) == LL and lastLo <> LL;
procBit = "";
If Condition1 and Condition2 Then Begin
If lastVertex == "Valley" Then procBit = "Peak" ;
Else procBit = "Valley";
End
Else If Condition1 Then procBit = "Peak" ;
Else If Condition2 Then procBit = "Valley";
//==========================================
If procBit == "Peak" Then Begin
lastHi = HH;
If lastVertex == "Valley" Then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
PK[j,jj] = PK[j-1,jj];
End ;
End ;
PK[1,1] = HH;
PK[1,2] = INDEX;
PK[1,3] = Date;
PK[1,4] = Time;
TL1 = TL_New(VL[1,3],VL[1,4],VL[1,1],PK[1,3],PK[1,4],PK[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,RED);
basePK[1] = 0;
For j = 1 To inRange Begin
If basePK[1] < PK[j,1] Then Begin
For jjj = 1 To 4 Begin
basePK[jjj] = PK[j,jjj];
End ;
End ;
End ;
End
Else If PK[1,1] < HH Then Begin
PK[1,1] = HH;
PK[1,2] = INDEX;
PK[1,3] = Date;
PK[1,4] = Time;
TL_SetEnd(TL1,PK[1,3],PK[1,4],PK[1,1]);
End ;
lastVertex = "Peak";
End ;
//==========================================
If procBit == "Valley" Then Begin
lastLo = LL;
If lastVertex == "Peak" then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
VL[j,jj] = VL[j-1,jj];
End ;
End ;
VL[1,1] = LL;
VL[1,2] = INDEX;
VL[1,3] = Date;
VL[1,4] = Time;
TL1 = TL_New(PK[1,3],PK[1,4],PK[1,1],VL[1,3],VL[1,4],VL[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,BLUE);
baseVL[1] = 0;
For j = 1 To inRange Begin
If baseVL[1] > VL[j,1] or baseVL[1] == 0 Then Begin
For jjj = 1 To 4 Begin
baseVL[jjj] = VL[j,jjj];
End ;
End ;
End ;
End
Else If VL[1,1] > LL then Begin
VL[1,1] = LL;
VL[1,2] = INDEX;
VL[1,3] = Date;
VL[1,4] = Time;
TL_SetEnd(TL1,VL[1,3],VL[1,4],VL[1,1]);
End ;
lastVertex = "Valley";
End ;
//==========================================
Array: fr[7,4](0); // 1:Rate, 2:Price, 3:Trendline ID, 4:Text ID
If CurrentBar == 1 Then Begin
fr[1,1] = 0;
fr[2,1] = 0.236;
fr[3,1] = 0.382;
fr[4,1] = 0.50;
fr[5,1] = 0.618;
fr[6,1] = 0.764;
fr[7,1] = 1;
End ;
If basePK[1] > 0 and baseVL[1] > 0 Then Begin
If baseVL[2][1] <> baseVL[2] or basePK[2][1] <> basePK[2] Then Begin
If TL2 > 0 Then TL_Delete(TL2);
TL2 = TL_New(baseVL[3],baseVL[4],baseVL[1],basePK[3],basePK[4],basePK[1]);
TL_SetSize(TL2,4);
TL_SetColor(TL2,Magenta);
If baseVL[2] < basePK[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = basePK[1] - ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(baseVL[3],baseVL[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(baseVL[3],baseVL[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End
Else If basePK[2] < baseVL[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = baseVL[1] + ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(basePK[3],basePK[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(basePK[3],basePK[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End ;
End
Else Begin
for j = 1 to 7 Begin
TL_SetEnd(fr[j,3],Date,Time,fr[j,2]);
End ;
End ;
End ;
즐거운 하루되세요
> 매버릭 님이 쓴 글입니다.
> 제목 : 오류메세지 수정 부탁드립니다.
> 감사합니다.
//==========================================
// Indicator Name : FibonacciRetracement
// Written by : yahoosir
// Blog : http://yahoosir.blog.me
//==========================================
Input:length(10),ClsPxUseBit(0),inRange(10),waveLineSize(2),displPRC(1);
Var:j(0),jj(0),jjj(0),HH(0),LL(0),lastHi(0),lastLo(0),lastVertex(""),procBit(""),
TL1(0),TL2(0);
Array:PK[50,4](0),VL[50,4](0), // 1:Price, 2:BarNumber, 3:Date, 4:Time
basePK[5](0),baseVL[5](0); // 0:N/A, 1:Price, 2:BarNumber, 3:Date, 4:Time
//==========================================
HH = IFF(ClsPxUseBit == 1,C,H);
LL = IFF(ClsPxUseBit == 1,C,L);
If CurrentBar == 1 Then Begin
PK[1,1] = HH;
VL[1,1] = LL;
End ;
Condition1 = Highest(HH,length) = HH and lastHi <> HH;
Condition2 = Lowest (LL,length) = LL and lastLo <> LL;
procBit = "";
If Condition1 and Condition2 Then Begin
If lastVertex == "Valley" Then procBit = "Peak" ;
Else procBit = "Valley";
End
Else If Condition1 Then procBit = "Peak" ;
Else If Condition2 Then procBit = "Valley";
//==========================================
If procBit == "Peak" Then Begin
lastHi = HH;
If lastVertex == "Valley" Then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
PK[j,jj] = PK[j-1,jj];
End ;
End ;
PK[1,1] = HH;
PK[1,2] = BarNumber;
PK[1,3] = Date;
PK[1,4] = Time;
TL1 = TL_New(VL[1,3],VL[1,4],VL[1,1],PK[1,3],PK[1,4],PK[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,RED);
basePK[1] = 0;
For j = 1 To inRange Begin
If basePK[1] < PK[j,1] Then Begin
For jjj = 1 To 4 Begin
basePK[jjj] = PK[j,jjj];
End ;
End ;
End ;
End
Else If PK[1,1] < HH Then Begin
PK[1,1] = HH;
PK[1,2] = BarNumber;
PK[1,3] = Date;
PK[1,4] = Time;
TL_SetEnd(TL1,PK[1,3],PK[1,4],PK[1,1]);
End ;
lastVertex = "Peak";
End ;
//==========================================
If procBit == "Valley" Then Begin
lastLo = LL;
If lastVertex == "Peak" then Begin
For j = 50 DownTo 2 Begin
For jj = 1 To 4 Begin
VL[j,jj] = VL[j-1,jj];
End ;
End ;
VL[1,1] = LL;
VL[1,2] = BarNumber;
VL[1,3] = Date;
VL[1,4] = Time;
TL1 = TL_New(PK[1,3],PK[1,4],PK[1,1],VL[1,3],VL[1,4],VL[1,1]);
TL_SetSize(TL1,waveLineSize);
TL_SetColor(TL1,BLUE);
baseVL[1] = 0;
For j = 1 To inRange Begin
If baseVL[1] > VL[j,1] or baseVL[1] = 0 Then Begin
For jjj = 1 To 4 Begin
baseVL[jjj] = VL[j,jjj];
End ;
End ;
End ;
End
Else If VL[1,1] > LL then Begin
VL[1,1] = LL;
VL[1,2] = BarNumber;
VL[1,3] = Date;
VL[1,4] = Time;
TL_SetEnd(TL1,VL[1,3],VL[1,4],VL[1,1]);
End ;
lastVertex = "Valley";
End ;
//==========================================
Array: fr[7,4](0); // 1:Rate, 2:Price, 3:Trendline ID, 4:Text ID
If CurrentBar == 1 Then Begin
fr[1,1] = 0;
fr[2,1] = 0.236;
fr[3,1] = 0.382;
fr[4,1] = 0.50;
fr[5,1] = 0.618;
fr[6,1] = 0.764;
fr[7,1] = 1;
End ;
If basePK[1] > 0 and baseVL[1] > 0 Then Begin
If baseVL[2][1] <> baseVL[2] or basePK[2][1] <> basePK[2] Then Begin
If TL2 > 0 Then TL_Delete(TL2);
TL2 = TL_New(baseVL[3],baseVL[4],baseVL[1],basePK[3],basePK[4],basePK[1]);
TL_SetSize(TL2,4);
TL_SetColor(TL2,Magenta);
If baseVL[2] < basePK[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = basePK[1] - ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(baseVL[3],baseVL[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(baseVL[3],baseVL[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End
Else If basePK[2] < baseVL[2] Then Begin
for j = 1 to 7 Begin
If fr[j,3] > 0 Then TL_Delete(fr[j,3]);
fr[j,2] = baseVL[1] + ((basePK[1] - baseVL[1]) * fr[j,1]);
fr[j,3] = TL_New(basePK[3],basePK[4],fr[j,2],Date,Time,fr[j,2]);
If displPRC == 1 Then Begin
If fr[j,4] > 0 Then Text_Delete(fr[j,4]);
fr[j,4] = Text_New(basePK[3],basePK[4],fr[j,2],"(" + NumToStr(fr[j,1]*100,1) + "%) " + NumToStr(fr[j,2],2));
Text_SetStyle(fr[j,4], 1, 2);
Text_SetColor(fr[j,4],black);
End ;
End ;
End ;
End
Else Begin
for j = 1 to 7 Begin
TL_SetEnd(fr[j,3],Date,Time,fr[j,2]);
End ;
End ;
End ;
다음글
이전글