답변완료
[지표] 동일한 봉에서 중복 수행을 방지하는 방법 문의
사용자가 입력해 놓은 가격에 도달하면 알람이 울리도록 지표를 만들어봤습니다.
한번 알람이 울리면 동일한 봉인 경우에는 다시 울리게 하고 싶지 않은데,
아래처럼 코딩을 했는데, 동일봉 알람방지를 하려고 해도 계속 알람이 울립니다.
어떻게 수정해야 할까요?
Input : 알람가격1(1.1240), 동일봉_알람방지(1);
var : SavedBarIndex(0), cnt(0);
plot1(알람가격1,"알람선1");
If ((C[1] < 알람가격1 And C >= 알람가격1) Or (C[1] > 알람가격1 And C <= 알람가격1)) Then {
If ((동일봉_알람방지==1 And SavedBarIndex != GloBalBarIndex) Or 동일봉_알람방지==0) Then {
cnt = cnt + 1;
MessageLog("[%.0f] #1 SavedBarIndex %.0f GloBalBarIndex %.0f ", cnt, SavedBarIndex, GloBalBarIndex);
SavedBarIndex = GloBalBarIndex;
MessageLog("[%.0f] #2 SavedBarIndex %.0f GloBalBarIndex %.0f ", cnt, SavedBarIndex, GloBalBarIndex);
PlaySound("C:₩Trade_Program₩eFriend Global YesTrader₩efriendglobalyestrader₩data₩Sound₩Stop.wav");
}
}
2023-08-03
654
글번호 171164
지표
답변완료
재문의
질문1)
답변 내용에서
ii 관련 변수 N(5)는 어떤 내용인가요?
입력시간 발생봉과 상관있는지요.
질문2)
input: 연속봉(1),연속small(0.52),연속large(0.56);
if data2(accumN(iff(C>O,1,0),연속봉) == 연속봉 and ExitDate(1) != sdate and AccumN(abs(C-O), 연속봉) >= 연속small and AccumN(abs(C-O), 연속봉) < 연속large) then
buy();
이 내용에 입력시간 발생봉부터 계산하다는 내용을 추가해 주십시요.
처음부터 이렇게 질문 드렸어야 했는데 죄송합니다.
******************************************************************************
안녕하세요
예스스탁입니다.
1
input : N(5),ntime(10000);
var : K(0,data2),Tcond(False,Data2),ii(0,Data2);
k=data2(c)+data3(c);
if Data2(Bdate != Bdate[1]) Then
Tcond = true;
if Data2((sdate != sdate[1] and stime >= ntime) or
(sdate == sdate[1] and stime >= ntime and stime[1] < ntime)) Then
{
Tcond = False;
ii = 0;
}
if Tcond == true Then
{
ii = ii +1;
if ii == N and data2(CountIf(K>0,5) == 5 and AccumN(K,5) >= 1000 and AccumN(K,5) <= 2000) Then
Buy();
}
2
input : N(5),ntime(10000);
var : Tcond(False,Data2),ii(0,Data2);
if Data2(Bdate != Bdate[1]) Then
Tcond = true;
if Data2((sdate != sdate[1] and stime >= ntime) or
(sdate == sdate[1] and stime >= ntime and stime[1] < ntime)) Then
{
Tcond = False;
ii = 0;
}
if Tcond == true Then
{
ii = ii +1;
if ii == N and data2(CountIf(c>0,5) == 5 and AccumN(c,5) >= 10 and AccumN(c,5) <= 20) Then
Buy();
}
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 연속봉 문의
> 데이트레이딩
국내선물
요청1) 입력한 시간에 발생한 봉부터 계산
k=data2(c)+data3(c);
if 10시에 k의 양봉이 5연속 발생하고 5연속봉의 총합이 1000 보다 크고 2000 보다 작다 then
buy();
요청2) 입력한 시간에 발생한 봉부터 계산
if 10시에 data2(c)의 양봉이 5연속 발생하고 5연속봉의 총합이 10 보다 크고 20 보다 작다 then
buy();
수식 완성 부탁드립니다.
항상 고맙습니다.
2023-08-03
621
글번호 171163
시스템
답변완료
수식 변환 좀 해주세요.
//@version=5
indicator("Stochastic Momentum Index", "SMI", timeframe = "", timeframe_gaps = true)
lengthK = input.int(10, "%K Length", minval = 1, maxval = 15000)
lengthD = input.int(3, "%D Length", minval = 1, maxval = 4999)
lengthEMA = input.int(3, "EMA Length", minval = 1, maxval = 4999)
emaEma(source, length) => ta.ema(ta.ema(source, length), length)
highestHigh = ta.highest(lengthK)
lowestLow = ta.lowest(lengthK)
highestLowestRange = highestHigh - lowestLow
relativeRange = close - (highestHigh + lowestLow) / 2
smi = 200 * (emaEma(relativeRange, lengthD) / emaEma(highestLowestRange, lengthD))
smiPlot = plot(smi, "SMI", color = color.blue)
plot(ta.ema(smi, lengthEMA), "SMI-based EMA", color = color.orange)
overbought = hline(40, "Overbought Line")
oversold = hline(-40, "Oversold Line")
fill(overbought, oversold, color = color.new(color.blue, 90))
hline(0, "Middle Line", color = color.new(color.gray, 50))
midLinePlot = plot(0, color = na, editable = false, display = display.none)
fill(smiPlot, midLinePlot, 120, 40, top_color = color.new(#4caf4f, 50), bottom_color = color.new(color.green, 100), title = "Overbought Gradient Fill")
fill(smiPlot, midLinePlot, -40, -120, top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 50), title = "Oversold Gradient Fill")
트레이딩 뷰 지표인데 예스로 좀 변환 해주세요.
2023-08-03
1005
글번호 171161
지표