커뮤니티

기준라인 해석

프로필 이미지
목마와숙녀
2020-01-20 12:01:01
183
글번호 130450
답변완료
답변 고맙습니다. 1. BUY 수식의 익절과 트레일링스탑 수식을 추가했습니다. 2. SELL 수식 작성해보았습니다. 3. 수식이 바른지 봐주세요. 4. SELL 수식만 해석 부탁합니다. ******************************************************************************** BUY수식) input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } SELL수식) input : 기준(265),하락(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H > 기준-하락 and ExitDate(1) != sdate Then sell("s1",AtStop,기준-하락); if MarketPosition == -1 Then { var1 = (기준-하락) - 하락*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H > var1 Then sell("s2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitShort("sl1",AtStop,EP[1]+PriceScale*손절1,"s1"); ExitShort("sp1",Atlimit,EP[1]-PriceScale*익절1,"s1"); ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1,"s1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitShort("sl2",AtStop,EP[2]+PriceScale*손절2,"s2"); ExitShort("sp2",Atlimit,EP[2]-PriceScale*익절2,"s2"); ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2,"s2"); }
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2019-07-18 11:50:54

안녕하세요 예스스탁입니다. 1 수식에 큰 문제는 없습니다. if문에 포함되는 실행문이 2개 이상이면 {}로 묶어주셔야 합니다. 매도쪽은 진입이 가격이 하락해서 해당 가격에 도달할 때 이므로 if문에 L > 기준-상승 , L > var1 으로 지정디어 있어야 합니다. 저가가 아닌 고가로 지정되어 있어 해당부분을 수정했습니다. 2 input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then { ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); } if MaxEntries >= 2 and EP[2] > 0 Then { ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } } 3 input : 기준(265),하락(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); #무포지션이고 저가가 기준-하락값보다 크고 당일 첫진입일때만 #다음봉에 가격이 하락해 기준-하락에 도달하면 매도진입 if MarketPosition == 0 and L > 기준-하락 and ExitDate(1) != sdate Then sell("s1",AtStop,기준-하락); #매도포지션 진입 후 if MarketPosition == -1 Then { #다음 진입가격 계산 var1 = (기준-하락) - 하락*MaxEntries; #배열방에 진입횟수별 진입가격 저장 #1번방에는 첫진입이 진입가격, 2번방에는 두번째 진입가격 EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 저가가 var1값보다 높은 상태에서 #다음봉에 하락해 var1을 터치하면 즉시 진입 if MaxEntries == 1 and L > var1 Then sell("s2",AtStop,var1); #첫진입이 발생한 이후 if MaxEntries >= 1 and EP[1] > 0 Then { #첫진입가격에서 50틱 상승하면 첫진입만 손절청산 ExitShort("sl1",AtStop,EP[1]+PriceScale*손절1,"s1"); #첫진입가격에서 300틱 하락하면 첫진입만 익절청산 ExitShort("sp1",Atlimit,EP[1]-PriceScale*익절1,"s1"); #진입이후 최고가에서 150틱 상승하면 첫진입만 트레일링스탑청산 ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1,"s1"); } #두번째 진입이 발생한 수 if MaxEntries >= 2 and EP[2] > 0 Then { #두번째진입가격에서 50틱 상승하면 두번째 진입만 손절청산 ExitShort("sl2",AtStop,EP[2]+PriceScale*손절2,"s2"); #두번째진입가격에서 300틱 하락하면 두번째 진입만 익절청산 ExitShort("sp2",Atlimit,EP[2]-PriceScale*익절2,"s2"); #진입이후 최고가에서 150틱 상승하면 두번째 진입만 트레일링스탑청산 ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2,"s2"); } } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 답변 고맙습니다. 1. BUY 수식의 익절과 트레일링스탑 수식을 추가했습니다. 2. SELL 수식 작성해보았습니다. 3. 수식이 바른지 봐주세요. 4. SELL 수식만 해석 부탁합니다. ******************************************************************************** BUY수식) input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } SELL수식) input : 기준(265),하락(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H > 기준-하락 and ExitDate(1) != sdate Then sell("s1",AtStop,기준-하락); if MarketPosition == -1 Then { var1 = (기준-하락) - 하락*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H > var1 Then sell("s2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitShort("sl1",AtStop,EP[1]+PriceScale*손절1,"s1"); ExitShort("sp1",Atlimit,EP[1]-PriceScale*익절1,"s1"); ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1,"s1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitShort("sl2",AtStop,EP[2]+PriceScale*손절2,"s2"); ExitShort("sp2",Atlimit,EP[2]-PriceScale*익절2,"s2"); ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2,"s2"); }
프로필 이미지

목마와숙녀

2019-07-19 09:23:04

