커뮤니티
수식부탁드림니다
2018-01-16 10:48:51
157
글번호 115809
// data2에서 가상거래를 진행하고 신호를 받아 data1에서 실거래를 진행하려고 합니다.
# Data2 가상진입
Input : shortPeriod(5), longPeriod(20);
value1 = ema(C, shortPeriod);
value2 = ema(C, longPeriod);
If MarketPosition == 0 and CrossUP(value1, value2) Then Buy();
If MarketPosition == 0 and CrossDown(value1, value2) Then Sell();
#Data2 가상청산
Var : RandomStop(0);
If MarketPosition <> 0 and Date <> Date[1] Then
RandomStop = Int(Random(DayIndex[1]+1));
If DayIndex == RandomStop Then{
ExitLong("EL가상청산");
ExitShort("ES가상청산");
}
///////////////////////////////////////////////////////////
// data2 의 c - EntryPrice >= 1 이면 data1 에서 실 매수진입
// data2 의 EntryPrice - c >= 1 이면 data1 에서 실 매도진입
# Data1 실거래 진입
If MarketPosition == 0 and Data2(C) - Data2(EntryPrice) >=1 Then Buy();
If MarketPosition == 0 and Data2(EntryPrice) - Data2(C) >=1 Then Sell();
#Data1 실거래 청산
If MarketPosition <> 0 and Date <> Date[1] Then
RandomStop = Int(Random(DayIndex[1]+1));
If DayIndex == RandomStop Then{
ExitLong("EL랜덤청산");
ExitShort("ES랜덤청산");
}
// Data2 에서 가상거래를 진행하고 실거래는 Data1 하는 수식 완성 부탁합니다.
답변 1
예스스탁 예스스탁 답변
2018-01-17 09:40:49
안녕하세요
예스스탁입니다.
Input : shortPeriod(5), longPeriod(20);
var : V1(0,data2),V2(0,data2),RandomStop2(0,data2),P2(0,data2),E2(0,data2);
var : RandomStop1(0,data1);
v1 = data2(ema(C, shortPeriod));
v2 = data2(ema(C, longPeriod));
If P2 == 0 and CrossUP(v1, v2) Then
{
P2 = 1;
E2 = data2(C);
}
If P2 == 0 and CrossDown(v1, v2) Then
{
P2 = -1;
E2 = data2(C);
}
If MarketPosition <> 0 and data2(Date <> Date[1]) Then
RandomStop2 = data2(Int(Random(DayIndex[1]+1)));
If data2(DayIndex == RandomStop2) Then
P2 = 0;
If MarketPosition == 0 and P2 == 1 and Data2(C) >= E2+1 Then Buy();
If MarketPosition == 0 and P2 == -1 and Data2(C) <= E2-1 Then Sell();
#Data1 실거래 청산
If MarketPosition <> 0 and data1(Date <> Date[1]) Then
RandomStop1 = data1(Int(Random(DayIndex[1]+1)));
If data1(DayIndex == RandomStop1) Then{
ExitLong("EL랜덤청산");
ExitShort("ES랜덤청산");
}
즐거운 하루되세요
> gigi 님이 쓴 글입니다.
> 제목 : 수식부탁드림니다
> // data2에서 가상거래를 진행하고 신호를 받아 data1에서 실거래를 진행하려고 합니다.
# Data2 가상진입
Input : shortPeriod(5), longPeriod(20);
value1 = ema(C, shortPeriod);
value2 = ema(C, longPeriod);
If MarketPosition == 0 and CrossUP(value1, value2) Then Buy();
If MarketPosition == 0 and CrossDown(value1, value2) Then Sell();
#Data2 가상청산
Var : RandomStop(0);
If MarketPosition <> 0 and Date <> Date[1] Then
RandomStop = Int(Random(DayIndex[1]+1));
If DayIndex == RandomStop Then{
ExitLong("EL가상청산");
ExitShort("ES가상청산");
}
///////////////////////////////////////////////////////////
// data2 의 c - EntryPrice >= 1 이면 data1 에서 실 매수진입
// data2 의 EntryPrice - c >= 1 이면 data1 에서 실 매도진입
# Data1 실거래 진입
If MarketPosition == 0 and Data2(C) - Data2(EntryPrice) >=1 Then Buy();
If MarketPosition == 0 and Data2(EntryPrice) - Data2(C) >=1 Then Sell();
#Data1 실거래 청산
If MarketPosition <> 0 and Date <> Date[1] Then
RandomStop = Int(Random(DayIndex[1]+1));
If DayIndex == RandomStop Then{
ExitLong("EL랜덤청산");
ExitShort("ES랜덤청산");
}
// Data2 에서 가상거래를 진행하고 실거래는 Data1 하는 수식 완성 부탁합니다.