답변완료
문의 드립니다
input : starttime(160000),endtime(60000),n(30);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0);
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;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
input : 익절틱수(60),손절틱수(15);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Sell("s",AtStop,NextBarOpen+PriceScale*10);
}
}
ExitShort("sx",AtMarket);
if NextBarOpen != C Then
{
Sell("s1",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx1",AtMarket);
if NextBarOpen != C Then
{
Sell("s3",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx3",AtMarket);
if NextBarOpen == C Then
{
Sell("s4",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx4",AtMarket);
if NextBarOpen == C Then
{
Sell("s5",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx5",AtMarket);
if NextBarOpen == C Then
{
Sell("s6",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx6",AtMarket);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 수식어를 120분봉 매매에 사용중입니다.
익절 하나하나의 합이 300틱일때 매매정지가 가능한 수식어를
추가할 수 있는지 문의 드립니다.
2023-01-25
805
글번호 165602
시스템
답변완료
문의드립니다
수고가 많으십니다.
예스랭귀지 초보인지라 몇가지 문의를 드리고자 합니다.
1-1. 당일과 전일의 주요 지표값 등 출력
①당일 시가
②당일 고가
③당일 저가
④당일 중앙선(당일 저점과 당일 고점의 중간값)
⑤전일 시가
⑥전일 고가
⑦전일 저가
⑧전일 중앙선
⑨전일 종가
를 차트에 선으로 출력하고, 당일 시가, 당일 고가 등등으로 표식도 함께 출력하고 싶습니다.
⑩파라볼릭(종가) ==> 기본지표에 있는 파라볼릭(종가)임
⑪ 5 이평선
⑫ 20 이평선
⑬ 60 이평선
⑭ 120 이평선
은 텍스트 표식없이 함께 출력하고싶습니다.
(파라볼릭은 원본 그대로 캔들주변의 작은 점으로 표기하되, 색상과 두께 조절이 가능하게, 변수인 af 와 maxAf 는 변수편집 기능까지 가능하게)
(5/10/20/60/120 기본 이평선은 필요시 10, 30, 200 이평선 등등으로 이평선을 조정할 수 있도록 변수? 취급하여 편집기능까지)
== > 결론: 위의 지표들을 하나의 세트로 묶고자 함
1-2. 위 "1-1" 의 당일/전일 주요 지표값 등의 전부를
"지표속성"의 "차트표시"에서 체크박스로 만들어서 선택적으로 출력하고 싶고,
라인색과 두께도 함께 조절하고 싶습니다.
2-1. 당일과 전일의 일봉/주봉/월봉 값을 차트에 출력하고 싶습니다.
①"틱"차트에서 당일의 일봉(5일, 10일, 20일, 60일, 120일, 200일)
주봉(5주, 10주, 20주, 60주, 120주, 200주)
월봉(5월, 10월, 20월, 60월, 120월, 200월)
②"분"차트에서 당일의 일봉(5일, 10일, 20일, 60일, 120일, 200일)
주봉(5주, 10주, 20주, 60주, 120주, 200주)
월봉(5월, 10월, 20월, 60월, 120월, 200월)
==> 위 2-1의 ①, ② 경우, 차트 우측에 5일, 10일, 20일.... 5주, 10주, 20주.. 5월, 10월 20월... 등의 표식도 함께 출력하고 싶습니다.
2-2. 아울러 앞의 사례와 마찬가지로,
일봉(5일, 10일, 20일, 60일, 120일, 200일)/ 주봉(5주, 10주, 20주, 60주, 120주, 200주)/ 월봉(5월, 10월, 20월, 60월, 120월, 200월) 값을
"지표속성"의 "차트표시"에서 체크박스로 만들어서 선택적으로 출력하고 싶고,
라인색과 두께도 함께 조절하고 싶습니다.
3-1. 그리고 끝으로 저번 80428 에 대한 추가 질의를 드리고자 합니다.
원 질의(80428)에서 "3-1" 실행시 에러가 나는데요..
(첨부된 그림 화일 참조)
[답변 내용중 일부 발췌]
3-1
아래 구조로 식을 작성하시면
10시15분에 시작해서 03시 50분 청산하게 됩니다.
input : ntime(101500),EndTime(35000);
var : Tcond(false);
====> 여기서 첫줄. input문을
input : StartTime(101500),EndTime(035000);
이렇게 수정하니 에러가 안나는데..
이렇게 수정해서 사용하는게 맞는거죠? ^^
3-2. 아울러 답변으로 올려주신 수식은 다 잘 되는데.. 가끔 "0틱 수익"이 찍힙니다. 이건 어떻게 잡아야 될까요?
2023-09-06
992
글번호 165601
지표
답변완료
텍스트 위치
input : Period(110);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
var : box(0),box1(0);
Plot1(0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
box = box_new(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Lime);
Box_SetFill(box,true,40);
Text_SetSize(tx,25);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = text_new(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,30);
Text_SetBold(tx,1);
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date22 = date[0];
time22 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
Text_SetSize(tx,25);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = text_new(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,30);
Text_SetBold(tx,1);
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
1.박스 크기 숫자 표시 위치를 왼쪽으로 약간만 더 옮길수 있나요? setstyle 조정으로는 한계가 있네요.
2.바로 직전 상승박스를 돌파하는 새로운 상승 박스가 나오면, 돌파한 만큼의 폭을 그때 그때 수정하면서 직전 상승박스 상단 크기 표기된 숫자 위에 포개서 추가로 같이 표기.
하향돌파하면 반대로 바로 직전 하락박스 하단의 크기 표시 밑에 포개서 추가로 같이 표기. 감사합니다
2023-01-20
702
글번호 165596
지표
답변완료
수식 변환 문의
수고 하십니다.
아래 수식 변환 부탁드립니다.
수고하세요...
####################
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MensaTrader
//@version=5
indicator("Pivot Order Blocks", shorttitle="Pivot - OB", overlay=true, max_bars_back=500, max_boxes_count=250)
//Titles
inputGroupTitle = "=== Pivots ==="
plotGroupTitle = "=== Plots ==="
//Inputs
source = input.string("Wicks", options=['Wicks','Bodys'], title="Source", group=inputGroupTitle)
leftLenH = input.int(title="Pivot High", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle)
rightLenH = input.int(title="/", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle)
leftLenL = input.int(title="Pivot Low", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle)
rightLenL = input.int(title="/", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle)
boxLength = input.int(30, title="Box Size", tooltip="Amount of candles long", group=plotGroupTitle)
bullBoxColor = input.color(color.new(#00E600,90), title="Bullish Box Color", group=plotGroupTitle, inline="1")
bearBoxColor = input.color(color.new(#FF0000,90), title="Bearish Box Color", group=plotGroupTitle, inline="1")
//Wick / Body option
phOption = source == "Wicks" ? high : close
plOption = source == "Wicks" ? low : close
ph = ta.pivothigh(phOption,leftLenH, rightLenH)
pl = ta.pivotlow(plOption,leftLenL, rightLenL)
//Variables
var leftBull = bar_index
var rightBull = bar_index
var topBull = close
var bottomBull = close
var leftBear = bar_index
var rightBear = bar_index
var topBear = close
var bottomBear = close
//Bear Box Calc
if ph
leftBear := bar_index-leftLenH
rightBear := bar_index-(leftLenH-boxLength)
topBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenH] : open[leftLenH]) : high[leftLenL]
bottomBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenH] : close[leftLenH]) : close[leftLenL] > open[leftLenL] ? close[leftLenL] : open[leftLenL]
//Bull Box Calc
if pl
leftBull := bar_index-leftLenL
rightBull := bar_index-(leftLenL-boxLength)
topBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenL] : open[leftLenL]) : close[leftLenL] > open[leftLenL] ? open[leftLenL] : close[leftLenL]
bottomBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenL] : close[leftLenL]) : low[leftLenL]
plotshape(pl, offset=-25)
if pl
bull = box.new(left=leftBull, right=rightBull, top=topBull, bottom=bottomBull, bgcolor=color.new(bullBoxColor,80), border_color=bullBoxColor)
if ph
bear = box.new(left=leftBear, right=rightBear, top=topBear, bottom=bottomBear, bgcolor=color.new(bearBoxColor,80), border_color=bearBoxColor)
2023-01-19
882
글번호 165594
지표