답변완료
지표 및 시스템 문의드립니다
수고많으십니다~~
번거롭게 해드렸네요...
간단하게 작성법을 알고, 응용하면 될줄알았는데 쉽지가않네요
다시한번 재문의 드립니다.
=================================
키움에서 쓰던
1. 시스템 매매를 예스트레이더에 맞게 변경하고 싶습니다.
2. 매수식을 이용한 검색 도 부탁드립니다
================================
1. 시스템 트레이딩
> 제목 : 매매식 및 매수매도 조건 설정 문의
조건설정
1차매수 : 2000주
2차매수 : 500주 ... 2차까지만 매수하고 싶습니다.
매도는
1차매도 : 평단대비 3.5% 상승시 비중의 30%만 매도 (최초 3.5%상승시 1번만 매도)
2차매도 : 평단대비 10% 상승시 비중의 50% 매도
나머지 전량매도 :
1. 매도조건 달성시
2. 평단대비 50% 달성시 (목표가)
3. 평단대비 -15% 하락시 손절
시간설정
1. 오전 09:10 부터 매수시작
2. 오후 02:30 부터는 신규매수 중지
3. 오후 03:15 보유종목 모두 청산
이렇게 하고 싶은데 어떻게 설정을 해야할까요??
(아래 매매식)
period = 10
multiple = 3
기본
base = (h + l) /2;
상단선
upper_band=base + atr(period)*multiple;
downtrend=valuewhen(1,lowest(upper_band(1),period)>upper_band,upper_band);
하단선
lower_band=base - atr(period)*multiple;
uptrend=valuewhen(1,highest(lower_band(1),period)<lower_band,lower_band);
매수
crossup( c(1), downtrend(1)) && c > downtrend
매도
crossdown( c(1), uptrend(1) ) && c < uptrend
========================================
3. 위 매수식을 이용한 "검색" 도 부탁드립니다
(아래조건에 해당하는 종목을 검색하고 싶은데 어떻게 하느지를 모르겠네요??)
period = 10
multiple = 3
기본
base = (h + l) /2;
상단선
upper_band=base + atr(period)*multiple;
downtrend=valuewhen(1,lowest(upper_band(1),period)>upper_band,upper_band);
하단선
lower_band=base - atr(period)*multiple;
uptrend=valuewhen(1,highest(lower_band(1),period)<lower_band,lower_band);
매수
crossup( c(1), downtrend(1) ) && c > downtrend
2023-05-15
1672
글번호 168975
지표
답변완료
수식확인 요청 드립니다.
nr12 nr7로 테스트 했는데
1봉전께 나오는거 같습니다.
번거로우시겠지만 확인 부탁드립니다. 감사합니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 지표 및 종목검색식 부탁드립니다.
>
안녕하세요
예스스탁입니다.
1. 지표(속성에서 막대그래프로 지정하고 보시기 바랍니다.)
input : length_NR(7);
var : sOpen(0),sHigh(0),sLow(0),sClose(0);
var : range_NR_Prep(0),range_NR(0),range_ATR(0);
var : range_isCurrentLowest(False),range_isLowest(False);
var : range_Break_Direction(0),range_Volume_Surge(0);
sOpen = open;
sHigh = high;
sLow = low;
sClose = close;
#NR_Check(range) => range < lowest(range, length_NR - 1)[1] ? true : false
// Calculations
range_NR_Prep = sHigh - sLow;
range_NR = sHigh[1] - sLow[1];
range_ATR = atr(length_NR);
if range_NR_Prep < lowest(range_NR_Prep,length_NR-1)[1] Then
range_isCurrentLowest = true;
Else
range_isCurrentLowest = False;
if range_NR < lowest(range_NR,length_NR-1)[1] Then
range_isLowest = true;
Else
range_isLowest = False;
range_Break_Direction = iff(range_isLowest == true , IFf(sClose > sHigh[1] and range_ATR > range_ATR[1] , 1 ,IFf(sClose < sLow[1] and range_ATR < range_ATR[1] , -1 , 0)),0);
range_Volume_Surge = iff(volume > ma(volume, length_NR)[1] , 1 , 0);
range_Break_Direction = iff(range_Break_Direction == 1 , range_Break_Direction + range_Volume_Surge ,IFf(range_Break_Direction == -1 , range_Break_Direction + range_Volume_Surge , 0));
if range_isLowest then
plot1(range_Break_Direction,"검색",green);
Else
NoPlot(1);
2 종목검색
input : length_NR(7);
var : sOpen(0),sHigh(0),sLow(0),sClose(0);
var : range_NR_Prep(0),range_NR(0),range_ATR(0);
var : range_isCurrentLowest(False),range_isLowest(False);
var : range_Break_Direction(0),range_Volume_Surge(0);
sOpen = open;
sHigh = high;
sLow = low;
sClose = close;
#NR_Check(range) => range < lowest(range, length_NR - 1)[1] ? true : false
// Calculations
range_NR_Prep = sHigh - sLow;
range_NR = sHigh[1] - sLow[1];
range_ATR = atr(length_NR);
if range_NR_Prep < lowest(range_NR_Prep,length_NR-1)[1] Then
range_isCurrentLowest = true;
Else
range_isCurrentLowest = False;
if range_NR < lowest(range_NR,length_NR-1)[1] Then
range_isLowest = true;
Else
range_isLowest = False;
range_Break_Direction = iff(range_isLowest == true , IFf(sClose > sHigh[1] and range_ATR > range_ATR[1] , 1 ,IFf(sClose < sLow[1] and range_ATR < range_ATR[1] , -1 , 0)),0);
range_Volume_Surge = iff(volume > ma(volume, length_NR)[1] , 1 , 0);
range_Break_Direction = iff(range_Break_Direction == 1 , range_Break_Direction + range_Volume_Surge ,IFf(range_Break_Direction == -1 , range_Break_Direction + range_Volume_Surge , 0));
if range_isLowest then
Find(1);
즐거운 하루되세요
> 신데렐라맨 님이 쓴 글입니다.
> 제목 : 지표 및 종목검색식 부탁드립니다.
> 종목검색식 + 지표요청입니다.
nr(x) 인디케이터라는 지표입니다.
기본은 12일이고 날짜지정이 가능하면 좋겠습니다.
제가 설명이 부족할듯 하여 원본 링크 첨부드립니다.
https://kr.tradingview.com/v/OWa0Thc7/
브레이크 업다운 같은건 없어도 되고요 nr(x) 종목 검색식과
지표 부탁드립니다.
미리 감사드려요. 꾸벅~
//@version=2
study("NR(X) Indicator", overlay = true)
// Pull traditional data
sOpen = security(tickerid, period, open)
sHigh = security(tickerid, period, high)
sLow = security(tickerid, period, low)
sClose = security(tickerid, period, close)
// Inputs
length_NR = input(defval = 7, title = "Period length of days for Narrow Range", type = integer)
NR_Check(range) =>
range < lowest(range, length_NR - 1)[1] ? true : false
// Calculations
range_NR_Prep = sHigh - sLow
range_NR = sHigh[1] - sLow[1]
range_ATR = atr(length_NR)
range_isCurrentLowest = NR_Check(range_NR_Prep)
range_isLowest = NR_Check(range_NR)
range_Break_Direction = range_isLowest == true ? sClose > sHigh[1] and range_ATR > range_ATR[1] ? 1 : sClose < sLow[1] and range_ATR < range_ATR[1] ? -1 : 0 : 0
range_Volume_Surge = volume > sma(volume, length_NR)[1] ? 1 : 0
range_Break_Direction := range_Break_Direction == 1 ? range_Break_Direction + range_Volume_Surge : range_Break_Direction == -1 ? range_Break_Direction + range_Volume_Surge : 0
// Draw out
//plot(range_isLowest == true ? range_Break_Direction : na, color = green, style = histogram, transp = 0)
plotshape(range_isCurrentLowest == true ? low : na, style = shape.diamond, color = white, transp = 0)
plotshape(range_Break_Direction > 0 ? low : na, style = shape.labeldown, color = green, transp = 0, text = "Break ₩nUP", textcolor = white, location = location.abovebar)
plotshape(range_Break_Direction < 0 ? high : na, style = shape.labelup, color = red, transp = 0, text = "Break ₩nDOWN", textcolor = white, location = location.belowbar)
2023-05-15
1522
글번호 168974
종목검색
답변완료
수식문의드립니다.
항상 감사드립니다.
아래의 3 가지 수식에 이격도 (이평이 서로 너무 벌어지면 진입금지)를
추가해주시면 감사드리겠습니다,
저번처럼 외부변수로 해주시면 정말 감사드리겠습니다.(예 Input : p1(5), p2(20), Per(5);)
[1번]
Inputs: AvgLen1(10), AvgLen2(10), AvgLen3(10), AvgLen4(10), ARmult(4.5), Div(30);
Vars: Avg1(0), Avg2(0), Avg3(0), Avg4(0), MP(0), StopPrice(0);
Avg1 = ema(Close, AvgLen1);
Avg2 = ema(Close, AvgLen2);
Avg3 = ema(Close, AvgLen3);
Avg4 = ema(Close, AvgLen4);
If CrossUp(Avg1 , Avg2) AND (Avg2 > Avg3) AND (Avg3 > Avg4) then
Buy("B",AtMarket);
If CrossDown (Avg1 , Avg2) AND (Avg2 < Avg3) AND (Avg3 < Avg4) then
Sell("S",AtMarket);
If Avg1 < Avg2 then
ExitLong("EL",AtMarket);
If Avg1 > Avg2 then
ExitShort("ES",AtMarket);
MP = MarketPosition;
if MP == 1 and MP[1] <> 1 then
StopPrice = low - ma(range,40)*ARmult;
if MP == -1 and MP[1] <> -1 then
StopPrice = High + ma(range,40)*ARmult;
If MP == 1 then {
exitlong ("ExitLong", atstop, stopprice );
stopprice = stopprice + (low-stopprice)/Div;
}
If MP == -1 then {
exitshort ("ExitShort",atstop, stopprice );
stopprice = stopprice - (stopprice-high)/Div;
}
[2번]
Input: DMILen(70), ADXLen(20), entryPoint(0.2), ADXExit(30);
Vars: BuySetup(false), SellSetup(false), BuyPrice(0), SellPrice(0),
DPlus(0), DMin(0), ADXVal(0), ExitSPrc(0), ExitLPrc(0);
DPlus = DIPlus(DMILen);
DMin = DIMinus(DMILen);
ADXVal = ADX(ADXLen);
If DPlus > DMin AND CrossUp( ADXVal , DMin) and MarketPosition <> 1 then begin
BuyPrice = High + entryPoint ;
BuySetup = true;
ExitLPrc = Low - entryPoint ;
end;
If ADXVal < DMin OR MarketPosition == 1 then
BuySetup = False;
If DPlus < DMin AND CrossUp( ADXVal , DPlus) and MarketPosition <> -1 then begin
SellPrice = Low - entryPoint ;
SellSetup = true;
ExitSPrc = High + entryPoint ;
end;
If ADXVal < DPlus or MarketPosition == -1 then
SellSetup = False;
If BuySetup then
Buy("B",atstop,BuyPrice);
If SellSetup then
Sell("S",atstop,SellPrice);
/*If MarketPosition == 1 then Begin
BuySetup = false;
ExitLong("EL1",atstop,ExitLPrc);
end;
If MarketPosition == -1 then begin
SellSetup = True;
ExitShort("ES1",atstop,ExitSPrc);
end;
If ( ADXVal[1] >= ADXExit AND ADXVal < ADXVal[1] ) then Begin
If MarketPosition == 1 and barssinceentry > 1 then
ExitLong("EL2"); ;
If MarketPosition == -1 and barssinceentry > 1 then
ExitShort("ES2");;
end;
If DPlus < DMin and BarsSinceEntry > 1 then
ExitLong("EL3");
If DPlus > Dmin and BarsSinceEntry > 1 then
ExitShort("ES3");*/
[3번]
Inputs: Length(300), Const(1.4), ChanPcnt(0.8), stopLen(40), stopper(1.0);
Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0);
//Assignments of Keltner calculations
AvgVal = ma(Close, Length);
AvgRange = ma(TrueRange, Length);
KCU = AvgVal + AvgRange * Const;
KCL = AvgVal - AvgRange * Const;
ChanRng = (KCU - KCL) / 2;
//Accumulates to count the bars after the SetUps below
CountL = CountL + 1;
CountS = CountS + 1;
//Buy Criteria Evaluation
IF CrossUp(Close , KCU) Then Begin
SetBar = High;
CountL = 1;
End;
IF Close > KCU AND CountL <= 5 Then
Buy("B",atstop,SetBar + (ChanRng * ChanPcnt));
//Sell Criteria Evaluation
IF CrossDown(Close , KCL) Then Begin
SetBar = Low;
CountS = 1;
End;
IF Close < KCL AND CountS <= 5 Then
Sell("S",atstop,SetBar - (ChanRng * ChanPcnt));
//System Stops
IF CrossDown( Close , AvgVal) Then
ExitLong();
IF CrossUP(Close , AvgVal) Then
ExitShort();
//Trailing Stops
ExitLong("EL2", atstop,Lowest(Low, StopLen) );
ExitShort("ES2", atstop,Highest(High, StopLen));
2023-05-15
1666
글번호 168959
시스템