답변완료
시스템식 요청 드립니다.
안녕하세요 항상 감사드립니다.
아침에 요청드린 식이 있는데.. 제가 생각하는 조건대로 매매가 진행되지
않는것 같아 다시 요청드립니다.
요청조건은
-------------------------------------------------------------------
여기서 추가하고자 하는 조건은
전부다 동일한 조건으로 진행되는데, 1차매수 2프로 익절 했을 경우에만,
다음타점으로 매수진행되도록 조건을 추가하고 싶습니다.
예를들어 5000원에 매수해서 2프로 익절까지 했을경우, 다음 4500원이 매수타점으로 되어 진행되도록
조건을 추가하고자 합니다.
-------------------------------------------------------------------
작성해주신 식으로 시뮬레이션을 돌려봤을때
1차매수 2프로 익절했는데도 불구하고 원래 타점대로 매수가 진행되네요
예를들어 5000원에 매수해서 2프로 익절까지 했을경우, 다음 4500원이 매수타점으로 되어 진행되도록 하고 싶은데, 다시 5000원이 매수가 진행됩니다..
번거로우시지만 다시 부탁드립니다.
요청식
------------------------------------------------
안녕하세요
예스스탁입니다.
input : 타점1(5000),타점2(4500),타점3(4000),타점4(3500),타점5(3000);
input : 투자금액1(1000000),투자금액2(2000000);
var : entry(0),HH(0);
if Bdate != Bdate[1] Then
{
entry = 0;
#5개의 타점중 시가보다 작은것 중에 젤 큰값 계산
HH = 0;
if 타점1 < DayOpen*0.99 and 타점1 < DayClose(1) and 타점1 > HH Then
HH = 타점1;
if 타점2 < DayOpen*0.99 and 타점2 < DayClose(1) and 타점2 > HH Then
HH = 타점2;
if 타점3 < DayOpen*0.99 and 타점3 < DayClose(1) and 타점3 > HH Then
HH = 타점3;
if 타점4 < DayOpen*0.99 and 타점4 < DayClose(1) and 타점4 > HH Then
HH = 타점4;
if 타점5 < DayOpen*0.99 and 타점5 < DayClose(1) and 타점5 > HH Then
HH = 타점5;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) and
(MarketPosition != MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if MarketPosition == 0 and sTime < 133000 and entry == 0 Then
{
Buy("1차매수",AtLimit,HH,Floor(투자금액1/min(NextBarOpen,HH)));
}
if MarketPosition == 1 and entry == 1 Then
{
Buy("2차매수",AtLimit,HH*0.974,Floor(투자금액2/min(NextBarOpen,HH*0.974)));
}
if MarketPosition == 0 and sTime < 133000 and entry == 1 and IsexitName("1차매수 2프로익절",1) == true Then
{
Buy("2차매수A",AtLimit,HH*0.974,Floor(투자금액2/min(NextBarOpen,HH*0.974)));
}
if MarketPosition == 1 Then
{
if MaxEntries == 1 and IsEntryName("1차매수",0) == true Then
{
ExitLong("1차매수 1프로익절",AtLimit,avgEntryPrice*1.01,"",Floor(MaxContracts*0.4));
ExitLong("1차매수 2프로익절",AtLimit,avgEntryPrice*1.02);
}
if MaxEntries == 2 and IsEntryName("1차매수",0) == true Then
{
ExitLong("2차매수 0.3익절",AtLimit,avgEntryPrice*1.003,"",Floor(MaxContracts*0.5));
ExitLong("2차매수 0.5익절",AtLimit,avgEntryPrice*1.005);
}
if MaxEntries == 1 and IsEntryName("2차매수A",0) == true Then
{
ExitLong("2차매수A 0.3익절",AtLimit,avgEntryPrice*1.003,"",Floor(MaxContracts*0.5));
ExitLong("2차매수A 0.5익절",AtLimit,avgEntryPrice*1.005);
}
ExitLong("손절",AtStop,HH*0.96);
}
2021-09-27
768
글번호 152474
시스템
답변완료
함수 작성 문의드립니다
안녕하세요
타 수식을 예스수식으로 변경중 막히는 부분이 있어 문의드립니다
<함수>
if(dayhigh>dayhigh[15],highest(dayhigh,15),if(dayhigh>dayhigh[30],highest(dayhigh,30),if(dayhigh>dayhigh[60],highest(dayhigh,60),if(dayhigh>dayhigh[120],highest(dayhigh,120),highest(dayhigh,240)))));
이걸 함수 A로 저장해두고 지표수식에서 불러오고싶습니다.
<지표>
분봉에서 함수A값을 불러와서
최근 5일봉중 최고가가 A값보다 크면서 + 당일 일봉이 음봉이 아닐때를 B라고 하면
IF(B,DAYHIGH,HIGHESTSINCE(1,B,DAYHIGH));
#B를 만족하면 당일고가, 만족하지 않으면 가장 최근에 B를 만족했었던 때의 일봉상 고가
라는 지표를 분봉에서 구현할수 있을까요?
타 증권사 개념으로 적어봤는데 예스트레이더 형식으로 변환부탁드립니다
2021-09-27
916
글번호 152470
사용자 함수
답변완료
안녕하세요 스크립트 해석 부탁드립니다
안녕하세요 노고에 늘 감사드립니다
트레이딩뷰 스크립트 내용이 이해가 가지 않아서 헤매고 있는데요
아래 스크립트는 어떤 상황에서 buy신호를 발생하고 또 sell 신호를 발생하는지
가능하면 설명 부탁드립니다
대단히 감사합니다 -_-
//@version=3
study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true)
//Modifyed by @guikroth
////////////////////////////////////////////////////////////////////////////////INPUTS
nATRPeriod = input(21, "Period")
nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1)
/////////////////////////////////////////////////////////////////////////////////ATR
xATR = atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = na
xATRTrailingStop :=
iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos = na
pos :=
iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
color = pos == -1 ? red: pos == 1 ? lime : blue
//patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0)
// Deternine if we are currently LONG
isLong = false
isLong := nz(isLong[1], false)
// Determine if we are currently SHORT
isShort = false
isShort := nz(isShort[1], false)
//Trading
// Buy only if the buy signal is triggered and we are not already long
LONG = not isLong and pos == 1
// Sell only if the sell signal is triggered and we are not already short
SHORT = not isShort and pos == -1
if (LONG)
isLong := true
isShort := false
if (SHORT)
isLong := false
isShort := true
barcolor(isLong ? lime : isShort ? red : na)
// Show Break Alerts
plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0)
plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0)
// === /PLOTTING ===
// Send alert to TV alarm sub-system
alertcondition(LONG,title="Sell",message="Sell")
alertcondition(SHORT,title="BuY",message="Buy")
alertcondition(SHORT,title="BuY",message="Buy")
alertcondition(SHORT,title="BuY",message="Buy")
////////////////////////////////////////////////////////////////////////////////VWMA
len2 = input(100, minval=1, title="Smooth")
src = input(close, title="Source")
out = vwma(src, len2)
avg1=avg(out, xATRTrailingStop)
plot(avg1, color=aqua, transp=0, title="ATR")
2021-09-26
849
글번호 152464
지표