커뮤니티
수정해주세요---------
2012-02-07 17:16:06
379
글번호 47482
input :가격(260),매수매도(1),최소익틱(2),손절틱(10), 익절틱(10),눌림틱(3);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if 매수매도 == 1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("b본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if L > 가격 Then
buy("b1",atlimit,가격);
if H < 가격 Then
buy("b2",AtStop,가격);
}
}
if MarketPosition == 1 Then{
ExitLong("BP",atlimit,가격+PriceScale*익절틱);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*최소익틱 Then
ExitLong("BL",AtStop,가격-PriceScale*손절틱);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소익틱 Then
ExitLong("B본",AtStop,가격);
}
if 매수매도 == -1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("S본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if H < 가격 Then
Sell("s1",AtLimit,가격);
if L > 가격 Then
Sell("s2",AtStop,가격);
}
}
if MarketPosition == -1 Then{
ExitShort("SP",AtLimit,가격-PriceScale*익절틱);
if Lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*최소익틱 Then
ExitShort("SL",AtStop,가격+PriceScale*손절틱);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*최소익틱 Then
ExitShort("S본",AtStop,가격);
}
위식은 2틱이상이익 나면 진입가에 청산하게 되있는데요
이를
4틱이상 수익나면 진입가+1틱 이익나게 청산
5틱이상 수익나면 진입가+2틱 이익나게 청산
6틱이상 수익나면 진입가+2틱 이익나게 청산
7틱이상 수익나면 진입가+2틱 이익나게 청산
8틱이상 수익나면 진입가+3틱 이익나게 청산
수고하세요
답변 1
예스스탁 예스스탁 답변
2012-02-07 18:35:15
안녕하세요
예스스탁입니다.
input :가격(260),매수매도(1),최소익틱(2),손절틱(10), 익절틱(10),눌림틱(3);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if 매수매도 == 1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("b본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if L > 가격 Then
buy("b1",atlimit,가격);
if H < 가격 Then
buy("b2",AtStop,가격);
}
}
if MarketPosition == 1 Then{
ExitLong("BP",atlimit,가격+PriceScale*익절틱);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*최소익틱 Then
ExitLong("BL",AtStop,가격-PriceScale*손절틱);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소익틱 and highest(H,BarsSinceEntry) < EntryPrice+PriceScale*4 Then
ExitLong("B본1",AtStop,가격);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*4 and highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 Then
ExitLong("B본2",AtStop,가격+PriceScale*1);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*5 and highest(H,BarsSinceEntry) < EntryPrice+PriceScale*8 Then
ExitLong("B본3",AtStop,가격+PriceScale*2);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*8 Then
ExitLong("B본4",AtStop,가격+PriceScale*3);
}
if 매수매도 == -1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("S본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if H < 가격 Then
Sell("s1",AtLimit,가격);
if L > 가격 Then
Sell("s2",AtStop,가격);
}
}
if MarketPosition == -1 Then{
ExitShort("SP",AtLimit,가격-PriceScale*익절틱);
if Lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*최소익틱 Then
ExitShort("SL",AtStop,가격+PriceScale*손절틱);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*최소익틱 and Lowest(L,BarsSinceEntry) < EntryPrice+PriceScale*4 Then
ExitShort("S본1",AtStop,가격);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*4 and Lowest(L,BarsSinceEntry) < EntryPrice+PriceScale*5 Then
ExitShort("S본2",AtStop,가격*PriceScale*1);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*5 and Lowest(L,BarsSinceEntry) < EntryPrice+PriceScale*8 Then
ExitShort("S본3",AtStop,가격*PriceScale*2);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*8 Then
ExitShort("S본4",AtStop,가격*PriceScale*3);
}
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 수정해주세요---------
> input :가격(260),매수매도(1),최소익틱(2),손절틱(10), 익절틱(10),눌림틱(3);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if 매수매도 == 1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("b본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if L > 가격 Then
buy("b1",atlimit,가격);
if H < 가격 Then
buy("b2",AtStop,가격);
}
}
if MarketPosition == 1 Then{
ExitLong("BP",atlimit,가격+PriceScale*익절틱);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*최소익틱 Then
ExitLong("BL",AtStop,가격-PriceScale*손절틱);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소익틱 Then
ExitLong("B본",AtStop,가격);
}
if 매수매도 == -1 Then{
if (count == 0 ) or (count >= 1 and IsExitName("S본",1) == true and lowest(L,BarsSinceExit(1)) <= 가격-PriceScale*눌림틱) Then {
if H < 가격 Then
Sell("s1",AtLimit,가격);
if L > 가격 Then
Sell("s2",AtStop,가격);
}
}
if MarketPosition == -1 Then{
ExitShort("SP",AtLimit,가격-PriceScale*익절틱);
if Lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*최소익틱 Then
ExitShort("SL",AtStop,가격+PriceScale*손절틱);
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*최소익틱 Then
ExitShort("S본",AtStop,가격);
}
위식은 2틱이상이익 나면 진입가에 청산하게 되있는데요
이를
4틱이상 수익나면 진입가+1틱 이익나게 청산
5틱이상 수익나면 진입가+2틱 이익나게 청산
6틱이상 수익나면 진입가+2틱 이익나게 청산
7틱이상 수익나면 진입가+2틱 이익나게 청산
8틱이상 수익나면 진입가+3틱 이익나게 청산
수고하세요