답변완료
수식수정
Inputs : Period(20), CC_DN(Yellow);
var : 기준선기간(26);
Vars:
VLineUp(0),
VLineDn(0),
HHighest(0),
LLowest(0),
JustChanged(FALSE),
VLine(0), DBN(0),T(0);
Array:
Highs[35](0),
Lows[35](0),
RRange[35](0),
UpWave[1](FALSE),
DnWave[1](FALSE);
If STime == 180000 Then
DBN = 0;
DBN = DBN + 1;
Var1 = Period;
Var2 = Var1 - 1;
Var3 = Var1 - 2;
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 T = 1;
else if DnWave[1] then T = -1;
end;
Input : 당일수익틱수(100);
input : StartTime(70000),EndTime(55000);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
var : Tcond(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;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
당일수익 = PriceScale*당일수익틱수;
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 t == 1 and C > DayClose(1) Then
Buy();
if t == -1 and C < DayClose(1) Then
Sell();
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
}
안녕하세요
위식을 일봉에 적용결과 일봉상 신호가
매일 나오지 않고 건너뜀
수정
Date 2 추가 30분봉
일봉상 전일 종가 기준선 중심으로
Date2 양봉이고
date 1 시가가 전일종가 보다5틱이상 상승시 매수진입
Date2음봉이고
Dste1
시가가 전일종가 보다 5틱이상 하락시 매도진입.
매수후 장중에 기준선 중심으로
등락시 매수.매도 반복함.
2023-07-09
1487
글번호 170453
시스템
답변완료
현재 사용 수식에 매수 조건 추가 부탁드림니다.
기존 사용 수식
국내주식(삼성전자)
60분봉적용
매수 일봉에서 일정 하락하면 분할 매수 및 수익시 분할 청산하는 수식임
추가로 넣어야할 기능은 다음과 같습니다.
매수 조건
1.일정하락시 분할매수 ( 유지 ) --> 현재 수식 적용중
2.최초 진입한 값에서 10% 15% 20% 25% 30% 35% ..... 등등 일정 하락했을때
각각 10주씩 매수하는 수식을 첨가하고 싶습니다.
(1회성 매수 ) --> 추가로 요청하는 조건
그외 조건은 동일합니다.
수식 추가 부탁드림니다.
-------------기존 사용 수식-------------
input : 시작일(10200216);
input : 이평1(240),이평2(2880);
input : 최대투자금액(2000);
input : 수익퍼센트(8);
var : cond(False),XV(0),vol(0);
var1 = ma(C,이평1);
Var2 = ma(C,이평2);
if Data1(sDate) >= 시작일 Then
{
if
sTime == 140000 and AvgEntryPrice*CurrentContracts < 최대투자금액*10000 Then
{
if c < var1 or c < Var2 Then # 분봉 이하일때 매수 진입
{
if C <= DayClose(1)*0.98 and C > DayClose(1)*0.975 Then
Buy("b1",OnClose,Def,1);
if C <= DayClose(1)*0.975 and C > DayClose(1)*0.970 Then
Buy("b2",OnClose,Def,2);
if C <= DayClose(1)*0.970 and C > DayClose(1)*0.965 Then
Buy("b3",OnClose,Def,3);
if C <= DayClose(1)*0.965 and C > DayClose(1)*0.960 Then
Buy("b4",OnClose,Def,4);
if C <= DayClose(1)*0.960 and C > DayClose(1)*0.955 Then
Buy("b5",OnClose,Def,5);
if C <= DayClose(1)*0.955 and C > DayClose(1)*0.95 Then
Buy("b6",OnClose,Def,6);
if C <= DayClose(1)*0.95 and C > DayClose(1)*0.945 Then
Buy("b7",OnClose,Def,7);
if C <= DayClose(1)*0.945 and C > DayClose(1)*0.94 Then
Buy("b8",OnClose,Def,8);
if C <= DayClose(1)*0.94 Then
Buy("b9",OnClose,Def,9);
}
}
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
XV = CurrentContracts;
cond = False;
}
if C >= AvgEntryPrice*(1+수익퍼센트*0.01) and sTime == 140000 and c > var1 and c > var2 Then
{
if XV >= 100 Then
vol = Floor(XV*0.01); # 계약수가 100개 이상일때 1% 분할매도
else if XV < 100 and XV >= 50 Then
vol = Floor(XV*0.02); # 계약수가 50개~100 일때 2% 분할매도
else if XV < 50 and XV >= 20 Then
vol = Floor(XV*0.05); # 계약수가 20개~50 일때 5% 분할매도
else if XV < 20 and XV >= 10 Then
vol = Floor(XV*0.10); # 계약수가 10개~20 일때 10% 분할매도
Else
vol = Floor(XV*0.50); # 계약수가 10개이하 일때 50% 분할매도
ExitLong("bx",OnClose,Def,"",vol,2);
}
}
Else
cond = False;
2023-07-09
949
글번호 170452
시스템
답변완료
부탁드립니다.
적용가능하도록 부탁 드립니다.
indicator('Laguerre RSI', shorttitle='LaRSI', overlay=false, timeframe = "")
src = input(title='Source', defval=close)
alpha = input.float(title='Alpha', minval=0, maxval=1, step=0.1, defval=0.2)
colorchange = input(title='Change Color ?', defval=false)
gamma = 1 - alpha
L0 = 0.0
L0 := (1 - gamma) * src + gamma * nz(L0[1])
L1 = 0.0
L1 := -gamma * L0 + nz(L0[1]) + gamma * nz(L1[1])
L2 = 0.0
L2 := -gamma * L1 + nz(L1[1]) + gamma * nz(L2[1])
L3 = 0.0
L3 := -gamma * L2 + nz(L2[1]) + gamma * nz(L3[1])
cu = (L0 > L1 ? L0 - L1 : 0) + (L1 > L2 ? L1 - L2 : 0) + (L2 > L3 ? L2 - L3 : 0)
cd = (L0 < L1 ? L1 - L0 : 0) + (L1 < L2 ? L2 - L1 : 0) + (L2 < L3 ? L3 - L2 : 0)
temp = cu + cd == 0 ? -1 : cu + cd
LaRSI = temp == -1 ? 0 : cu / temp
Color = colorchange ? LaRSI > LaRSI[1] ? color.green : color.red : color.blue
plot(100 * LaRSI, title='LaRSI', linewidth=2, color=Color, transp=0)
plot(20, linewidth=1, color=color.new(color.maroon, 0))
plot(80, linewidth=1, color=color.new(color.maroon, 0))
alertcondition(ta.crossover(100 * LaRSI, 20), title='LaRSI Crossover Alarm', message='Laguerre RSI crosses OVER 20 - BUY SIGNAL!')
alertcondition(ta.crossunder(100 * LaRSI, 80), title='Price Crossunder Alarm', message='Laguerre RSI crosses UNDER 80 - SELL SIGNAL!')
2023-07-09
939
글번호 170451
지표
답변완료
부탁드립니다.
적용가능하도록 부탁드립니다.
indicator("SuperTrend+", overlay = true, format=format.price, precision=2)
import Electrified/SupportResitanceAndTrend/4 as SRT
ATR = "Average True Range", CONFIRM = "Confirmation", DISPLAY = "Display"
WMA = "WMA", EMA = "EMA", SMA = "SMA", VWMA = "VWMA", VAWMA = "VAWMA"
mode = input.string(VAWMA, "Mode", options=[SMA,EMA,WMA,VWMA,VAWMA], group=ATR, tooltip=" which averaging function will be used to determine the ATR value.")
atrPeriod = input.int(120, "Period", group=ATR, tooltip="The number of bars to use in calculating the ATR value.")
atrM = input.float(3.0, title="Multiplier", step=0.5, group=ATR, tooltip="The multiplier used when defining the super trend limits.")
maxDeviation = input.float(0, title="Max Deviation", minval=0, step=0.5, group=ATR, tooltip="The maximum deviation of the true range before being considered and outlier.₩nA value of zero (default) results in no filtering.")
closeBars = input.int(2, "Closed Bars", minval = 0, group=CONFIRM, tooltip="The number of closed bars that have to exceed the super-trend value before the trend reversal is confirmed.")
showsignals = input(false, title="Show Buy/Sell Signals ?", group=DISPLAY)
highlighting = input(true, "Highlighter On/Off ?", group=DISPLAY)
[trend, up, dn, unconfirmed, warn, reversal] =
SRT.superTrend(atrM, atrPeriod, mode, closeBars, maxDeviation)
upPlot = plot(trend==1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=unconfirmed==0?color.green:color.yellow)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green)
plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white)
dnPlot = plot(trend==1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=unconfirmed==0?color.red:color.yellow)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red)
plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
longFillColor = color.new(highlighting ? (trend == 1 ? color.green : color.white) : color.white, 75)
shortFillColor = color.new(highlighting ? (trend == -1 ? color.red : color.white) : color.white, 75)
fill(mPlot, upPlot, title="UpTrend Highligter", color=longFillColor)
fill(mPlot, dnPlot, title="DownTrend Highligter", color=shortFillColor)
alertcondition(warn or reversal,
"1) Warning", message="SuperTrend+ Warning ({{ticker}} {{interval}})")
alertcondition(reversal,
"2) Reversal", message="SuperTrend+ Reversal ({{ticker}} {{interval}})")
alertcondition(buySignal,
"3) Up (+)", message="SuperTrend+ Up (+) ({{ticker}} {{interval}})")
alertcondition(sellSignal,
"4) Down (-)", message="SuperTrend+ Down (-) ({{ticker}} {{interval}})")
2023-07-09
795
글번호 170450
지표