답변완료
문의드립니다.
항상 감사드립니다.
현재 캔들 기준 이전 n번째 캔들의 고가 돌파시 즉시 매수, 저가 돌파시 즉시 매도.
손절은 매수는 n번째 캔들의 저가를 돌파시,매도는 n번째 캔들의 고가를 돌파시.
그리고 현재캔들 기준인데, 거래시간 전의 캔들은 포함하지 않는 건지요?
제가 원하는 것은 거래시간 시작이후 첫 캔들이 n번째 이전 캔들의 고가 저가를 반영해서
로직대로 진행하는 것입니다.
수식을 작성했는데요.
안 맞는 부분이 있어서 수정 부탁드립니다.
감사합니다.
input : n1(n);
input : StartTime(235000),EndTime(060000);
input : 익절틱수(800),손절틱수(0),거래횟수(10);
var : Tcond(false), entry(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (NextBarSdate != sdate and NextBarStime >= EndTime) or
(NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then
Tcond = False;
if (NextBarSdate != sdate and NextBarStime >= StartTime) or
(NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then
{
Tcond = true;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition <= 0 and NextBarOpen <= H[n1] and entry < 거래횟수 Then
Buy("b1",AtStop,H[n1]+PriceScale*1);
if MarketPosition >= 0 and NextBarOpen >= L[N1] and entry < 거래횟수 Then
Sell("s1",AtStop,L[N1]-PriceScale*1);
if MarketPosition == 1 Then
ExitLong("bx",AtStop,L[N1]-PriceScale*1);
if MarketPosition == -1 Then
ExitShort("sx",AtStop,H[n1]+PriceScale*1);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2021-11-23
850
글번호 153834
시스템
답변완료
RSI
=====================================================================
Inputs: Length(NumericSimple);
Variables: Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
If CurrentBar == 1 AND Length > 0 Then Begin
UpSum = 0;
DownSum = 0;
For Counter = 0 To Length - 1 Begin
UpAmt = C[Counter] - C[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else Begin
DownAmt = -UpAmt;
UpAmt = 0;
End;
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
End;
UpAvg = UpSum / Length;
DownAvg = DownSum / Length;
End
Else
If CurrentBar > 1 AND Length > 0 Then Begin
UpAmt = C[0] - C[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else Begin
DownAmt = -UpAmt;
UpAmt = 0;
End;
UpAvg = (UpAvg[1] * (Length - 1) + UpAmt) / Length;
DownAvg = (DownAvg[1] * (Length - 1) + DownAmt) / Length;
End;
If UpAvg + DownAvg <> 0 Then
RSI = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSI = 0;
==========================================================================
RSI 지표 구성이 위와 같습니다.(예스랭귀지 내용 복사했습니다.)
스팟에서 RSI 지료를 쓰려고 하는데, 확장차트에서 할 수 없는 상황이 되었습니다.
위의 식을 스팟에서 구현하도록 도움 부탁드리겠습니다.
CurrentBar를 어떻게 처리할 지 몰라서 여쭤봅니다.
확장 차트에서 C[Counter] ==> CT[i].GetClose(Counter) 이런 식으로 구성할 예정입니다.
2021-11-23
471
글번호 153829
지표
답변완료
문의 드립니다.
당일 시가 기준으로 시가 위이면 1번 적용
당일 시가 기준으로 시가 아래면 2번 적용
그리고 매매 수량을 원하는 대로 입력할 수 있을까요?
현재는 하나만 가능한데요...
부탁드립니다.
1번
Input : Period(10), MultiD(2);
var : BBmd(0),BBup(0),BBdn(0);
BBmd = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
if C > BBmd and crossup(C[1],BBmd[1]) Then
buy();
input : P(10);
var1 = ma(C,P);
if CrossDown(c,var1) Then
ExitLong();
2번
Input : Period(100), MultiD(2);
var : BBmd(0),BBup(0),BBdn(0);
BBmd = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
if C < BBmd and CrossDown(C[1],BBmd[1]) Then
sell();
input : P(10);
var1 = ma(C,P);
if crossup(c,var1) Then
ExitShort();
2021-11-23
657
글번호 153823
시스템
답변완료
순서 질문드립니다.
C2 = Data2(c);
C3 = Data3(c);
C4 = Data4(c);
위 구문을 아래처럼 놓을때랑
value1 위에 놓을때랑 수익이 달라지는데,,,
정석이 어떻게되는지 궁금합니다.
-------------------------------
input : StartTime(93000),EndTime(144000);
Input : s1(14), s2(198);
input : 손절(1.2),익절(1.2);
input : 최소이익(1.0),손실범위(0.1);
var : Tcond(false,Data1);
var : C2(0,Data2);
var : C3(0,Data3);
var : C4(0,Data4);
value1 = ma(c3,s1);
Value2 = ma(c3,s2);
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;
C2 = Data2(c);
C3 = Data3(c);
C4 = Data4(c);
if Tcond == true Then
{
if CrossUp(value1,Value2)
then
Buy();
if CrossDown(value1,Value2)
then
Sell();
}
SetStopEndofday(EndTime);
SetStopProfittarget(익절,PointStop);
SetStoploss(손절,PointStop);
SetStopContract();#생략가능
SetStopTrailing(손실범위 , 최소이익 , PointStop);
2021-11-23
844
글번호 153820
시스템
답변완료
다시 부탁드립니다
안녕하세요
예스스탁입니다.
문의하신 내용은 각진입별로 진입명을 부여하고
해당 진입명을 청산함수에 지정해서 청산하게 하셔야 합니다.
if A조건 Then
Buy("A");
if A조건 Then <== B 조건이지요?
Buy("B");
if A조건 Then <== C 조건이지요?
Buy("C");
if A조건 Then <== d 조건이지요?
Buy("D");
if MarketPosition == 1 Then
{
if A1조건 Then <=== 여기부터 이해 안 됩니다
ExitLong("A1",OnClose,DEF,"a"); 다시 좀 부탁드립니다
if A2조건 Then 수고하세요~~
ExitLong("A2",OnClose,DEF,"a");
if A3조건 Then
ExitLong("A3",OnClose,DEF,"a");
if A4조건 Then
ExitLong("A4",OnClose,DEF,"a");
}
즐거운 하루되세요
> 안미남 님이 쓴 글입니다.
> 제목 : 늘 수고 많습니다
> 식이 a b c d 로 4개의 식이 있습니다
A 식으로 들어간건 A1 청산
B 식으로 들어간건 B1 청산
C 식으로 들어간건 C1 청산
D 식으로 들어간건 D1 청산 으로 하고 싶습니다
예를 들어 만들어 주시길 부탁드립니다
늘 고맙습니다
2021-11-23
546
글번호 153819
시스템