답변완료
NewLine 함수가 작동을 안합니다.
strvv= NumToStr(date,0);
strvv1= NumToStr(time,0);
if pos(CurrentTime-time)<=10 then { print("c:₩"+strvv+"_"+strvv1+".txt",",NetProfit, %.2f, PositionProfit, %.2f, var1, %.f", NetProfit, NewLine, PositionProfit, var1 ); }
위와 같이 코딩을 했는데 NetProfit 이후 PositionProfit, var1 이 행이 바뀌어 출력되는게 아니라 같은줄에 출력됩니다.
txt 파일과 csv 파일 출력시 행을 바꾸어 출력하는 방법을 알고 싶습니다.
2020-03-26
491
글번호 137261
사용자 함수
답변완료
도움요청드립니다.
안녕하세요?
1)아래의 수식을 양봉음봉을 틱수지정없이 그냥 양봉 음봉일때 매매하도록 하고싶습니다.
원래 전봉음봉(틱) 진입봉음봉(틱) 이렇게 틱수지정하였던 부분을,
음봉 다음 갭상승음봉 매도진입
양봉 다음 갭하락양봉 매수진입
2)스위칭매매가 안되고 지정한 익/손절만 하고싶습니다.
도움부탁드립니다.
감사합니다.
input : 매수전봉양봉틱수(5),매수현재양봉틱수(5);
input : 매도전봉음봉틱수(5),매도현재음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(4);
input : P1(5),P2(20);
var : entry(0),mav1(0),mav2(0),T1(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
#영업일 변경
if bdate != bdate[1] Then
{
T1 = TotalTrades;
}
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = TotalTrades-T1+1;
if mav1 > mav2 and #정배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
bdate == bdate[1] and
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]-매도전봉음봉틱수*PriceScale and
C[0] == O[0]-매도현재음봉틱수*PriceScale and
O[0] > C[1] then #갭상승
{
sell("s");
if entry < 진입횟수-1 then
buy("bs1",AtStop,C+PriceScale*4);
Else
ExitShort("sx1",AtStop,C+PriceScale*4);
}
if mav1 < mav2 and #역배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
bdate == bdate[1] and
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]+매수전봉양봉틱수*PriceScale and
C[0] == O[0]+매수현재양봉틱수*PriceScale and
O[0] < C[1] then #갭하락
{
buy("b");
if entry < 진입횟수-1 Then
sell("sb1",AtStop,C-PriceScale*4);
Else
ExitShort("bx1",AtStop,C-PriceScale*4);
}
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
{
if entry < 진입횟수 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
Else
ExitLong("bsx",AtStop,EntryPrice-PriceScale*손절틱수);
}
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 and entry < 진입횟수 Then
{
if entry < 진입횟수 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
Else
ExitShort("sbx",AtStop,EntryPrice+PriceScale*손절틱수);
}
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);
2020-03-27
434
글번호 137260
시스템
답변완료
수정부탁드립니다.
안녕하세요? 답변받은 아래의 수식에서 약간 수정하여 사용하고있습니다.
추가로 더 수정할 부분이있는데 도움을 받으려합니다.
<현재>
정배열에서 음봉연속 2개일시 매도
역배열에서 양봉연속 2개일시 매수
<수정후>
정배열에서 음봉 다음 갭상승한 음봉일시 매도
역베열에서 양봉 다음 갭하락한 양봉일시 매수
이렇게 수정부탁드립니다.
감사합니다.
input : 매수전봉양봉틱수(5),매수현재양봉틱수(5);
input : 매도전봉음봉틱수(5),매도현재음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(4);
input : P1(5),P2(20);
var : entry(0),mav1(0),mav2(0),T1(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
#영업일 변경
if bdate != bdate[1] Then
{
T1 = TotalTrades;
}
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = TotalTrades-T1+1;
if mav1 > mav2 and #정배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
bdate == bdate[1] and
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]-매도전봉음봉틱수*PriceScale and
C[0] == O[0]-매도현재음봉틱수*PriceScale Then
{
sell("s");
if entry < 진입횟수-1 then
buy("bs1",AtStop,C+PriceScale*4);
Else
ExitShort("sx1",AtStop,C+PriceScale*4);
}
if mav1 < mav2 and #역배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
bdate == bdate[1] and
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]+매수전봉양봉틱수*PriceScale and
C[0] == O[0]+매수현재양봉틱수*PriceScale Then
{
buy("b");
if entry < 진입횟수-1 Then
sell("sb1",AtStop,C-PriceScale*4);
Else
ExitShort("bx1",AtStop,C-PriceScale*4);
}
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
{
if entry < 진입횟수 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
Else
ExitLong("bsx",AtStop,EntryPrice-PriceScale*손절틱수);
}
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 and entry < 진입횟수 Then
{
if entry < 진입횟수 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
Else
ExitShort("sbx",AtStop,EntryPrice+PriceScale*손절틱수);
}
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);
2020-03-26
630
글번호 137255
시스템
답변완료
문의드립니다.
inp_Period = input(title = "Trend", type = input.integer, defval = 8)
inp_Source = input(title = "Source", type = input.source, defval = close)
da_StdDev = stdev(inp_Source, inp_Period)
da_StdDev_Avg = sma(da_StdDev, inp_Period)
da_Line = da_StdDev_Avg == 0 ? 1 : da_StdDev / da_StdDev_Avg
plot(da_Line, color = da_Line > 0.2 ? color.green : color.red)
변환 문의드립니다.
감사합니다.
2020-03-26
648
글번호 137250
지표
답변완료
문의
10시대에 3번 들어가는 경우도 있는데
같은 시간대에는 1번만 진입하는 조건 추가바랍니다.
***********************************************************
input:시간(091000);
input : 강제손절(0.46),강제추적(6.00),강제익절(1000);
var : HH(0),LL(0);
if stime < 시간 Then{
HH = dayhigh;
LL = daylow;
}
if stime >= 시간 and crossup(c,HH) then
sell();
SetStopLoss(강제손절,PointStop);
SetStopTrailing(강제추적,0,PointStop);
SetStopProfittarget(강제익절,PointStop);
2020-03-26
661
글번호 137249
시스템