커뮤니티
목표수익 달성 후 진입제한식 부탁드립니다.
2015-07-05 23:16:30
165
글번호 88005
오일을 거래하는 시스템을 만들려고 합니다.
거래시간중 청산하고 나서 누적수익이 15틱 이상이거나 3번연속 손절이 나가면 거래중지를 하고 싶습니다.
수식 수정 부탁드립니다.
Input : shortPeriod(5), longPeriod(20), period(15);
Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
value3 = ma(C, Period);
Value4 = C/Value1*100;
Value5 = PositionProfit;
condition2 = IsExitName("stoploss",1);
condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1);
if condition3==true then
{
If condition2 == false
then
{IF 매수조건
Then
Buy("매수");
}
Else
{
IF BarsSinceExit(1) >= 3 and 매수조건
Then
Buy("매수진입");
}
IF BarsSinceEntry > 3 and 청산조건
Then
ExitLong("매도");
}
SetStopTrailing(0.1,0.35,PointStop);
SetStopLoss(0.10,PointStop);
# 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다.
if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then
{
exitlong();
}
답변 1
예스스탁 예스스탁 답변
2015-07-06 15:10:37
안녕하세요
예스스탁입니다.
Input : shortPeriod(5), longPeriod(20), period(15);
Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000);
var : entry(0),NP(0),PreNP(0),dayPL(0),Xcond(false);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
value3 = ma(C, Period);
Value4 = C/Value1*100;
Value5 = PositionProfit;
condition2 = IsExitName("stoploss",1);
condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1);
NP = 0;
if stime == 시작시간1 or (stime >= 시작시간1 and stime[1] < 시작시간1) then{
entry = 0;
PreNP = NP[1];
}
dayPL = NP-preNP;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
Xcond = entry >= 3 and MarketPosition == 0 and IsExitName("StopLoss",1) and IsExitName("StopLoss",2) and IsExitName("StopLoss",3);
if condition3==true and Xcond == false and dayPL < PriceScale*15 then
{
If condition2 == false
then
{IF 매수조건
Then
Buy("매수");
}
Else
{
IF BarsSinceExit(1) >= 3 and 매수조건
Then
Buy("매수진입");
}
IF BarsSinceEntry > 3 and 청산조건
Then
ExitLong("매도");
}
SetStopTrailing(0.1,0.35,PointStop);
SetStopLoss(0.10,PointStop);
# 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다.
if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then
{
exitlong();
}
즐거운 하루되세요
> 참새사냥꾼 님이 쓴 글입니다.
> 제목 : 목표수익 달성 후 진입제한식 부탁드립니다.
> 오일을 거래하는 시스템을 만들려고 합니다.
거래시간중 청산하고 나서 누적수익이 15틱 이상이거나 3번연속 손절이 나가면 거래중지를 하고 싶습니다.
수식 수정 부탁드립니다.
Input : shortPeriod(5), longPeriod(20), period(15);
Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
value3 = ma(C, Period);
Value4 = C/Value1*100;
Value5 = PositionProfit;
condition2 = IsExitName("stoploss",1);
condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1);
if condition3==true then
{
If condition2 == false
then
{IF 매수조건
Then
Buy("매수");
}
Else
{
IF BarsSinceExit(1) >= 3 and 매수조건
Then
Buy("매수진입");
}
IF BarsSinceEntry > 3 and 청산조건
Then
ExitLong("매도");
}
SetStopTrailing(0.1,0.35,PointStop);
SetStopLoss(0.10,PointStop);
# 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다.
if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then
{
exitlong();
}