예스스탁
예스스탁 답변
2023-07-12 09:40:09
안녕하세요
예스스탁입니다.
1
수량을 계산하는 부분은 아래 내용입니다.
특정이름으로 진입후 청산되면 원금 기준으로 다시 수량이 산정되는 내용이므로
아래 내용에 진입명만 추가로 지정하시면 됩니다.
if TotalTrades > TotalTrades[1] and
(IsEntryName("b",1) == true or IsEntryName("b2",1) == true or IsEntryName("b3",1) == true) Then
n1 = NetProfit;
수량 = (원금+(NetProfit-n1))/NextBarOpen;
2
input : P1(0),P2(0),P3(0);
input : short1(0),long1(0),sig1(0);
input : shor(0),long(0),sig(0);
input : sho(0),lon(0),si(0);
input : evPeriod(0),Per(0);
input : 원금(1000000);
var : mav1(0),mav2(0),mav3(0);
var : macdv1(0),macdv2(0),macdv3(0),macds1(0),macds2(0),macds3(0);
var : evup(0),evdn(0);
var : n1(0),수량(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
mav3 = ma(C,P3);
macdv1 = macd(short1,long1);
macdv2 = macd(shor,long);
macdv3 = macd(sho,lon);
macds1 = Ema(macdv1,sig1);
macds2 = Ema(macdv2,sig);
macds3 = Ema(macdv3,si);
evup = EnvelopeUp(evPeriod,Per);
evdn = EnvelopeDown(evPeriod,Per);
if TotalTrades > TotalTrades[1] and IsEntryName("b",1) == true Then
n1 = NetProfit;
수량 = (원금+(NetProfit-n1))/NextBarOpen;
if MarketPosition <= 0 and CrossUp(macdv1,0) Then
{
Buy("b",OnClose,Def,수량);
}
If macdv1 > 0 and CrossUp(macdv1, macds1) and
(IsExitName("E4",1) == False or (IsEntryName("E4",1) == true and C < Evup)) Then
{
Buy("bx",OnClose,Def,수량);
}
If CrossDown(macdv1, 0) Then
{
ExitLong("s");
}
If macdv1 > 0 and CrossDown(macdv1, macds1) and macdv2 < 0 Then
{
ExitLong("sx");
}
if MarketPosition == 1 Then
{
if mav2 > mav1 Then
{
ExitLong("s1",AtLimit,EntryPrice*0.0);
}
if macdv1 > 0 Then
{
ExitLong("E4",AtLimit,evup*0.0);
}
}
if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then
{
if IsExitName("s1",1) == true Then
Buy("b1",AtLimit,EntryPrice(1)*0.0,수량);
if IsExitName("E4",1) == true Then
Buy("b4",AtLimit,ExitPrice(1)*0.0,수량);
}
If macdv1 > 0 and CrossUp(macdv2, 0) Then
{
Buy("v5",OnClose,Def,수량);
}
If macdv1 > 0 and CrossUp(macdv2,macds2) Then
{
Buy("v6",OnClose,Def,수량);
}
즐거운 하루되세요
> 탱탱볼 님이 쓴 글입니다.
> 제목 : 82816 추가 문의 드립니다
> input : short1(0),long1(0),sig1(0);
input : shor(0),long(0),sig(0);
input : evPeriod(0),Per(0);
var : mav1(0),mav2(0);
var : macdv1(0),macdv2(0),macds1(0),macds2(0);
var : evup(0),evdn(0),n1(0);
macdv1 = macd(short1,long1);
macdv2 = macd(shor,long);
macds1 = Ema(macdv1,sig1);
macds2 = Ema(macdv2,sig);
evup = EnvelopeUp(evPeriod,Per);
evdn = EnvelopeDown(evPeriod,Per);
input : 원금(1000000),시작일(0),시작시간(0);
var : Tcond(False),수량(0) ;
if Tcond == true Then
if sDate == 시작일 and sTime >= 시작시간 Then
Tcond = true;
# 매수/매도청산
if CrossUp(macdv1,0) Then
{
Buy("b",OnClose,Def,Floor(원금/NextBarOpen));
}
if TotalTrades > TotalTrades[1] and IsEntryName("b",1) == true Then
n1 = NetProfit;
수량 = (원금+(NetProfit-n1))/NextBarOpen;
If macdv1 > 0 and macdv2 > 0 and CrossUp(macdv2,macds2) Then
{
Buy("b1",OnClose,Def,수량);
}
# 매도/매수청산
If CrossDown(macdv1, 0) Then
{
ExitLong("bx");
}
if macdv1 > 0 Then
{
ExitLong("E",AtLimit,evup*0.00);
}
1. 답주신 수식에 다음을 추가하려고 합니다.
"b2" 과 "b4" 도 한 사이클로 보고 "b"의 리셋된 복리값이 적용되려면 AtLimit 는 어떻게 변경해야될까요?
if MarketPosition == 1 Then
{
if mav2 > mav1 Then
{
ExitLong("s1",AtLimit,EntryPrice*0.00);
}
if macdv1 > 0 Then
{
ExitLong("E4",AtLimit,evup*0.00);
}
}
if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then
{
if IsExitName("s1",1) == true Then
Buy("b2",AtLimit,EntryPrice(1)*0.00,수량);
if IsExitName("E4",1) == true Then
Buy("b4",AtLimit,ExitPrice(1)*0.00,수량);
}
2. 아래의 수식에서 (복리X) "b" 매수신호에 원금 100만원이로 시작하는 식을 만들고 싶습니다.
예)
"b"매수 신호에 100만원 매수
"E"매도 신호에서 20만원의 수익
"E4"매수 신호에서 120만원 매수
"bx"매도
"b"매수 신호에 다시 100만원 매수
"S1"매도 신호에서 30만원의 수익
"b1"매수 신호에서 130만원 매수
"E4"매도 신호에서 100만원 수익
"b4"매수 신호에서 230만원 매수
"S"매도
"b"매수 신호에 100만원 매수
(반복)
감사합니다.
input : P1(0),P2(0),P3(0);
input : short1(0),long1(0),sig1(0);
input : shor(0),long(0),sig(0);
input : sho(0),lon(0),si(0);
input : evPeriod(0),Per(0);
var : mav1(0),mav2(0),mav3(0);
var : macdv1(0),macdv2(0),macdv3(0),macds1(0),macds2(0),macds3(0);
var : evup(0),evdn(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
mav3 = ma(C,P3);
macdv1 = macd(short1,long1);
macdv2 = macd(shor,long);
macdv3 = macd(sho,lon);
macds1 = Ema(macdv1,sig1);
macds2 = Ema(macdv2,sig);
macds3 = Ema(macdv3,si);
evup = EnvelopeUp(evPeriod,Per);
evdn = EnvelopeDown(evPeriod,Per);
if MarketPosition <= 0 and CrossUp(macdv1,0) Then
{
Buy("b");
}
If macdv1 > 0 and CrossUp(macdv1, macds1) and
(IsExitName("E4",1) == False or (IsEntryName("E4",1) == true and C < Evup)) Then
{
Buy("bx");
}
If CrossDown(macdv1, 0) Then
{
ExitLong("s");
}
If macdv1 > 0 and CrossDown(macdv1, macds1) and macdv2 < 0 Then
{
ExitLong("sx");
}
if MarketPosition == 1 Then
{
if mav2 > mav1 Then
{
ExitLong("s1",AtLimit,EntryPrice*0.0);
}
if macdv1 > 0 Then
{
ExitLong("E4",AtLimit,evup*0.0);
}
}
if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then
{
if IsExitName("s1",1) == true Then
Buy("b1",AtLimit,EntryPrice(1)*0.0);
if IsExitName("E4",1) == true Then
Buy("b4",AtLimit,ExitPrice(1)*0.0);
}
If macdv1 > 0 and CrossUp(macdv2, 0) Then
{
Buy("v5");
}
If macdv1 > 0 and CrossUp(macdv2,macds2) Then
{
Buy("v6");
}