답변완료
문의
첨부파일은 아래수식의 진입결과입니다.
p1 337, p2 337.5 로 진입가격을 세팅했는데 상승갭 발생이 없을 때는 그 가격대로 체결하지만
상승갭 발생하면 세팅가격과는 다르게 시가로 p1,p2가 동시에 체결합니다.
전일 마지막봉과 무관하게 당일 발생봉부터 계산하여 세팅가격대로 체결할 수 있게 정정해 주시기 바랍니다.
**********************************************************************************
안녕하세요
예스스탁입니다.
IsEntryName은 해당 포지션의 첫진입의 이름입니다.
또한 해당함수가 특정이름의 청산을 의미하지 않습니다.
청산시 특정이름을 청산하고자 하시면
청산함수에 진입명을 지정하시면 됩니다.
input :p1(337),라인1(5);
input :st(120000),p2(337.5),라인2(7.5);
var : cnta(0,Data1),cntb(0,Data1);
if Bdate != Bdate[1] Then
{
cnta = 0;
cntb = 0;
}
if crossup(c,p1) and cnta < 1 then
{
cnta = cnta+1;
Buy("a");
}
if stime>=st and crossup(c,p2) and cntb < 1 then
{
cntb = cntb+1;
Buy("b");
}
if MarketPosition == 1 Then
{
var1 = data2(Floor(DayOpen/라인1)*라인1);
value1 = var1+라인1;
Value2 = var1;
if Data2((Bdate == Bdate[1] and C > value1)) or Data2((Bdate == Bdate[1] and Crossup(c,Value1))) Then
ExitLong("L1",OnClose,Def,"a");
var2 = data3(Floor(DayOpen/라인2)*라인2);
value2 = var2+라인2;
Value3 = var2;
if Data3((Bdate == Bdate[1] and C > value2)) or Data3((Bdate == Bdate[1] and Crossup(c,Value2))) Then
ExitLong("L2",OnClose,Def,"b");
}
즐거운 하루되세요
2024-01-31
886
글번호 176263
시스템
답변완료
문의드립니다.
스윙하이의 전고점을 이어서 하락 추세선을 구하고,
스윙로우의 전저점을 이어서 상승 추세선을 구한 후
하락추세선을 30% 이상 상승 돌파한 이후, 해당 돌파지점의 5% 범위에 종가가 수렴하거나
상승추세선의 5% 범위에 종가가 수렴하는 경우를 검색하려고 합니다.
1. 게시판을 참조해서 아래와 같이 수식을 만들었는데, 제대로 작동할까요?
2. 스윙하이의 기준값은 고가, 종가, 저가 외에, MACD나 Stochastic, RSI 값도 변수로 대입하면 가능한가요?
input : Left(4), Right(4), Period(200);
var : LP(0), LLP(0), LPD(0), LLPD(0), HP(0), HHP(0), HPD(0), HHPD(0), TPS(0),
LPV(0), LLPV(0), HPV(0), HHPV(0),
Target(0), TargetIn(0), TPS1(0), TP1(0);
LP = SwingLow(1,C,Left,Right,Period);
LPD = SwingLowBar(1,C,Left,Right,Period);
if LP != -1 then
LPV = C;
LLP = SwingLow(2,C,Left,Right,Period);
LLPD = SwingLowBar(2,C,Left,Right,Period);
if LLP != -1 then
LPV = C;
HP = SwingHigh(1,C,Left,Right,Period);
HPD = SwingHighBar(1,C,Left,Right,Period);
if HP != -1 then
HPV = C;
HHP = SwingHigh(2,C,Left,Right,Period);
HHPD = SwingHighBar(2,C,Left,Right,Period);
if HHP != -1 then
HHPV = C;
##추세선 기울기
###하락추세선
if HHPV > HPV and (HHPV/HPV)-1 > 0.3 then
{
TPS = (HHPV-HPV)/(HPD-HHPD);
TP = HHPV-(TPS*(Index-HPD));
}
###상승추세선
else if LLPV < LPV and (LPV/LLPV)-1 > 0.3 then
{
TPS1 = (LPV-LLPV)/(LPD-LLPD);
TP1 = LLPV-(TPS1*(Index-LPD));
}
##하락추세선 돌파
if C > TP and (C/TP)-1 > 0.05 then
{
Target = TP;
TargetIn = Index;
}
#검색
if abs((C/TP)-1) <= 0.1 or
abs((C/TP1)-1) <= 0.05 then
Find(1);
2024-01-31
648
글번호 176251
검색
답변완료
문의드립니다
트레이딩뷰 지표인데 변환 부탁드립니다
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// author © KivancOzbilgic
// developer © KivancOzbilgic
//@version=5
indicator('AlphaTrend', shorttitle='AT', overlay=true, format=format.price, precision=2, timeframe='')
coeff = input.float(1, 'Multiplier', step=0.1)
AP = input(14, 'Common Period')
ATR = ta.sma(ta.tr, AP)
src = input(close)
showsignalsk = input(title='Show Signals?', defval=true)
novolumedata = input(title='Change calculation (no volume data)?', defval=false)
upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT
color1 = AlphaTrend > AlphaTrend[2] ? #00E60F : AlphaTrend < AlphaTrend[2] ? #80000B : AlphaTrend[1] > AlphaTrend[3] ? #00E60F : #80000B
k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3)
k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3)
fill(k1, k2, color=color1)
buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2])
sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2])
K1 = ta.barssince(buySignalk)
K2 = ta.barssince(sellSignalk)
O1 = ta.barssince(buySignalk[1])
O2 = ta.barssince(sellSignalk[1])
plotshape(buySignalk and showsignalsk and O1 > K2 ? AlphaTrend[2] * 0.9999 : na, title='BUY', text='BUY', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(#0022FC, 0), textcolor=color.new(color.white, 0))
plotshape(sellSignalk and showsignalsk and O2 > K1 ? AlphaTrend[2] * 1.0001 : na, title='SELL', text='SELL', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.maroon, 0), textcolor=color.new(color.white, 0))
alertcondition(buySignalk and O1 > K2, title='Potential BUY Alarm', message='BUY SIGNAL!')
alertcondition(sellSignalk and O2 > K1, title='Potential SELL Alarm', message='SELL SIGNAL!')
alertcondition(buySignalk[1] and O1[1] > K2, title='Confirmed BUY Alarm', message='BUY SIGNAL APPROVED!')
alertcondition(sellSignalk[1] and O2[1] > K1, title='Confirmed SELL Alarm', message='SELL SIGNAL APPROVED!')
alertcondition(ta.cross(close, AlphaTrend), title='Price Cross Alert', message='Price - AlphaTrend Crossing!')
alertcondition(ta.crossover(low, AlphaTrend), title='Candle CrossOver Alarm', message='LAST BAR is ABOVE ALPHATREND')
alertcondition(ta.crossunder(high, AlphaTrend), title='Candle CrossUnder Alarm', message='LAST BAR is BELOW ALPHATREND!')
alertcondition(ta.cross(close[1], AlphaTrend[1]), title='Price Cross Alert After Bar Close', message='Price - AlphaTrend Crossing!')
alertcondition(ta.crossover(low[1], AlphaTrend[1]), title='Candle CrossOver Alarm After Bar Close', message='LAST BAR is ABOVE ALPHATREND!')
alertcondition(ta.crossunder(high[1], AlphaTrend[1]), title='Candle CrossUnder Alarm After Bar Close', message='LAST BAR is BELOW ALPHATREND!')
2024-01-31
970
글번호 176250
지표