커뮤니티
진입제한
2012-06-05 21:15:37
358
글번호 51702
안녕하세요. 언제나 빠른 답변 감사합니다.
아래의 식은 "연결선물 주봉"을 기준으로한 피라미딩 시스템입니다.
buy1, buy2, buy3가 분할진입하고, buy2, buy3만 이익청산합니다.
마찬가지로 sell1, sell2, sell3가 분할진입하고, sell2, sell3만 이익청산합니다.
그런데, buy2, buy3가 이익청산되고, buy1만 남아있을때, buy2가 계속해서
반복진입하는 오류가 발생합니다.
마찬가지로 sell2, sell3가 이익청산되고, sell1만 남아있을때, sell2가 반복진입되는 오류가 생깁니다.( 참고 그림파일 2개 첨부합니다.)
이익청산후 반복진입되는 오류를 수정부탁드립니다.
미리 감사드립니다.
----------------------------------------------------------------------------------
[ 연결선물 주봉 시스템]
Input: FastLen(1), SlowLen(35), ChLen(300), TrailBar(30);
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("Buy1", atstop,LEntryPrice,1);
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Buy2",AtStop,EntryPrice+1,1);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Buy3",AtStop,EntryPrice+2,1);
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,1);
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Sell2",AtStop,EntryPrice-1,1);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Sell3",AtStop,EntryPrice-2,1);
If MarketPosition == 1 then {
LCount = -999;
ExitLong("LongTStop_1", atstop, Lowest(L , TrailBar ),"Buy1",1,1);
ExitLong("LongTStop_2", atstop, Lowest(L , TrailBar ),"Buy2",1,1);
ExitLong("LongTStop_3", atstop, Lowest(L , TrailBar ),"Buy3",1,1);
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort("ShortTStop_1", atstop, Highest(H , TrailBar),"Sell1",1,1);
ExitShort("ShortTStop_2", atstop, Highest(H , TrailBar),"Sell2",1,1);
ExitShort("ShortTStop_3", atstop, Highest(H , TrailBar),"Sell3",1,1);
}
if MarketPosition == 1 Then{
exitlong("bloss1",AtStop,EntryPrice-20,"buy1",1,1);
exitlong("bloss2",AtStop,EntryPrice-20,"buy2",1,1);
exitlong("bloss3",AtStop,EntryPrice-20,"buy3",1,1);
exitlong("bProfit2",atlimit,EntryPrice+50,"buy2",1,1);
exitlong("bProfit3",atlimit,EntryPrice+80,"buy3",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sLoss1",AtStop,EntryPrice+20,"sell1",1,1);
ExitShort("sLoss2",AtStop,EntryPrice+20,"sell2",1,1);
ExitShort("sLoss3",AtStop,EntryPrice+20,"sell3",1,1);
ExitShort("sProfit2",atlimit,EntryPrice-30,"sell2",1,1);
ExitShort("sProfit3",atlimit,EntryPrice-50,"sell3",1,1);
}
- 1. SnapShot_01.jpg (0.26 MB)
- 2. SnapShot_02.jpg (0.26 MB)
답변 1
예스스탁 예스스탁 답변
2012-06-07 11:16:05
안녕하세요
예스스탁입니다.
Input: FastLen(1), SlowLen(35), ChLen(300), TrailBar(30);
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("Buy1", atstop,LEntryPrice,1);
if countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then{
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Buy2",AtStop,EntryPrice+1,1);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Buy3",AtStop,EntryPrice+2,1);
}
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,1);
if countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then{
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Sell2",AtStop,EntryPrice-1,1);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Sell3",AtStop,EntryPrice-2,1);
}
If MarketPosition == 1 then {
LCount = -999;
ExitLong("LongTStop_1", atstop, Lowest(L , TrailBar ),"Buy1",1,1);
ExitLong("LongTStop_2", atstop, Lowest(L , TrailBar ),"Buy2",1,1);
ExitLong("LongTStop_3", atstop, Lowest(L , TrailBar ),"Buy3",1,1);
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort("ShortTStop_1", atstop, Highest(H , TrailBar),"Sell1",1,1);
ExitShort("ShortTStop_2", atstop, Highest(H , TrailBar),"Sell2",1,1);
ExitShort("ShortTStop_3", atstop, Highest(H , TrailBar),"Sell3",1,1);
}
if MarketPosition == 1 Then{
exitlong("bloss1",AtStop,EntryPrice-20,"buy1",1,1);
exitlong("bloss2",AtStop,EntryPrice-20,"buy2",1,1);
exitlong("bloss3",AtStop,EntryPrice-20,"buy3",1,1);
exitlong("bProfit2",atlimit,EntryPrice+50,"buy2",1,1);
exitlong("bProfit3",atlimit,EntryPrice+80,"buy3",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sLoss1",AtStop,EntryPrice+20,"sell1",1,1);
ExitShort("sLoss2",AtStop,EntryPrice+20,"sell2",1,1);
ExitShort("sLoss3",AtStop,EntryPrice+20,"sell3",1,1);
ExitShort("sProfit2",atlimit,EntryPrice-30,"sell2",1,1);
ExitShort("sProfit3",atlimit,EntryPrice-50,"sell3",1,1);
}
즐거운 하루되세요
> 공감n감사 님이 쓴 글입니다.
> 제목 : 진입제한
> 안녕하세요. 언제나 빠른 답변 감사합니다.
아래의 식은 "연결선물 주봉"을 기준으로한 피라미딩 시스템입니다.
buy1, buy2, buy3가 분할진입하고, buy2, buy3만 이익청산합니다.
마찬가지로 sell1, sell2, sell3가 분할진입하고, sell2, sell3만 이익청산합니다.
그런데, buy2, buy3가 이익청산되고, buy1만 남아있을때, buy2가 계속해서
반복진입하는 오류가 발생합니다.
마찬가지로 sell2, sell3가 이익청산되고, sell1만 남아있을때, sell2가 반복진입되는 오류가 생깁니다.( 참고 그림파일 2개 첨부합니다.)
이익청산후 반복진입되는 오류를 수정부탁드립니다.
미리 감사드립니다.
----------------------------------------------------------------------------------
[ 연결선물 주봉 시스템]
Input: FastLen(1), SlowLen(35), ChLen(300), TrailBar(30);
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("Buy1", atstop,LEntryPrice,1);
If MarketPosition == 1 and CurrentEntries == 1 Then
buy("Buy2",AtStop,EntryPrice+1,1);
If MarketPosition == 1 and CurrentEntries == 2 Then
buy("Buy3",AtStop,EntryPrice+2,1);
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,1);
If MarketPosition == -1 and CurrentEntries == 1 Then
sell("Sell2",AtStop,EntryPrice-1,1);
If MarketPosition == -1 and CurrentEntries == 2 Then
sell("Sell3",AtStop,EntryPrice-2,1);
If MarketPosition == 1 then {
LCount = -999;
ExitLong("LongTStop_1", atstop, Lowest(L , TrailBar ),"Buy1",1,1);
ExitLong("LongTStop_2", atstop, Lowest(L , TrailBar ),"Buy2",1,1);
ExitLong("LongTStop_3", atstop, Lowest(L , TrailBar ),"Buy3",1,1);
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort("ShortTStop_1", atstop, Highest(H , TrailBar),"Sell1",1,1);
ExitShort("ShortTStop_2", atstop, Highest(H , TrailBar),"Sell2",1,1);
ExitShort("ShortTStop_3", atstop, Highest(H , TrailBar),"Sell3",1,1);
}
if MarketPosition == 1 Then{
exitlong("bloss1",AtStop,EntryPrice-20,"buy1",1,1);
exitlong("bloss2",AtStop,EntryPrice-20,"buy2",1,1);
exitlong("bloss3",AtStop,EntryPrice-20,"buy3",1,1);
exitlong("bProfit2",atlimit,EntryPrice+50,"buy2",1,1);
exitlong("bProfit3",atlimit,EntryPrice+80,"buy3",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sLoss1",AtStop,EntryPrice+20,"sell1",1,1);
ExitShort("sLoss2",AtStop,EntryPrice+20,"sell2",1,1);
ExitShort("sLoss3",AtStop,EntryPrice+20,"sell3",1,1);
ExitShort("sProfit2",atlimit,EntryPrice-30,"sell2",1,1);
ExitShort("sProfit3",atlimit,EntryPrice-50,"sell3",1,1);
}
다음글
이전글