12개까지 늘린 수식으로 첨부같이 시뮬레이션 했는데 결과가 이상하게 나오는데 수식 살펴주세요 1.첨부파일은 1은 어제 돌린 것이고 2는 금일 같은 조건으로 했는데 결과가 다르게 나오는 점 2.0과 3사이의 결과가 2개만 나오는데 중간에 0.5와 1.00과 1.5를 실제 대입하면 -2.84, 12.06, 10.18이 나옵니다.(수수료 0.0032, 슬리피지 진입,청산 2틱씩) input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); input : 손절3(50),익절3(300),TR3(150); input : 손절4(50),익절4(300),TR4(150); input : 손절5(50),익절5(300),TR5(150); input : 손절6(50),익절6(300),TR6(150); input : 손절7(50),익절7(300),TR7(150); input : 손절8(50),익절8(300),TR8(150); input : 손절9(50),익절9(300),TR9(150); input : 손절10(50),익절10(300),TR10(150); input : 손절11(50),익절11(300),TR11(150); input : 손절12(50),익절12(300),TR12(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries == 2 and H < var1 Then buy("b3",AtStop,var1); if MaxEntries == 3 and H < var1 Then buy("b4",AtStop,var1); if MaxEntries == 4 and H < var1 Then buy("b5",AtStop,var1); if MaxEntries == 5 and H < var1 Then buy("b6",AtStop,var1); if MaxEntries == 6 and H < var1 Then buy("b7",AtStop,var1); if MaxEntries == 7 and H < var1 Then buy("b8",AtStop,var1); if MaxEntries == 8 and H < var1 Then buy("b9",AtStop,var1); if MaxEntries == 9 and H < var1 Then buy("b10",AtStop,var1); if MaxEntries == 10 and H < var1 Then buy("b11",AtStop,var1); if MaxEntries == 11 and H < var1 Then buy("b12",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then { ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); } if MaxEntries >= 2 and EP[2] > 0 Then { ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } if MaxEntries >= 3 and EP[3] > 0 Then { ExitLong("bl3",AtStop,EP[3]-PriceScale*손절3,"b3"); ExitLong("bp3",Atlimit,EP[3]+PriceScale*익절3,"b3"); ExitLong("btr3",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR3,"b3"); } if MaxEntries >= 4 and EP[4] > 0 Then { ExitLong("bl4",AtStop,EP[4]-PriceScale*손절4,"b4"); ExitLong("bp4",Atlimit,EP[4]+PriceScale*익절4,"b4"); ExitLong("btr4",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR4,"b4"); } if MaxEntries >= 5 and EP[5] > 0 Then { ExitLong("bl5",AtStop,EP[5]-PriceScale*손절5,"b5"); ExitLong("bp5",Atlimit,EP[5]+PriceScale*익절5,"b5"); ExitLong("btr5",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR5,"b5"); } if MaxEntries >= 6 and EP[6] > 0 Then { ExitLong("bl6",AtStop,EP[6]-PriceScale*손절6,"b6"); ExitLong("bp6",Atlimit,EP[6]+PriceScale*익절6,"b6"); ExitLong("btr6",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR6,"b6"); } if MaxEntries >= 7 and EP[7] > 0 Then { ExitLong("bl7",AtStop,EP[7]-PriceScale*손절7,"b7"); ExitLong("bp7",Atlimit,EP[7]+PriceScale*익절7,"b7"); ExitLong("btr7",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR7,"b7"); } if MaxEntries >= 8 and EP[8] > 0 Then { ExitLong("bl8",AtStop,EP[8]-PriceScale*손절8,"b8"); ExitLong("bp8",Atlimit,EP[8]+PriceScale*익절8,"b8"); ExitLong("btr8",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR8,"b8"); } if MaxEntries >= 9 and EP[9] > 0 Then { ExitLong("bl9",AtStop,EP[9]-PriceScale*손절9,"b9"); ExitLong("bp9",Atlimit,EP[9]+PriceScale*익절9,"b9"); ExitLong("btr9",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR9,"b9"); } if MaxEntries >= 10 and EP[10] > 0 Then { ExitLong("bl10",AtStop,EP[10]-PriceScale*손절10,"b10"); ExitLong("bp10",Atlimit,EP[10]+PriceScale*익절10,"b10"); ExitLong("btr10",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR10,"b10"); } if MaxEntries >= 11 and EP[11] > 0 Then { ExitLong("bl11",AtStop,EP[11]-PriceScale*손절11,"b11"); ExitLong("bp11",Atlimit,EP[11]+PriceScale*익절11,"b11"); ExitLong("btr11",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR11,"b11"); } if MaxEntries >= 12 and EP[12] > 0 Then { ExitLong("bl12",AtStop,EP[12]-PriceScale*손절12,"b12"); ExitLong("bp12",Atlimit,EP[12]+PriceScale*익절12,"b12"); ExitLong("btr12",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR12,"b12"); } } > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 > 안녕하세요 예스스탁입니다. 1 수식에 큰 문제는 없습니다. if문에 포함되는 실행문이 2개 이상이면 {}로 묶어주셔야 합니다. 매도쪽은 진입이 가격이 하락해서 해당 가격에 도달할 때 이므로 if문에 L > 기준-상승 , L > var1 으로 지정디어 있어야 합니다. 저가가 아닌 고가로 지정되어 있어 해당부분을 수정했습니다. 2 input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then { ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); } if MaxEntries >= 2 and EP[2] > 0 Then { ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } } 3 input : 기준(265),하락(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); #무포지션이고 저가가 기준-하락값보다 크고 당일 첫진입일때만 #다음봉에 가격이 하락해 기준-하락에 도달하면 매도진입 if MarketPosition == 0 and L > 기준-하락 and ExitDate(1) != sdate Then sell("s1",AtStop,기준-하락); #매도포지션 진입 후 if MarketPosition == -1 Then { #다음 진입가격 계산 var1 = (기준-하락) - 하락*MaxEntries; #배열방에 진입횟수별 진입가격 저장 #1번방에는 첫진입이 진입가격, 2번방에는 두번째 진입가격 EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 저가가 var1값보다 높은 상태에서 #다음봉에 하락해 var1을 터치하면 즉시 진입 if MaxEntries == 1 and L > var1 Then sell("s2",AtStop,var1); #첫진입이 발생한 이후 if MaxEntries >= 1 and EP[1] > 0 Then { #첫진입가격에서 50틱 상승하면 첫진입만 손절청산 ExitShort("sl1",AtStop,EP[1]+PriceScale*손절1,"s1"); #첫진입가격에서 300틱 하락하면 첫진입만 익절청산 ExitShort("sp1",Atlimit,EP[1]-PriceScale*익절1,"s1"); #진입이후 최고가에서 150틱 상승하면 첫진입만 트레일링스탑청산 ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1,"s1"); } #두번째 진입이 발생한 수 if MaxEntries >= 2 and EP[2] > 0 Then { #두번째진입가격에서 50틱 상승하면 두번째 진입만 손절청산 ExitShort("sl2",AtStop,EP[2]+PriceScale*손절2,"s2"); #두번째진입가격에서 300틱 하락하면 두번째 진입만 익절청산 ExitShort("sp2",Atlimit,EP[2]-PriceScale*익절2,"s2"); #진입이후 최고가에서 150틱 상승하면 두번째 진입만 트레일링스탑청산 ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2,"s2"); } } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 답변 고맙습니다. 1. BUY 수식의 익절과 트레일링스탑 수식을 추가했습니다. 2. SELL 수식 작성해보았습니다. 3. 수식이 바른지 봐주세요. 4. SELL 수식만 해석 부탁합니다. ******************************************************************************** BUY수식) input : 기준(265),상승(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H < 기준+상승 and ExitDate(1) != sdate Then buy("b1",AtStop,기준+상승); if MarketPosition == 1 Then { var1 = (기준+상승) + 상승*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H < var1 Then buy("b2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitLong("bl1",AtStop,EP[1]-PriceScale*손절1,"b1"); ExitLong("bp1",Atlimit,EP[1]+PriceScale*익절1,"b1"); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1,"b1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitLong("bl2",AtStop,EP[2]-PriceScale*손절2,"b2"); ExitLong("bp2",Atlimit,EP[2]+PriceScale*익절2,"b2"); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2,"b2"); } SELL수식) input : 기준(265),하락(1.00); input : 손절1(50),익절1(300),TR1(150); input : 손절2(50),익절2(300),TR2(150); Array : EP[10](0); if MarketPosition == 0 and H > 기준-하락 and ExitDate(1) != sdate Then sell("s1",AtStop,기준-하락); if MarketPosition == -1 Then { var1 = (기준-하락) - 하락*MaxEntries; EP[MaxEntries] = LatestEntryPrice(0); #2번째 진입 if MaxEntries == 1 and H > var1 Then sell("s2",AtStop,var1); if MaxEntries >= 1 and EP[1] > 0 Then ExitShort("sl1",AtStop,EP[1]+PriceScale*손절1,"s1"); ExitShort("sp1",Atlimit,EP[1]-PriceScale*익절1,"s1"); ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1,"s1"); if MaxEntries >= 2 and EP[2] > 0 Then ExitShort("sl2",AtStop,EP[2]+PriceScale*손절2,"s2"); ExitShort("sp2",Atlimit,EP[2]-PriceScale*익절2,"s2"); ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2,"s2"); }