커뮤니티
분할매입 분할청산
2012-05-01 23:30:29
431
글번호 50679
항상 빠른 답변 감사드립니다.
기본시스템입니다.
__________________________________________________________________________________
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
____________________________________________________________________________
이 시스템을 가지고 분할매입 분할청산 식으로 고치려고 합니다.
아래의 식이 제가 만든것인데, 잘못된 부분 수정좀 부탁드립니다.
두번의 추가 진입을 허용하고, 추가진입 계약들은 각각의 진입명과
각각의 추가진입가격에 맞추어 이익청산과 손절을 하도록 할려고 합니다.
(각각의 추가진입가격을 어떻게 설정하는지 모르겠습니다)
또한 매진입마다 10계약식 진입, 각 청산마다 10계약식 청산하려고 합니다.
그럼 미리 감사드립니다.
_____________________________________________________________________________
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(30), stopPer(1.0);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Cross Over Buy_2",AtStop,EntryPrice+(ATR(30)*0.5),10);
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Cross Under Sell_2",AtStop,EntryPrice-(ATR(30)*0.5),10);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Cross Over Buy_3",AtStop,EntryPrice+ATR(30),10);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Cross Under Sell_3",AtStop,EntryPrice-ATR(30),10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ),"Cross Over Buy",10,1);
ExitLong("BLoss",AtStop,EntryPrice-1,"Cross Over Buy",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar),"Cross Under Sell",10,1);
ExitShort("SLoss",AtStop,EntryPrice+1,"Cross Under Sell",10,1);
}
If MarketPosition == 1 and IsEntryName("Cross Over Buy_2",0) == True then {
LCount = -999;
ExitLong ("LongTStop_2", atstop, Lowest(L , TrailBar ),"Cross Over Buy_2",10,1);
ExitLong("BLoss_2",AtStop,EntryPrice-1,"Cross Over Buy_2",10,1);
ExitLong("BProfit_2",AtLimit,EntryPrice+1,"Cross Over Buy_2",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell_2",0) == True then {
SCount = -999;
ExitShort ("ShortTStop_2", atstop, Highest(H , TrailBar),"Cross Under Sell_2",10,1);
ExitShort("SLoss_2",AtStop,EntryPrice+1,"Cross Under Sell_2",10,1);
ExitShort("SProfit_2",atlimit,EntryPrice-1,"Cross Under Sell_2",10,1);
}
If MarketPosition == 1 and IsEntryName("Cross Over Buy_3",0) == True then {
LCount = -999;
ExitLong ("LongTStop_3", atstop, Lowest(L , TrailBar ),"Cross Over Buy_3",10,1);
ExitLong("BLoss_3",AtStop,EntryPrice-1,"Cross Over Buy_3",10,1);
ExitLong("BProfit_3",AtLimit,EntryPrice+2,"Cross Over Buy_3",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell_3",0) == True then {
SCount = -999;
ExitShort ("ShortTStop_3", atstop, Highest(H , TrailBar),"Cross Under Sell_3",10,1);
ExitShort("SLoss_3",AtStop,EntryPrice+1,"Cross Under Sell_3",10,1);
ExitShort("SProfit_3",atlimit,EntryPrice-2,"Cross Under Sell_3",10,1);
}
답변 2
예스스탁 예스스탁 답변
2012-05-02 14:34:23
안녕하세요
예스스탁입니다.
식을 아래와 같이 작성하시면 됩니다.
isentryname은 첫번째 진입명 만을 가져오므로
exitlong이나 exitshort함수안에 진입명을 지정하시면 됩니다.
손절매나 목표이익의 경우
강제청산 함수를 사용하시면 자동으로
진입별로 처리되므로 진입별로 1포인트 수익이나 손실을 제어하실 경우
강제청산 함수를 이용하시면 됩니다.
다만 작성하신 내용중 TSstop과 같은 부분은
3개의 청산이 모두 조건이 동일합니다.Lowest(L , TrailBar ), Highest(H , TrailBar)
가격조건이 동일하므로 모두 한번에 신호가 발생하게 됩니다.
해당 내용은 따로 조정하셔야 합니다.
이름이 긴 내용은 작성을 위해 짧게 처리했습니다.
피라미딩 하는 내용이므로 적용하실 때 피라미딩을 다른진입신호만 허용으로 설정하시기 바랍니다.
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(30), stopPer(1.0);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999),ATRV(0);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
ATRV = ATR(30);
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy("Buy1", atstop,LEntryPrice,10);
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Buy2",AtStop,EntryPrice+(ATR(30)*0.5),10);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Buy3",AtStop,EntryPrice+ATR(30),10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Sell1", atstop,SEntryPrice,10);
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Sell2",AtStop,EntryPrice-(ATRV*0.5),10);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Sell3",AtStop,EntryPrice-ATRV,10);
If MarketPosition == 1 then {
LCount = -999;
ExitLong("LongTStop_1", atstop, Lowest(L , TrailBar ),"Buy1",10,1);
ExitLong("LongTStop_2", atstop, Lowest(L , TrailBar ),"Buy2",10,1);
ExitLong("LongTStop_3", atstop, Lowest(L , TrailBar ),"Buy3",10,1);
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort("ShortTStop_1", atstop, Highest(H , TrailBar),"Sell1",10,1);
ExitShort("ShortTStop_2", atstop, Highest(H , TrailBar),"Sell2",10,1);
ExitShort("ShortTStop_3", atstop, Highest(H , TrailBar),"Sell3",10,1);
}
SetStopLoss(1,PointStop);
SetStopProfittarget(1,PointStop);
즐거운 하루되세요
> 공감n감사 님이 쓴 글입니다.
> 제목 : 분할매입 분할청산
> 항상 빠른 답변 감사드립니다.
기본시스템입니다.
__________________________________________________________________________________
Input: FastLen(10),SlowLen(500),ChLen(30),TrailBar(160),ReBars(30),stopPer(1.0);
Vars: FastMA(0),SlowMA(0),LEntryPrice(0),SEntryPrice(0),LCount(-999),SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
ExitLong("BLoss",AtStop,EntryPrice-1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
ExitShort("SLoss",AtStop,EntryPrice+1);
}
____________________________________________________________________________
이 시스템을 가지고 분할매입 분할청산 식으로 고치려고 합니다.
아래의 식이 제가 만든것인데, 잘못된 부분 수정좀 부탁드립니다.
두번의 추가 진입을 허용하고, 추가진입 계약들은 각각의 진입명과
각각의 추가진입가격에 맞추어 이익청산과 손절을 하도록 할려고 합니다.
(각각의 추가진입가격을 어떻게 설정하는지 모르겠습니다)
또한 매진입마다 10계약식 진입, 각 청산마다 10계약식 청산하려고 합니다.
그럼 미리 감사드립니다.
_____________________________________________________________________________
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(30), stopPer(1.0);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice,10);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice,10);
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Cross Over Buy_2",AtStop,EntryPrice+(ATR(30)*0.5),10);
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Cross Under Sell_2",AtStop,EntryPrice-(ATR(30)*0.5),10);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Cross Over Buy_3",AtStop,EntryPrice+ATR(30),10);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Cross Under Sell_3",AtStop,EntryPrice-ATR(30),10);
If MarketPosition == 1 and IsEntryName("Cross Over Buy",0) == True then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ),"Cross Over Buy",10,1);
ExitLong("BLoss",AtStop,EntryPrice-1,"Cross Over Buy",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell",0) == True then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar),"Cross Under Sell",10,1);
ExitShort("SLoss",AtStop,EntryPrice+1,"Cross Under Sell",10,1);
}
If MarketPosition == 1 and IsEntryName("Cross Over Buy_2",0) == True then {
LCount = -999;
ExitLong ("LongTStop_2", atstop, Lowest(L , TrailBar ),"Cross Over Buy_2",10,1);
ExitLong("BLoss_2",AtStop,EntryPrice-1,"Cross Over Buy_2",10,1);
ExitLong("BProfit_2",AtLimit,EntryPrice+1,"Cross Over Buy_2",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell_2",0) == True then {
SCount = -999;
ExitShort ("ShortTStop_2", atstop, Highest(H , TrailBar),"Cross Under Sell_2",10,1);
ExitShort("SLoss_2",AtStop,EntryPrice+1,"Cross Under Sell_2",10,1);
ExitShort("SProfit_2",atlimit,EntryPrice-1,"Cross Under Sell_2",10,1);
}
If MarketPosition == 1 and IsEntryName("Cross Over Buy_3",0) == True then {
LCount = -999;
ExitLong ("LongTStop_3", atstop, Lowest(L , TrailBar ),"Cross Over Buy_3",10,1);
ExitLong("BLoss_3",AtStop,EntryPrice-1,"Cross Over Buy_3",10,1);
ExitLong("BProfit_3",AtLimit,EntryPrice+2,"Cross Over Buy_3",10,1);
}
If MarketPosition == -1 and IsEntryName("Cross Under Sell_3",0) == True then {
SCount = -999;
ExitShort ("ShortTStop_3", atstop, Highest(H , TrailBar),"Cross Under Sell_3",10,1);
ExitShort("SLoss_3",AtStop,EntryPrice+1,"Cross Under Sell_3",10,1);
ExitShort("SProfit_3",atlimit,EntryPrice-2,"Cross Under Sell_3",10,1);
}
공감n감사
2012-05-02 21:05:49
빠른 답변 감사드립니다.
그런데 저의 설명이 좀 부족했나봅니다^^
이익청산과 손절값이 각계약마다 다르기 때문에 따로따로 해야합니다.
제가 원하는 청산방법은 첫번째 진입은 이익청산이 없고, 두번째 진입은 1포인트(여기서1포인트는 큰 의미가 없고, 그냥 예를 들어 가정을 한거구요, 10포인트가 될수도 있고, atr값이 될수도 있습니다)이익이 생겼을때 이익청산하고, 세번째 진입은 2포인트(이것도 그냥 가정입니다. 20포인트가 될수도 있고, 여러가지....)이상 이익이 나면 청산하도록 하려고 합니다.
간단히 예를 들어 설명하면, 첫번째 진입이 총8포인트 수익이 났다면,두번째 진입은 3포인트 이익이 나면 처음 먼저 청산, 세번째 진입은 세번째 진입가격에서 5포인트 이익이 나면 두번째로 청산합니다. 첫번째 진입이 맨 마지막에 청산됩니다.결과적으로 총 3계약이 16포인트 이익을 내도록 하려고 합니다.
근데 첫번째 진입가격은 entryprice로 정하는데, 두번째와 세번째 진입가격은 어떻게 해야 되는지 모르겠습니다. 두번째와 세번째의 진입가격을 이용해서 이익청산과 손절을
각각 다른 값으로 하고 싶습니다.
부탁드립니다.
다음글
이전글