답변완료
수정 부탁드립니다
안녕하세요
아래의 수식을 수정 부탁드립니다.
수정사항은 파동선이 바뀔때 즉 파동선이 위로향하면 주황, 아래로 향하면 파랑
그리고 표현이 될지 모르나 아래에서 위로 , 위에서 아래로 바뀌기전의 중간상황은
녹색으로 표시를 하는데 챠트 하단에 막대 그래프로 표시하고 싶습니다.
글로 표현하자니 제대로 전달될는지 모르겠습니다
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),
TL_Val1(0),TL_Val2(0);
Array:고점[10,2](0),저점[10,2](0);
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,WHITe);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 1, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
TL_SetExtLeft(TL2,false);
TL_SetExtRight(TL2,false);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL2,BLUE);
TL_SetExtLeft(TL2,true);
TL_SetExtRight(TL2,true);
}
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = L;
If 저점[1,2] < 고점[1,2] Then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,blue);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 1, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
TL_SetExtLeft(TL3,false);
TL_SetExtRight(TL3,false);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL3,GREEn);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,0.5);
TL_SetSize(TL2,0.5);
TL_SetSize(TL3,0.5);
TL_Val1 = 0; TL_Val2 = 0;
If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] Then
{
If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then
TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1];
If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then
TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1];
}
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] Then
{
If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then
TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1];
If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then
TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1];
}
2022-03-09
891
글번호 157051
지표
답변완료
문의 드립니다
수고 많으십니다
첨부한 수식 중 매수신호봉 저가기준 손절 20틱(레드선), 익절50틱(블루선) 라인
매도신호봉 고가기준 손절20(레드선)틱, 익절50틱(블루선) 라인
부탁드립니다
감사합니다~
input : 전환선기간(9),기준선기간(26),선행스팬2기간(52),시작시간(080000),종료시간(220000);
Var : 기준선(0), 전환선(0), 선행스팬1(0), 선행스팬2(0),구름상단(0),구름하단(0),Tcond(false);
전환선 = (Highest(H, 전환선기간) + Lowest(L, 전환선기간)) / 2;
기준선 = (Highest(H, 기준선기간) + Lowest(L, 기준선기간)) / 2;
선행스팬1 = (전환선[25] + 기준선[25]) / 2 ;
선행스팬2 = (Highest(H, 선행스팬2기간)[25] + Lowest(L, 선행스팬2기간)[25]) / 2;
구름상단 = max(선행스팬1,선행스팬2);
구름하단 = Min(선행스팬1,선행스팬2);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
Tcond = true;
if (sdate != sdate[1] and stime >= 종료시간) or
(sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true then{
if crossup(전환선,구름상단) Then
buy();
if CrossDown(전환선,구름하단) Then
sell();
}
input : 틱(20);
var : RR(0), TL(0),TX1(0),TX2(0);
if MarketPosition == 1 Then
{
rr = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*틱));
if rr > rr[1] Then{
tx1 = Text_New(sdate,stime,H,NumToStr(RR*틱,0)+"틱");
Text_SetStyle(tx1,1,2);
}
TL_Delete(TL);
TL_New(EntryDate,EntryTime,L[BarsSinceEntry],sdate,stime,L[BarsSinceEntry]);
Text_Delete(Tx2);
tx2 = Text_New(sdate,stime,L[BarsSinceEntry],NumToStr(L[BarsSinceEntry],2));
}
if MarketPosition == -1 Then
{
rr = Floor((EntryPrice-lowest(L,BarsSinceEntry))/(PriceScale*틱));
if rr > rr[1] Then{
tx1 = Text_New(sdate,stime,H,NumToStr(RR*틱,0)+"틱");
Text_SetStyle(tx1,1,2);
}
TL_Delete(TL);
TL_New(EntryDate,EntryTime,H[BarsSinceEntry],sdate,stime,H[BarsSinceEntry]);
Text_Delete(Tx2);
tx2 = Text_New(sdate,stime,H[BarsSinceEntry],NumToStr(H[BarsSinceEntry],2));
}
2022-03-09
1306
글번호 157049
시스템
답변완료
식첨부
input : n(1),x(50);
input : StartTime(80000),EndTime(50000);
Inputs : Period(20), Sence(1.5), CC_DN(Yellow);
Input : 당일수익틱수(100),당일손실틱수(100);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
var : Tcond(false);
Vars:
VLineUp(0),
VLineDn(0),
HHighest(0),
LLowest(0),
JustChanged(FALSE),
VLine(0), DBN(0);
Array:
Highs[35](0),
Lows[35](0),
RRange[35](0),
UpWave[1](FALSE),
DnWave[1](FALSE);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
If STime == 180000 Then
DBN = 0;
DBN = DBN + 1;
Var1 = Period;
Var2 = Var1 - 1;
Var3 = Var1 - 2;
Var5 = Sence;
Var6 = H-L;
JustChanged = FALSE;
if CurrentBar <= Var2 then begin
Highs[CurrentBar] = Close;
Lows[CurrentBar] = Close;
RRange[CurrentBar] = (H-L) /2;
end;
if CurrentBar == Var1 then begin
if Highs[Var2] >= Highs[Var3] then begin
UpWave[1] = TRUE;
HHighest = Highs[Var2];
VLineUp = HHighest - (Var5 * MA(Var6,Var2));
#Plot1(VLineUp,"VLineUp");
end;
if Highs[Var2] < Highs[Var3] then begin
DnWave[1] = TRUE;
LLowest = Lows[Var2];
VLineDn = LLowest + (Var5 * MA(Var6,Var2));
#Plot2(VLineDn,"VLineDn");
end;
end;
if CurrentBar > Var1 then begin
if DnWave[1] and Close > VLineDn then begin
DnWave[1] = FALSE;
UpWave[1] = TRUE;
JustChanged = TRUE;
HHighest = Close;
LLowest = 0;
end;
if UpWave[1] and Close < VLineUp and JustChanged == FALSE then begin
UpWave[1] = FALSE;
DnWave[1] = TRUE;
JustChanged = TRUE;
LLowest = Close;
HHighest = 0;
end;
if JustChanged == FALSE then begin
if Close > HHighest then
HHighest = Close;
else if Close < LLowest then
LLowest = Close;
end;
VLineUp = HHighest - (Var5 * MA(Var6,Var2));
VLineDn = LLowest + (Var5 * MA(Var6,Var2));
/*if UpWave[1] then Plot1(VLineUp,"VLineUp", Red);
else if DnWave[1] then Plot1(VLineDn,"VLineUp", CC_DN);
*/
end;
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
if Tcond == true and Xcond == False Then
{
if CountIf(C>O,n) == n and
H >= L[2]+PriceScale*x and UpWave[1] Then
Buy();
if CountIf(C<O,n) == n and
L <= H-PriceScale*x and DnWave[1] Then
sell();
}
if MarketPosition == 1 then{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
안녕하세요.
위식에서 수정부탁드려요
매수.매도시 다음신호 나올때까지 동일신호 중복 진입금지.
한신호에서 한번만 신호발생 되도록 해 주세요.
예:매수 신호 발생후 매도신호 나올때까지 한번만 신호발생 중복진임금지
매도시 매수신호 발생시까지 한번만 진입.
시작시간 수정시 오후22시면 어떻게 수정 하는지 여부 알려 주세요.
22000으로 수정하니까 적용이 안됨니다.
2022-03-09
1055
글번호 157047
시스템