커뮤니티
수정부탁드립니다.
2013-06-18 21:22:14
143
글번호 64480
아래의 Reverse전략에서 다음 4개의 진입제어 및 청산전략을 포함시켜
수정해 주시면 감사하겠습니다.
1. 당일손익합계가 2p이상이면 포지션청산후 매매중지
2. 현재포지션 수익이 1p이상이면 목표수익청산후 같은 방향 진입금지
3. 현재포지션 진입후 최대수익이 0.5p이상이면 진입가격에 손익분기점 청산
4. 당일 진입횟수 5회초과시 청산신호나 반대진입신호가 나오면 청산후 매매중지
If Time < EndTime Then
{
If CrossUp(MA20, MA300) Then
{
Buy();
}
If CrossDown(MA20, MA300) Then
{
Sell();
}
}
If Time > EndTime Then
{
ExitShort();
ExitLong();
}
답변 1
예스스탁 예스스탁 답변
2013-06-19 10:07:48
안녕하세요
예스스탁입니다.
input : 하루이익(2),당일진입횟수(5);
var : endtime(0),ma20(0),ma300(0);
var : cnt(0),count(0),NP(0),DayPL(0),PreNP(0);
NP = NetProfit;
if date != date[1] Then
PreNP = NP[1];
DAyPL = NP-PreNP;
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Condition1 = count >= 1 and MarketPosition == 0 and
MarketPosition(1) == 1 and IsExitName("StopProfittarget",1) == true;
Condition2 = count >= 1 and MarketPosition == 0 and
MarketPosition(1) == -1 and IsExitName("StopProfittarget",1) == true;
If Time < EndTime and dayPL < 2 Then
{
If CrossUp(MA20, MA300) and count < 당일진입횟수 Then
{
if Condition1 == false Then
Buy();
}
If CrossDown(MA20, MA300) and count < 당일진입횟수 Then
{
if Condition2 == false Then
Sell();
}
If CrossUp(MA20, MA300) and count == 당일진입횟수 Then
{
if MarketPosition == -1 Then
ExitShort();
}
If CrossDown(MA20, MA300) and count == 당일진입횟수 Then
{
if MarketPosition == 1 Then
ExitLong();
}
}
If Time > EndTime Then
{
ExitShort();
ExitLong();
}
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+0.5 Then
ExitLong("bx1",AtStop,EntryPrice);
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-0.5 Then
ExitShort("sx1",AtStop,EntryPrice);
SetStopProfittarget(1,PointStop);
if MarketPosition == 1 Then{
ExitLong("bx2",AtLimit,EntryPrice+(하루이익-dayPL));
}
if MarketPosition == -1 Then{
ExitShort("sx2",AtLimit,EntryPrice+(-(하루이익)+dayPL));
}
즐거운 하루되세요
> HI_chakanee 님이 쓴 글입니다.
> 제목 : 수정부탁드립니다.
> 아래의 Reverse전략에서 다음 4개의 진입제어 및 청산전략을 포함시켜
수정해 주시면 감사하겠습니다.
1. 당일손익합계가 2p이상이면 포지션청산후 매매중지
2. 현재포지션 수익이 1p이상이면 목표수익청산후 같은 방향 진입금지
3. 현재포지션 진입후 최대수익이 0.5p이상이면 진입가격에 손익분기점 청산
4. 당일 진입횟수 5회초과시 청산신호나 반대진입신호가 나오면 청산후 매매중지
If Time < EndTime Then
{
If CrossUp(MA20, MA300) Then
{
Buy();
}
If CrossDown(MA20, MA300) Then
{
Sell();
}
}
If Time > EndTime Then
{
ExitShort();
ExitLong();
}