커뮤니티
부탁드립니다.
2015-07-01 21:27:19
131
글번호 87876
var : SonarV(0),SonarSig(0);
var : SMIv(0),T(0);
var : TRIXv(0),TRIXsig(0),entry(0);
var1 = SAR(af,maxAF);
SonarV = SONAR(SonarP);
SonarSig = ema(SonarV,SonarS);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
TRIXv = TRIX(TrixP);
TRIXsig = ema(TRIXv,TrixS);
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
if bdate != bdate[1] Then
entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
Condition1 = MarketPosition(1) == 1 and IsExitName("StopProfittarget",1) == true;
Condition2 = MarketPosition(1) == -1 and IsExitName("StopProfittarget",1) == true;
If C > var1 and SonarSig > SonarSig[1] and TRIXsig > TRIXsig[1] and T == 1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == -1) or
(entry >= 1 and MarketPosition == 0 and Condition1 == false) or
(entry >= 1 and MarketPosition == 0 and Condition1 == true and
countif(C < var1 or SonarSig < SonarSig[1] or TRIXsig < TRIXsig[1] or T == -1,BarsSinceExit(1)) >= 1) Then
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and TRIXsig < TRIXsig[1] and T == -1 Then
{
MessageLog("%s %s %.f",Condition1,Condition2,entry);
if entry == 0 or
(entry >= 1 and MarketPosition == 1) or
(entry >= 1 and MarketPosition == 0 and Condition2 == false) or
(entry >= 1 and MarketPosition == 0 and Condition2 == true and
countif(C > var1 or SonarSig > SonarSig[1] or TRIXsig > TRIXsig[1] or T == 1,BarsSinceExit(1)) >= 1) Then {
Sell();
}
}
if MarketPosition == 1 and C < var1 and TRIXsig < TRIXsig[1] and T == -1 Then{
ExitLong();
}
if MarketPosition == -1 and C > var1 and TRIXsig > TRIXsig[1] and T == 1 Then{
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
1. 상기식에서 진입은 09시에서 새벽 02시까지만 진입이되도록 부탁드립니다.
( 초보라 괄호가 제대로 안맞은지 잘안되네요.ㅠ )
2. 상기식의 매도에 있는 중괄호가 매수에는 없는데...
어떤 의미가 있는건가요? 아님 작성이 안된건가요?
( 신호발생에는 문제는 없는것 같은데 초보라 궁금해서 문의드립니다.)
BarsSinceExit(1)) >= 1) Then {
Sell();
}
답변 1
예스스탁 예스스탁 답변
2015-07-02 15:23:34
안녕하세요
예스스탁입니다.
1.
var : SonarV(0),SonarSig(0);
var : SMIv(0),T(0);
var : TRIXv(0),TRIXsig(0),entry(0);
var1 = SAR(af,maxAF);
SonarV = SONAR(SonarP);
SonarSig = ema(SonarV,SonarS);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
TRIXv = TRIX(TrixP);
TRIXsig = ema(TRIXv,TrixS);
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
if bdate != bdate[1] Then
entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
Condition1 = MarketPosition(1) == 1 and IsExitName("StopProfittarget",1) == true;
Condition2 = MarketPosition(1) == -1 and IsExitName("StopProfittarget",1) == true;
If C > var1 and SonarSig > SonarSig[1] and TRIXsig > TRIXsig[1] and T == 1 and (stime >= 090000 or stime < 020000) Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == -1) or
(entry >= 1 and MarketPosition == 0 and Condition1 == false) or
(entry >= 1 and MarketPosition == 0 and Condition1 == true and
countif(C < var1 or SonarSig < SonarSig[1] or TRIXsig < TRIXsig[1] or T == -1,BarsSinceExit(1)) >= 1) Then
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and TRIXsig < TRIXsig[1] and T == -1 and (stime >= 090000 or stime < 020000) Then
{
MessageLog("%s %s %.f",Condition1,Condition2,entry);
if entry == 0 or
(entry >= 1 and MarketPosition == 1) or
(entry >= 1 and MarketPosition == 0 and Condition2 == false) or
(entry >= 1 and MarketPosition == 0 and Condition2 == true and
countif(C > var1 or SonarSig > SonarSig[1] or TRIXsig > TRIXsig[1] or T == 1,BarsSinceExit(1)) >= 1) Then
Sell();
}
if MarketPosition == 1 and C < var1 and TRIXsig < TRIXsig[1] and T == -1 Then{
ExitLong();
}
if MarketPosition == -1 and C > var1 and TRIXsig > TRIXsig[1] and T == 1 Then{
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
2
어떤 if문에 실행문이 두개 이상일때는 반드시 {}로 묶어 주셔야 합니다.
위 식과 같이 실행문이 하나일때는 {}는 있어도 되고 없어도 됩니다.
즐거운 하루되세요
> vmfha 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> var : SonarV(0),SonarSig(0);
var : SMIv(0),T(0);
var : TRIXv(0),TRIXsig(0),entry(0);
var1 = SAR(af,maxAF);
SonarV = SONAR(SonarP);
SonarSig = ema(SonarV,SonarS);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
TRIXv = TRIX(TrixP);
TRIXsig = ema(TRIXv,TrixS);
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
if bdate != bdate[1] Then
entry = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
Condition1 = MarketPosition(1) == 1 and IsExitName("StopProfittarget",1) == true;
Condition2 = MarketPosition(1) == -1 and IsExitName("StopProfittarget",1) == true;
If C > var1 and SonarSig > SonarSig[1] and TRIXsig > TRIXsig[1] and T == 1 Then
{
if entry == 0 or
(entry >= 1 and MarketPosition == -1) or
(entry >= 1 and MarketPosition == 0 and Condition1 == false) or
(entry >= 1 and MarketPosition == 0 and Condition1 == true and
countif(C < var1 or SonarSig < SonarSig[1] or TRIXsig < TRIXsig[1] or T == -1,BarsSinceExit(1)) >= 1) Then
Buy();
}
# 매도/매수청산
If C < var1 and SonarSig < SonarSig[1] and TRIXsig < TRIXsig[1] and T == -1 Then
{
MessageLog("%s %s %.f",Condition1,Condition2,entry);
if entry == 0 or
(entry >= 1 and MarketPosition == 1) or
(entry >= 1 and MarketPosition == 0 and Condition2 == false) or
(entry >= 1 and MarketPosition == 0 and Condition2 == true and
countif(C > var1 or SonarSig > SonarSig[1] or TRIXsig > TRIXsig[1] or T == 1,BarsSinceExit(1)) >= 1) Then {
Sell();
}
}
if MarketPosition == 1 and C < var1 and TRIXsig < TRIXsig[1] and T == -1 Then{
ExitLong();
}
if MarketPosition == -1 and C > var1 and TRIXsig > TRIXsig[1] and T == 1 Then{
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
1. 상기식에서 진입은 09시에서 새벽 02시까지만 진입이되도록 부탁드립니다.
( 초보라 괄호가 제대로 안맞은지 잘안되네요.ㅠ )
2. 상기식의 매도에 있는 중괄호가 매수에는 없는데...
어떤 의미가 있는건가요? 아님 작성이 안된건가요?
( 신호발생에는 문제는 없는것 같은데 초보라 궁금해서 문의드립니다.)
BarsSinceExit(1)) >= 1) Then {
Sell();
}