커뮤니티
수식작성 부탁드립니다.
2012-07-31 16:17:06
295
글번호 53393
챠트 : 옵션1분봉 (피라미딩 다른진입시만 허용)
07/30 일자 C245 챠트
아래와 같은 수식으로 각 진입명 별로 거래회수를 제한하고 싶은데 잘 안되네요...
B01 은 2번, B02 는 3번 만 진입하도록 하고 싶습니다.
이전자료 찾아서 작성해 보았는데 잘 안되네요...
도와주세요...
Inputs : In(1), Stval(0.1);
Vars : cnt(0), B1cnt(0), B2cnt(0);
if stime==090000 then value1=data1(close);
if date<>date[1] then Begin
cnt = 0;
B1cnt = 0;
B2cnt = 0;
End;
//for cnt = 0 to 20{
// if MarketPosition(cnt) == 1 and IsEntryName("B01",B1cnt) Then
// B1cnt = B1cnt+1;
// if MarketPosition(cnt) == 1 and IsEntryName("B02",B2cnt) Then
// B2cnt = B2cnt+1;
//}
//Entry
if stime>=090000 and stime<=150000 Then Begin
if B1cnt <= 2 then begin
buy("B01", AtStop, value1+0.01, In);
B1cnt = B1cnt + 1;
End;
if B2cnt <= 3 then begin
buy("B02", AtStop, value1+0.02, In);
B2cnt = B2cnt + 1;
End;
End;
SetStopContract;
SetStopEndofday(151000);
SetStopLoss(Stval,PointStop);
print("D://tt.txt", "value1 %.2f cnt %.2f B1cnt %.2f B2cnt %.2f", value1, cnt, B1cnt, B2cnt);
답변 1
예스스탁 예스스탁 답변
2012-07-31 20:05:03
안녕하세요
예스스탁입니다.
진입명함수는 피라미딩시 첫진입의 이름만 리턴합니다.
피라미딩 상태에서는 이름으로 횟수를 제어할 수 없습니다.
따로 진입을 인지할수 있는 내용을 추가해서 카운트를 해야 합니다.
Inputs : In(1), Stval(0.1);
Vars : cnt(0), B1cnt(0), B2cnt(0);
if stime==090000 then
value1=data1(close);
if date<>date[1] then Begin
cnt = 0;
B1cnt = 0;
B2cnt = 0;
End;
if stime>= 090000 and stime<=150000 Then Begin
if stime > 90000 Then{
if H >= value1[1]+0.01 Then
B1cnt = B1cnt+1;
if H >= value1[1]+0.02 Then
B2cnt = B2cnt+1;
}
if B1cnt < 2 then begin
buy("B01", AtStop, value1+0.01, In);
End;
if B2cnt < 3 then begin
buy("B02", AtStop, value1+0.02, In);
End;
End;
SetStopContract;
SetStopEndofday(151000);
SetStopLoss(Stval,PointStop);
즐거운 하루되세요
> WT_storm69 님이 쓴 글입니다.
> 제목 : 수식작성 부탁드립니다.
>
챠트 : 옵션1분봉 (피라미딩 다른진입시만 허용)
07/30 일자 C245 챠트
아래와 같은 수식으로 각 진입명 별로 거래회수를 제한하고 싶은데 잘 안되네요...
B01 은 2번, B02 는 3번 만 진입하도록 하고 싶습니다.
이전자료 찾아서 작성해 보았는데 잘 안되네요...
도와주세요...
Inputs : In(1), Stval(0.1);
Vars : cnt(0), B1cnt(0), B2cnt(0);
if stime==090000 then value1=data1(close);
if date<>date[1] then Begin
cnt = 0;
B1cnt = 0;
B2cnt = 0;
End;
//for cnt = 0 to 20{
// if MarketPosition(cnt) == 1 and IsEntryName("B01",B1cnt) Then
// B1cnt = B1cnt+1;
// if MarketPosition(cnt) == 1 and IsEntryName("B02",B2cnt) Then
// B2cnt = B2cnt+1;
//}
//Entry
if stime>=090000 and stime<=150000 Then Begin
if B1cnt <= 2 then begin
buy("B01", AtStop, value1+0.01, In);
B1cnt = B1cnt + 1;
End;
if B2cnt <= 3 then begin
buy("B02", AtStop, value1+0.02, In);
B2cnt = B2cnt + 1;
End;
End;
SetStopContract;
SetStopEndofday(151000);
SetStopLoss(Stval,PointStop);
print("D://tt.txt", "value1 %.2f cnt %.2f B1cnt %.2f B2cnt %.2f", value1, cnt, B1cnt, B2cnt);
이전글