답변완료
문의 드립니다
input: length(21),hh(8),mult(2),k(2);
var: src(0),n(0),tx(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0);
src = close;
n = BarIndex;
sum = 0;
For i = 0 to length-1
{
sum = 0;
sumw =0;
For j = 0 to length-1
{
w = exp(-(pow(i-j,2)/(hh*hh*2)));
sum = sum+src[j]*w;
sumw = sumw+w;
}
y2 = sum/sumw;
sume = sume+abs(src[i]-y2);
}
mae = sume/length*mult;
if CrossDown(src,y2+mae) Then
{
tx = text_new(sDate,sTime,h,"▼");
Text_SetStyle(tx,2,1);
Text_Setcolor(tx,red);
}
if Crossup(src,y2-mae) Then
{
tx = text_new(sDate,sTime,l,"▲");
Text_SetStyle(tx,2,0);
Text_Setcolor(tx,green);
}
Plot1(y2,"상한",Red);
plot2(y2+mae,"중심",Black);
plot3(y2-mae,"하한",blue);
위 수식에서 plot2와 plot3 가 나오지 않습니다
mae를 구하는 수식에서 문제가 있는 것 같은데 좀 확인해 주시길 바랍니다
2023-12-06
729
글번호 174607
지표
답변완료
손절식 수정 문의 드립니다.
항상 많은 도움 감사드립니다. 아래와 같이 시스템 식을 작성하였는데 생각대로 작동하지 않는 부분이 있어서 수정 문의 드립니다.
Q&A 관리자 분의 도움으로 아래와 같이 작성을 하였는데요..
MarketPosition == -1 매도 포지션 일때는 stoploss가 제대로 작동하는데
MarketPosition == 1 매수 포지션 일때 stoploss 가 작동을 하지 않습니다.
어떤 부분을 수정해야 하나요? 혹은 다른 시스템식으로 작성을 하여야 하나요?
매도,매수 모두 분할청산 및 청산은 문제없이 작동합니다.
///////////////////////////////////////////////////////////////
if MarketPosition == 1 Then
{
if IsEntryName("A매수") == true Then
{
ExitLong("Sp1",AtLimit,EntryPrice+20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
ExitLong("A매수정리",atmarket,def,"A매수");
}
if IsEntryName("b매수") == true Then
{
ExitLong("Sp2",AtLimit,EntryPrice+10,"",1,1);
SetStopLoss(10,PointStop);
if A-1 Then
ExitLong("B매수정리",atmarket,def,"B매수");
}
}
Else
SetStopLoss(0);
////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 Then
{
if IsEntryName("A매도") == true Then
{
Exitshort("Bp1",AtLimit,EntryPrice-20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
Exitshort("A매도정리",atmarket,def,"A매도");
}
if IsEntryName("b매도") == true Then
{
Exitshort("Bp2",AtLimit,EntryPrice-10,"",1,1);
SetStopLoss(10,PointStop);
if B-1 Then
ExitLong("B매도정리",atmarket,def,"B매도");
}
}
Else
SetStopLoss(0);
2023-12-05
611
글번호 174602
시스템