답변완료
수식문의드립니다
안녕하세요~
시스템을 작성하였는데
피라미딩을 할 때 진입 이후 2번째 봉에서 신호 발생시 피라미딩 진입이 이뤄지지 않고
세번째 봉부터는 정상적으로 진입되는데 원인을 못찾겠어 문의드립니다
감사합니다
----------------------------------------------------------
input : TT1(81000), TD1(20220905), TT2(92500), TD2(20220905), MDD(100000);
var : BS1(False), SS1(False), BS2(False), SS2(False), unitP(0);
var : HB(0), LB(0), rHB(0), rLB(0), exitC(0), N(0), e60(0);
N = ATr(14);
unitP = floor(MDD/(2*N*BigPointValue*1400));
exitC = (2-(MaxEntries-1)/2)*N;
e60 = Ema(C,40);
if sDate >= TD1 && sTime > TT1 Then condition11 = true;
if sDate >= TD2 && sTime > TT2 Then condition11 = False;
//if condition11 == true Then
if (macd(5,20) > 0 && macd(5,40) > 0 && macd(20,40) > 0) && (CrossUp(macd(5,20),0) or CrossUp(macd(5,40),0) or CrossUp(macd(20,40),0)) Then BS1 = true;
Else BS1 = False;
if (macd(5,20) < 0 && macd(5,40) < 0 && macd(20,40) < 0) && (CrossDown(macd(5,20),0) or CrossDown(macd(5,40),0) or CrossDown(macd(20,40),0)) Then SS1 = true;
else SS1 = False;
if (BS1 == True or BS2 == TRUE) && marketposition == 0 Then Buy("b1", OnClose, Def, unitP);
if MarketPosition[1] == 0 && MarketPosition == -1 Then HB = EntryPrice;
if (SS1 == True or SS2 == TRUE) && marketposition == 0 Then Sell("s1", OnClose, Def, unitP);
if MarketPosition[1] == 0 && MarketPosition == -1 Then LB = EntryPrice;
if marketposition ==1 Then
{
rHB = Highest(H, BarsSinceEntry+1) ;
if rHB < HB+0.5*N Then
Buy("b2.",AtStop,HB+0.5*N,unitP);
if rHB < HB+N Then
Buy("b3.",AtStop,HB+N,unitP);
if rHB < HB+1.5*N Then
Buy("b4.",AtStop,HB+1.5*N,unitP);
if e60 < HB+2*N Then
Exitlong("exitB1", atstop, HB-exitC);
if e60 >= HB+2*N and CrossDown(close, e60) Then
{
ExitLong("exitB2") ;
}
}
if marketposition == -1 Then
{
rLB = Lowest(L, BarsSinceEntry+1);
if rLB > LB-0.5*N Then
Sell("s2.",AtStop,LB-0.5*N,unitP);
if rLB > LB-N Then
Sell("s3.",AtStop,LB-N,unitP);
if rLB > LB-1.5*N Then
Sell("s4.",AtStop,LB-1.5*N,unitP);
if e60 > LB-2*N Then
ExitShort("exitS1", atstop, LB+exitC);
if e60 <= LB-2*N and CrossUp(close, e60) Then
{
ExitShort("exitS2");
}
}
if (macd(5,20) > 0 && macd(5,40) > 0 && macd(20,40) > 0) && PositionProfit[1] < 0 Then BS2 = true;
Else BS2 = False;
if (macd(5,20) < 0 && macd(5,40) < 0 && macd(20,40) < 0) && PositionProfit[1] < 0 Then SS2 = true;
Else SS2 = False;
MessageLog("Mp %.4f, HB %.4f, ep %.4f", MarketPosition, HB, EntryPrice);
2022-09-06
1289
글번호 162013
시스템
답변완료
수정부탁드립니다.
작성해주신 수식에서, 특정시간 외 시간은 표기하지 않기 위해 noplot 적용하였는데,
정상 작동하지 않아 문의 드립니다. 첨부사진 처럼 1개의 값만 표기됩니다.
input : StartTime(223200),EndTime(045800);
var : Tcond(false),hv(0),oo(0),hh(0),ll(0),cc(0);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
hv = 0;
}
if Tcond == true Then
{
if v > hv Then
{
hv = v;
oo = o;
hh = h;
ll = l;
cc = c;
}
Plot1(oo,"O");
Plot2(hh,"H");
plot3(ll,"L");
Plot4(cc,"C");
}
else
NoPlot(1);
NoPlot(2);
NoPlot(3);
NoPlot(4);
2022-09-05
1824
글번호 162004
지표