예스스탁
예스스탁 답변
2025-03-04 16:01:25
안녕하세요
예스스탁입니다.
input : txratio(0.3),txa(3),txam(5),txb(8),txn(2);
var : trXcond1(false),trXcond2(false),trXcond3(false),ii(0),xvol(0);
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx1" Then
trXcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx2" Then
trXcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx3" Then
trXcond3 = true;
var1 = highest(H,BarsSinceEntry);
if trXcond1 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx1",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
}
if trXcond2 == false and var1 >= EntryPrice*(txb/100+1) and var1 < EntryPrice*(((txb+txam)/100)+1) Then
ExitLong("trx2",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
#청산발생하면 ii는 0
if CurrentContracts < CurrentContracts[1] Then
{
ii = 0;
xvol = xvol+abs(CurrentContracts-CurrentContracts);
}
else
{ #청산발생 후 1씩 증가
if ii >= 0 Then
ii = ii +1;
}
if (ii > 96) and trXcond3 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx3",AtStop,var1*(1-(txn+1)/100),"",currentContracts*txratio,1);
}
if marketposition == 1 and c > DayOpen and c > o Then
{
if Value6 > 0.02 Then Buy("S1_upb",OnClose,Def,xvol);
}
}
Else
{
#매수포지션이 아니면 -1로 초기화
ii = -1;
trXcond1 = false;
trXcond2 = false;
trXcond3 = false;
xvol = 0;
}
즐거운 하루되세요
> 김예스 님이 쓴 글입니다.
> 제목 : 수식문의드립니다.
> 안녕하세요,
아래 분할 청산 수식에 더해서
if marketposition == 1 and c > DayOpen and c > o Then {
if Value6 > 0.02 Then Buy("S1_upb");
}
이걸 추가하고 싶은데, 이때 Buy 수량을 분할청산으로 나간 수량 만큼만 매수하고 싶습니다.
수식 부탁드립니다.
input : txratio(0.3),txa(3),txam(5),txb(8),txn(2);
var : trXcond1(false),trXcond2(false),trXcond3(false),ii(0);
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx1" Then
trXcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx2" Then
trXcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx3" Then
trXcond3 = true;
var1 = highest(H,BarsSinceEntry);
if trXcond1 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx1",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
}
if trXcond2 == false and var1 >= EntryPrice*(txb/100+1) and var1 < EntryPrice*(((txb+txam)/100)+1) Then
ExitLong("trx2",AtStop,var1*(1-txn/100),"",currentContracts*txratio,1);
#청산발생하면 ii는 0
if CurrentContracts < CurrentContracts[1] Then
ii = 0;
else
{ #청산발생 후 1씩 증가
if ii >= 0 Then
ii = ii +1;
}
if (ii > 96) and trXcond3 == false and var1 >= EntryPrice*(txa/100+1) and var1 < EntryPrice*(((txa+txam)/100)+1) Then
{
ExitLong("trx3",AtStop,var1*(1-(txn+1)/100),"",currentContracts*txratio,1);
}
}
Else
{
#매수포지션이 아니면 -1로 초기화
ii = -1;
trXcond1 = false;
trXcond2 = false;
trXcond3 = false;
}