커뮤니티
문의드립니다.
2015-09-14 20:53:59
370
글번호 90305
.
- 1. 90815_캡처111.PNG (0.05 MB)
답변 5
예스스탁 예스스탁 답변
2015-09-14 18:14:18
안녕하세요
예스스탁입니다.
식이 복잡해서 어떤 내용의 식이지 잘 판독이 되지 않습니다.
검색식은 일부분만 첨부된것 같습니다.
내일 편하신 시간에 전화주시기 바랍니다.
즐거운 하루되세요
> 부양가족 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 1)지표식입니다.
// Trailing Stop Line
input: Factor_Short(2.5), Factor_Long(3.5);
var : Period(5), 청산라인표시(True), Loss_Short(0), Loss_Long(0), HiLo(0),HRef(0),LRef(0),HiLoHRefMax(0),HiLoHRefMaxLRefMax(0),
ATRMod(0),WaitingForEntry_Short(true),WaitingForEntry_Long(true),Trail_Short(0), Trail_Long(0),LineNum(0), ReturnVal(0) ;
var : Position_Short(0), Position_Long(0), TL5(0), TL6(0), InitialDate(0);
var : TextId1(-1), LastIndex1(0), TextId2(-1), LastIndex2(0), TextId3(-1), LastIndex3(0);
var : TextId4(-1), LastIndex4(0), TextId5(-1), LastIndex5(0), TextId6(-1), LastIndex6(0);
var : EntryIndex_Short(0), EntryIndex_Long(0), Trend_Short(False), Trend_Long(False);
HiLo = iff(High - Low < 1.5 * Average(High - Low, Period), High - Low, 1.5 * Average(High - Low, Period)) ;
HRef = iff(Low <= High[1], High - Close[1],(High - Close[1] ) - 0.5 * (Low - High[1])) ;
LRef = iff(High >= Low[1], Close[1] - Low, (Close[1] - Low) - 0.5 * (Low[1] - High)) ;
HiLoHRefMax = Maxlist(HiLo, HRef) ;
HiLoHRefMaxLRefMax = Maxlist(HiLoHRefMax, LRef) ;
ATRMod = ema(HiLoHRefMaxLRefMax, 2 * Period - 1) ;
If ATRMod/C*100 > 15 Then
{
Loss_Short = (Factor_Short-1.5) * ATRMod;
Loss_Long = (Factor_Long-1.5) * ATRMod;
}
Else If ATRMod/C*100 > 10 Then
{
Loss_Short = (Factor_Short-1) * ATRMod;
Loss_Long = (Factor_Long-1) * ATRMod;
}
Else
{
Loss_Short = (Factor_Short) * ATRMod;
Loss_Long = (Factor_Long) * ATRMod;
}
if WaitingForEntry_Short then
{
Position_Short = 1;
WaitingForEntry_Short = false ;
Trail_Short = Close - Loss_Short ;
}
else if WaitingForEntry_Short[1] == false then
{
if Close > Trail_Short[1] and Close[1] > Trail_Short[2] then
Trail_Short = MaxList(Trail_Short[1], Close - Loss_Short);
else if Close < Trail_Short[1] and Close[1] < Trail_Short[2] then
Trail_Short = MinList(Trail_Short[1], Close + Loss_Short);
else if Close > Trail_Short[1] then
Trail_Short = Close - Loss_Short;
else
Trail_Short = Close + Loss_Short;
// Trailing Line 1
if Position_Short == -1 and Close > Trail_Short and Trail_Short > 0 then
{
Position_Short = 1;
If 청산라인표시 == True Then
{
LineNum = TL_New(sDate[1], sTime[1], Trail_Short[1], sDate, sTime, Trail_Short[1]) ;
ReturnVal = TL_SetColor(LineNum, Cyan) ;
Plot1(Trail_Short, "1", MAGENTA);
}
EntryIndex_Short = Index;
//Plot11(Trail_Short*0.9, "Point-Short", BLACK);
}
else if Position_Short == 1 and Close < Trail_Short then
{
EntryIndex_Short = 0;
Position_Short = -1;
If 청산라인표시 == True Then
{
//LineNum = TL_New(sDate[1], sTime[1], Trail_Short[1],sDate, sTime, Trail_Short[1]) ;
//ReturnVal = TL_SetColor(LineNum, Magenta) ;
//Plot2(Trail_Short, "2", CYAN);
}
}
else if Trail_Short > 0 then
{
If 청산라인표시 == True Then
{
// 차트 오른쪽 확장
If DateToJulian(CurrentDate)-DateToJulian(sDate) < 15 Then
{
if Close > Trail_Short then
{
TL_Delete(TL5);
TL5 = TL_New(sDate[0],sTime[0],Trail_Short[0],CurrentDate,CurrentTime,Trail_Short[0]);
TL_SetExtRight(TL5,True);
}
}
if Close > Trail_Short then
{
LineNum = TL_New(sDate[1], sTime[1], Trail_Short[1], sDate, sTime, Trail_Short) ;
Trend_Short = True;
TL_SetColor(TL5, MAGENTA);
ReturnVal = TL_SetColor(LineNum, Magenta);
}
else
{
Trend_Short = False;
//LineNum = TL_New(sDate[1], sTime[1], Trail_Short[1], sDate, sTime, Trail_Short) ;
//TL_SetColor(TL5, Cyan);
//ReturnVal = TL_SetColor(LineNum, Cyan);
}
}
}
}
if WaitingForEntry_Long then
{
Position_Long = 1;
WaitingForEntry_Long = false ;
Trail_Long = Close - Loss_Long ;
}
else if WaitingForEntry_Long[1] == false then
{
if Close > Trail_Long[1] and Close[1] > Trail_Long[2] then
Trail_Long = MaxList(Trail_Long[1], Close - Loss_Long);
else if Close < Trail_Long[1] and Close[1] < Trail_Long[2] then
Trail_Long = MinList(Trail_Long[1], Close + Loss_Long);
else if Close > Trail_Long[1] then
Trail_Long = Close - Loss_Long;
else
Trail_Long = Close + Loss_Long;
// Trailing Line 2
if Position_Long == -1 and Close > Trail_Long and Trail_Long > 0 then
{
Position_Long = 1;
EntryIndex_Long = Index;
If 청산라인표시 == True Then
{
LineNum = TL_New(sDate[1], sTime[1], Trail_Long[1], sDate, sTime, Trail_Long[1]) ;
ReturnVal = TL_SetColor(LineNum, Cyan) ;
Plot3(Trail_Long, "3", MAGENTA);
}
//Plot12(Trail_Long*0.9, "Point-Long", PINK);
}
else if Position_Long == 1 and Close < Trail_Long then
{
EntryIndex_Long = 0;
Position_Long = -1;
//LineNum = TL_New(sDate[1], sTime[1], Trail_Long[1],sDate, sTime, Trail_Long[1]) ;
//ReturnVal = TL_SetColor(LineNum, CYAN) ;
//Plot4(Trail_Long, "4", CYAN);
}
else if Trail_Long > 0 then
{
if Close > Trail_Long then
{
Trend_Long = True;
If 청산라인표시 == True Then
{
// 차트 오른쪽 확장
If DateToJulian(CurrentDate)-DateToJulian(sDate) < 15 Then
{
TL_Delete(TL6);
TL6 = TL_New(sDate[0],sTime[0],Trail_Long[0],CurrentDate,CurrentTime,Trail_Long[0]);
TL_SetExtRight(TL6,True);
TL_SetStyle(TL6, 3);
TL_SetSize(TL6, 3);
}
LineNum = TL_New(sDate[1], sTime[1], Trail_Long[1], sDate, sTime, Trail_Long) ;
TL_SetColor(TL6, MAGENTA);
ReturnVal = TL_SetColor(LineNum, Magenta);
TL_SetSize(LineNum, 2);
}
}
else
{
Trend_Long = False;
//LineNum = TL_New(sDate[1], sTime[1], Trail_Long[1], sDate, sTime, Trail_Long) ;
//TL_SetColor(TL6, Cyan);
//ReturnVal = TL_SetColor(LineNum, Cyan);
}
}
}
If (EntryIndex_Short != 0 and EntryIndex_Short == EntryIndex_Long) or
(EntryIndex_Short != 0 and EntryIndex_Short+1 == EntryIndex_Long) or
//(Trend_Long == True and Trend_Short == True and Trend_Short[1] == False) or
(Position_Short == 1 and Position_Short[1] == -1 and Position_Long == 1) Then
{
EntryIndex_Short = 0;
EntryIndex_Long = 0;
/*If LineDisplay == True Then
{
Plot21(Trail_Long*0.95, "Entry-Point", GREEN);
Plot22(Trail_Long*0.93, "Entry-Point", RED);
Plot23(Trail_Long*0.91, "Entry-Point", BLUE);
Plot24(Trail_Long*0.89, "Entry-Point", GREEN);
Plot25(Trail_Long*0.87, "Entry-Point", LGREEN);
}*/
}
2)검색식입니다.
HiLo = iff(High - Low < 1.5 * Average(High - Low, ATR_Period), High - Low, 1.5 * Average(High - Low, ATR_Period)) ;
HRef = iff(Low <= High[1], High - Close[1],(High - Close[1] ) - 0.5 * (Low - High[1])) ;
LRef = iff(High >= Low[1], Close[1] - Low, (Close[1] - Low) - 0.5 * (Low[1] - High)) ;
HiLoHRefMax = Maxlist(HiLo, HRef) ;
HiLoHRefMaxLRefMax = Maxlist(HiLoHRefMax, LRef) ;
ATRMod = ema(HiLoHRefMaxLRefMax, 2 * ATR_Period - 1) ;
Loss = ATR_Factor * ATRMod;
var2 = MA(Money,3);
if index <= 5 then
{
Position = 1;
Trail = Close - Loss ;
}
else
{
/*If DataCompress == 4 and sdate > 19980811 and sdate < 20010115 then
{
MessageLog("$RS++ Position1=%.1f, %.1f, %.1f", Position, Position[1], Trail);
}*/
if Close > Trail[1] and Close[1] > Trail[2] then
Trail = MaxList(Trail[1], Close - Loss);
else if Close < Trail[1] and Close[1] < Trail[2] then
Trail = MinList(Trail[1], Close + Loss);
else if Close > Trail[1] then
Trail = Close - Loss;
else
Trail = Close + Loss;
if Position == -1 and Close > Trail and Trail > 0 then
{
Position = 1;
Find(1);
}
else if Position == 1 and Close < Trail then
{
Position = -1;
}
else if Trail > 0 then
{
}
}
부양가족
2015-09-14 20:43:50
부양가족 님에 의해 삭제된 답변입니다.
부양가족
2015-09-14 20:43:50
부양가족 님에 의해 삭제된 답변입니다.
부양가족
2015-09-14 20:53:14
신경써주셔서 감사합니다.
지표식엔 문제가 없고 검색식이 일봉에서는 거의 정확한데 주봉에서 오류가 발생합니다.
검토부탁드립니다.감사합니다.
검색식입니다.
// Trailing Stop Line
input: ATR_Factor(2);
var : Loss(0),HiLo(0),HRef(0),LRef(0),HiLoHRefMax(0),HiLoHRefMaxLRefMax(0),
ATRMod(0),WaitingForEntry(true),Trail(0),LineNum(0), ReturnVal(0) ;
var : ATR_Period(5), Position(0), TL5(0), SearchResult(0);
HiLo = iff(High - Low < 1.5 * Average(High - Low, ATR_Period), High - Low, 1.5 * Average(High - Low, ATR_Period)) ;
HRef = iff(Low <= High[1], High - Close[1],(High - Close[1] ) - 0.5 * (Low - High[1])) ;
LRef = iff(High >= Low[1], Close[1] - Low, (Close[1] - Low) - 0.5 * (Low[1] - High)) ;
HiLoHRefMax = Maxlist(HiLo, HRef) ;
HiLoHRefMaxLRefMax = Maxlist(HiLoHRefMax, LRef) ;
ATRMod = ema(HiLoHRefMaxLRefMax, 2 * ATR_Period - 1) ;
Loss = ATR_Factor * ATRMod;
if index <= 5 then
{
Position = 1;
Trail = Close - Loss ;
}
else
{
/*If DataCompress == 4 and sdate > 19980811 and sdate < 20010115 then
{
MessageLog("$RS++ Position1=%.1f, %.1f, %.1f", Position, Position[1], Trail);
}*/
if Close > Trail[1] and Close[1] > Trail[2] then
Trail = MaxList(Trail[1], Close - Loss);
else if Close < Trail[1] and Close[1] < Trail[2] then
Trail = MinList(Trail[1], Close + Loss);
else if Close > Trail[1] then
Trail = Close - Loss;
else
Trail = Close + Loss;
if Position == -1 and Close > Trail and Trail > 0 then
{
Position = 1;
find(1);
}
else if Position == 1 and Close < Trail then
{
Position = -1;
}
else if Trail > 0 then
{
}
}
예스스탁 예스스탁 답변
2015-09-15 09:57:06
안녕하세요
예스스탁입니다.
해당식 살펴보니 계산식이 다릅니다.
지표식과 검색식에서 사용된 loss부분 체크하시기 바랍니다.
차트에 점을 찍어 표시하게 검색식으로 수정해본 식입니다.
// Trailing Stop Line
input: ATR_Factor(2);
var : Loss(0),HiLo(0),HRef(0),LRef(0),HiLoHRefMax(0),HiLoHRefMaxLRefMax(0),
ATRMod(0),WaitingForEntry(true),Trail(0),LineNum(0), ReturnVal(0) ;
var : ATR_Period(5), Position(0), TL5(0), SearchResult(0);
HiLo = iff(High - Low < 1.5 * Average(High - Low, ATR_Period), High - Low, 1.5 * Average(High - Low, ATR_Period)) ;
HRef = iff(Low <= High[1], High - Close[1],(High - Close[1] ) - 0.5 * (Low - High[1])) ;
LRef = iff(High >= Low[1], Close[1] - Low, (Close[1] - Low) - 0.5 * (Low[1] - High)) ;
HiLoHRefMax = Maxlist(HiLo, HRef) ;
HiLoHRefMaxLRefMax = Maxlist(HiLoHRefMax, LRef) ;
ATRMod = ema(HiLoHRefMaxLRefMax, 2 * ATR_Period - 1) ;
If ATRMod/C*100 > 15 Then
{
Loss = (ATR_Factor-1.5) * ATRMod;
}
Else If ATRMod/C*100 > 10 Then
{
Loss = (ATR_Factor-1) * ATRMod;
}
Else
{
Loss = (ATR_Factor) * ATRMod;
}
if index <= 5 then
{
Position = 1;
Trail = Close - Loss ;
}
else
{
/*If DataCompress == 4 and sdate > 19980811 and sdate < 20010115 then
{
MessageLog("$RS++ Position1=%.1f, %.1f, %.1f", Position, Position[1], Trail);
}*/
if Close > Trail[1] and Close[1] > Trail[2] then
Trail = MaxList(Trail[1], Close - Loss);
else if Close < Trail[1] and Close[1] < Trail[2] then
Trail = MinList(Trail[1], Close + Loss);
else if Close > Trail[1] then
Trail = Close - Loss;
else
Trail = Close + Loss;
if Position == -1 and Close > Trail and Trail > 0 then
{
Position = 1;
plot1(H);
}
else if Position == 1 and Close < Trail then
{
Position = -1;
}
else if Trail > 0 then
{
}
}
즐거운 하루되세요
> 부양가족 님이 쓴 글입니다.
> 제목 : Re : Re : 문의드립니다.
> 신경써주셔서 감사합니다.
지표식엔 문제가 없고 검색식이 일봉에서는 거의 정확한데 주봉에서 오류가 발생합니다.
검토부탁드립니다.감사합니다.
검색식입니다.
// Trailing Stop Line
input: ATR_Factor(2);
var : Loss(0),HiLo(0),HRef(0),LRef(0),HiLoHRefMax(0),HiLoHRefMaxLRefMax(0),
ATRMod(0),WaitingForEntry(true),Trail(0),LineNum(0), ReturnVal(0) ;
var : ATR_Period(5), Position(0), TL5(0), SearchResult(0);
HiLo = iff(High - Low < 1.5 * Average(High - Low, ATR_Period), High - Low, 1.5 * Average(High - Low, ATR_Period)) ;
HRef = iff(Low <= High[1], High - Close[1],(High - Close[1] ) - 0.5 * (Low - High[1])) ;
LRef = iff(High >= Low[1], Close[1] - Low, (Close[1] - Low) - 0.5 * (Low[1] - High)) ;
HiLoHRefMax = Maxlist(HiLo, HRef) ;
HiLoHRefMaxLRefMax = Maxlist(HiLoHRefMax, LRef) ;
ATRMod = ema(HiLoHRefMaxLRefMax, 2 * ATR_Period - 1) ;
Loss = ATR_Factor * ATRMod;
if index <= 5 then
{
Position = 1;
Trail = Close - Loss ;
}
else
{
/*If DataCompress == 4 and sdate > 19980811 and sdate < 20010115 then
{
MessageLog("$RS++ Position1=%.1f, %.1f, %.1f", Position, Position[1], Trail);
}*/
if Close > Trail[1] and Close[1] > Trail[2] then
Trail = MaxList(Trail[1], Close - Loss);
else if Close < Trail[1] and Close[1] < Trail[2] then
Trail = MinList(Trail[1], Close + Loss);
else if Close > Trail[1] then
Trail = Close - Loss;
else
Trail = Close + Loss;
if Position == -1 and Close > Trail and Trail > 0 then
{
Position = 1;
find(1);
}
else if Position == 1 and Close < Trail then
{
Position = -1;
}
else if Trail > 0 then
{
}
}
이전글