커뮤니티
부탁드립니다.
2015-06-14 14:26:50
87
글번호 87180
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
Sell();
}
{
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then{
ExitLong();
}
}
{
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then{
ExitShort();
}
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
1. 상기식에서 61줄 18열에 <file end> 에러 메시지가 뜨는데...
해결이 안되네요.. 부탁드립니다.(혹 다른부분이 틀린부분이 있으면 수정부탁드립니다.
( 시간을 넣지않으면 정상적으로 적용이되는데...괄호가 안되네요.)
2. 상기식에서 pointstop으로 익절되었을경우에 한하여.
2-1. 다른진입신호( 만약,매수라면 진입신호 3가지중 하나라도 매도포지션으로
바뀌었다 다시매수) 나 반대신호가 나오기전에는 같은 방향의 진입금지.
2-2. 익절후 봉 3개를 기다렸다가 진입신호 발생 ( 같은 방향 관계없이)
3-3. 청산후 진입은 음봉매수,양봉매도로 진입신호 발생 (같은 방향 관계없이)
( 청산은 조건만족시 즉시)
공히 따로 작성부탁드립니다.(전문으로) - 괄호치기가 제대로 안되어서요.
미리감사드립니다.
답변 1
예스스탁 예스스탁 답변
2015-06-15 11:14:44
안녕하세요
예스스탁입니다.
1.
작상하신식 괄호의 위치에 따라 식내용이 달라집니다.
Econd와 시간조건이 진입에만 포한되게 했습니다.
INPUT : 익절틱수(10);
var :NP(0),PreNP(0),Econd(false);
var : daypl(0),SMIv(0),t(0),SonarSig(0);
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
}
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
Sell();
}
}
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then
ExitLong();
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then
ExitShort();
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
2.-1
INPUT : 익절틱수(10);
var :NP(0),PreNP(0),Econd(false);
var : daypl(0),SMIv(0),t(0),SonarSig(0),entry(0);
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if stime == 090000 or (stime > 090000 and stime[1] < 090000) Then
Entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entry = Entry+1;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
}
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == -1) and
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == false) or
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == true and
countif(C <var1 or SonarSig < SonarSig[1] or T == -1,BarsSinceExit(1)) >= 1) Then
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == 1) and
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == false) or
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == true and
countif(C > var1 or SonarSig > SonarSig[1] or T == 1,BarsSinceExit(1)) >= 1) Then
Sell();
}
}
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then
ExitLong();
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then
ExitShort();
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
2-2
INPUT : 익절틱수(10);
var :NP(0),PreNP(0),Econd(false);
var : daypl(0),SMIv(0),t(0),SonarSig(0),entry(0);
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if stime == 090000 or (stime > 090000 and stime[1] < 090000) Then
Entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entry = Entry+1;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
}
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == -1) and
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == false) or
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == true and BarsSinceExit(1) >= 3) Then
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == 1) and
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == false) or
(entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == true and BarsSinceExit(1) >= 3) Then
Sell();
}
}
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then
ExitLong();
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then
ExitShort();
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
3-3
INPUT : 익절틱수(10);
var :NP(0),PreNP(0),Econd(false);
var : daypl(0),SMIv(0),t(0),SonarSig(0),entry(0);
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if stime == 090000 or (stime > 090000 and stime[1] < 090000) Then
Entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entry = Entry+1;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
}
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
Sell();
}
if entry >= 1 and MarketPosition == 0 and IsExitName("StopProfittarget",1) == true Then{
if C > O Then
buy();
if C < O Then
sell();
}
}
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then
ExitLong();
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then
ExitShort();
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
즐거운 하루되세요
> vmfha 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
# 매수/매도청산
If C > var1 and SonarSig > SonarSig[1] and T == 1 Then
{
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and T == -1 Then
{
Sell();
}
{
if MarketPosition == 1 and C < var1 and SonarSig < SonarSig[1] Then{
ExitLong();
}
}
{
if MarketPosition == -1 and C > var1 and SonarSig > SonarSig[1] Then{
ExitShort();
}
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
1. 상기식에서 61줄 18열에 <file end> 에러 메시지가 뜨는데...
해결이 안되네요.. 부탁드립니다.(혹 다른부분이 틀린부분이 있으면 수정부탁드립니다.
( 시간을 넣지않으면 정상적으로 적용이되는데...괄호가 안되네요.)
2. 상기식에서 pointstop으로 익절되었을경우에 한하여.
2-1. 다른진입신호( 만약,매수라면 진입신호 3가지중 하나라도 매도포지션으로
바뀌었다 다시매수) 나 반대신호가 나오기전에는 같은 방향의 진입금지.
2-2. 익절후 봉 3개를 기다렸다가 진입신호 발생 ( 같은 방향 관계없이)
3-3. 청산후 진입은 음봉매수,양봉매도로 진입신호 발생 (같은 방향 관계없이)
( 청산은 조건만족시 즉시)
공히 따로 작성부탁드립니다.(전문으로) - 괄호치기가 제대로 안되어서요.
미리감사드립니다.
다음글