커뮤니티
수식 문의
2017-06-05 17:24:07
131
글번호 110123
시스템식 부탁드립니다.
감사합니다.
답변 3
2wnwn
2017-06-05 14:31:17
2wnwn 님에 의해 삭제된 답변입니다.
예스스탁 예스스탁 답변
2017-06-05 16:10:47
안녕하세요
예스스탁입니다.
1.
Input: n1(1),n2(1),n3(1),n4(2),n5(2),n6(2),n7(3),n8(3),n9(3),n10(3);
Var: Atrv(0), 매수조건(false), 매도조건(false),vol(0);
Atrv = Atr(50);
if MarketPosition == 0 Then
vol = n1;
if MarketPosition != 0 Then{
if MaxEntries == 1 Then vol = n2;
if MaxEntries == 2 Then vol = n3;
if MaxEntries == 3 Then vol = n4;
if MaxEntries == 4 Then vol = n5;
if MaxEntries == 5 Then vol = n6;
if MaxEntries == 6 Then vol = n7;
if MaxEntries == 7 Then vol = n8;
if MaxEntries == 8 Then vol = n9;
if MaxEntries >= 9 Then vol = n10;
}
If MarketPosition == 0 and 매수조건 then
buy("b",OnClose,def,vol);
If MarketPosition == 0 and 매도조건 then
sell("s",OnClose,def,vol);
if MarketPosition == 1 then{
ExitLong("bx",atlimit,AvgEntryPrice+ATRV*4);
buy("bb",atlimit,LatestEntryPrice(0)-ATRv*3,vol);
}
if MarketPosition == -1 then{
ExitShort("sx",atlimit,AvgEntryPrice-ATRV*4);
sell("ss",atlimit,LatestEntryPrice(0)+ATRv*3,vol);
}
2
Input: n1(1),n2(1),n3(1),k1(0.1),k2(0.5);
Var: Atrv(0), 매수조건(false), 매도조건(false),vol(0);
Atrv = Atr(50);
if MarketPosition == 0 or MarketPosition != MarketPosition[1] Then
vol = n1;
if MarketPosition != 0 Then{
if MaxEntries == 1 Then vol = n2;
if MaxEntries == 2 Then vol = n3;
}
if 매수조건 Then
var1 = C;
if 매도조건 Then
var2 = C;
If MarketPosition == 0 then
buy("b",atlimit,var1-ATRV*3,vol);
If MarketPosition == 0 then
sell("s",atlimit,var1+ATRV*3,vol);
if MarketPosition == 1 then{
if MaxEntries == 1 Then
ExitLong("bx1",AtStop,AvgEntryPrice-ATRV*3);
if MaxEntries == 2 Then
ExitLong("bx2",AtStop,AvgEntryPrice+ATRV*k1);
if MaxEntries == 2 Then
ExitLong("bx3",AtStop,AvgEntryPrice+ATRV*k2);
if MaxEntries < 3 then
buy("bb",AtStop,LatestEntryPrice(0)+ATRv*3,vol);
}
if MarketPosition == -1 then{
if MaxEntries == 1 Then
ExitShort("sx1",AtStop,AvgEntryPrice+ATRV*3);
if MaxEntries == 2 Then
ExitShort("sx2",AtStop,AvgEntryPrice-ATRV*k1);
if MaxEntries == 3 Then
ExitShort("sx3",AtStop,AvgEntryPrice-ATRV*k2);
if MaxEntries < 3 Then
sell("ss",AtStop,LatestEntryPrice(0)-ATRv*3,vol);
}
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 수식 문의
> 시스템식 부탁드립니다.
감사합니다.
예스스탁 예스스탁 답변
2017-06-05 16:14:59
안녕하세요
예스스탁입니다.
해당 수식의 모든 추세선과 색상은 사후적으로 판된되는 내용입니다.
신호가 표시되는 시점이 최초로 음선,양선이 판단되는 시점입니다.
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),처리구분(""),T(0),Color(0);
var:tx1(0),tx2(0);
Array:고점[10,2](0),저점[10,2](0); //가격,위치
처리구분 = "";
If Highest(H,30) == H and lastHiVal <> H and
Lowest(L,30) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,30) == H and lastHiVal <> H Then
처리구분 = "고점처리";
Else If Lowest(L,30) == L and lastLoVal <> L Then
처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
if 고점[2,1] == 0 or (고점[2,1] > 0 and 고점[2,1] < 고점[1,1]) Then{
color = red;
}
TL_SetColor(TL1,color);
if TL_SetColor(TL1,color)>1 then {
}
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = L;
If 저점[1,2] < 고점[1,2] then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
if 저점[2,1] == 0 or (저점[2,1] > 0 and 저점[2,1] > 저점[1,1]) Then{
color = blue;
}
TL_SetColor(TL1,color);
}
}
if color == blue and color != color[1] Then
sell();
if color == red and color != color[1] Then
buy();
즐거운 하루되세요
> 2wnwn 님이 쓴 글입니다.
> 제목 : 초보입니다
> 수고하십니다
아래 수식을 시스템 수식(양선일때 매수 음선일때 매도)으로 요청 합니다
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),처리구분(""),T(0),Color(0);
var:tx1(0),tx2(0);
Array:고점[10,2](0),저점[10,2](0); //가격,위치
처리구분 = "";
If Highest(H,30) == H and lastHiVal <> H and
Lowest(L,30) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,30) == H and lastHiVal <> H Then
처리구분 = "고점처리";
Else If Lowest(L,30) == L and lastLoVal <> L Then
처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
if 고점[2,1] == 0 or (고점[2,1] > 0 and 고점[2,1] < 고점[1,1]) Then
color = red;
TL_SetColor(TL1,color);
if TL_SetColor(TL1,color)>1 then {
}
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = L;
If 저점[1,2] < 고점[1,2] then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
if 저점[2,1] == 0 or (저점[2,1] > 0 and 저점[2,1] > 저점[1,1]) Then
color = blue;
TL_SetColor(TL1,color);
}
}