커뮤니티
수식 요청드립니다.
2019-07-25 02:00:57
170
글번호 130618
안녕하세요?
아래의 식을 적용해보면 이익보전 매도가
1~3차 까지 매수가 일어난후 작동되는거 같아서요~
1차매수후 5%수익나서 일부 매도가 되고
더오르지 못하고 떨어져서 3%수익이 되면 50% 매도
계속떨어져서 1.5% 수익나면 전부 매도
이런식으로 식이 진행되었으면 합니다.
1차매수 또는 2차매수까지 매수가 진행후
주가가 올랐다가 떨어져도 이익보전 매도가 일어났으면 합니다.
아래식은 이익보전이
1차 2차 3차 까지 일어나야 실행이되고
1차만 2차까지 매수된 상태에서는 적용이 안되는거 같아서요~
확인 부탁드립니다. 감사합니다~
input : 금액(3000000),P(400);
var1 = ma(C,P);
if MarketPosition == 0 and L > var1*1.015 and ExitDate(1) != sdate Then
buy("1차매수",atlimit,var1*1.015,Floor((금액*0.7)/min(NextBarOpen,var1*1.015)));
if MarketPosition == 1 then
{
if MaxEntries == 1 and L > var1 Then
buy("2차매수",atlimit,var1,Floor((금액*0.2)/min(NextBarOpen,var1)));
if MaxEntries == 2 and L > var1*0.97 Then
buy("3차매수",atlimit,var1*0.97,Floor((금액*0.1)/min(NextBarOpen,var1*0.97)));
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "5%매도" Then
Condition1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "10%매도" Then
Condition2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "15%매도" Then
Condition3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "3%보전" Then
Condition11 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "1.5%보전" Then
Condition12 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "8%보전" Then
Condition21 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "6%보전" Then
Condition22 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "13%보전" Then
Condition31 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "11%보전" Then
Condition32 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "7%손절" Then
Condition4 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "10%손절" Then
Condition5 = true;
if Condition1 == false Then
ExitLong("5%매도",atlimit,AvgEntryPrice*1.05,"",Floor(CurrentContracts*0.3),1);
if Condition2 == false Then
ExitLong("10%매도",atlimit,AvgEntryPrice*1.10,"",Floor(CurrentContracts*0.5),1);
if Condition3 == false Then
ExitLong("15%매도",atlimit,AvgEntryPrice*1.15);
if Condition1 == true then
{
if Condition11 == false Then
ExitLong("3%보전",AtStop,AvgEntryPrice*1.03,"",Floor(CurrentContracts*0.5),1);
if Condition12 == false Then
ExitLong("1.5%보전",AtStop,AvgEntryPrice*1.015);
}
if Condition2 == true then
{
if Condition21 == false Then
ExitLong("8%보전",AtStop,AvgEntryPrice*1.08,"",Floor(CurrentContracts*0.5),1);
if Condition22 == false Then
ExitLong("6%보전",AtStop,AvgEntryPrice*1.06);
}
if Condition3 == true then
{
if Condition31 == false Then
ExitLong("13%보전",AtStop,AvgEntryPrice*1.13,"",Floor(CurrentContracts*0.5),1);
if Condition32 == false Then
ExitLong("11%보전",AtStop,AvgEntryPrice*1.11);
}
if Condition4 == false Then
ExitLong("7%손절",AtStop,AvgEntryPrice*0.93,"",Floor(CurrentContracts*0.7),1);
if Condition5 == false Then
ExitLong("10%손절",AtStop,AvgEntryPrice*0.90);
}
Else
{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition31 = false;
Condition31 = false;
Condition4 = false;
Condition5 = false;
}
답변 1
예스스탁 예스스탁 답변
2019-07-25 15:52:34
안녕하세요
예스스탁입니다.
모든 청산식에는 매수진입 횟수에 대한 제한 내용이 없습니다.
첨부된 그림과 같이 1차매수만 발생해도 이후에도 보전청산 발생하게 됩니다.
즐거운 하루되세요
> 부자청년28 님이 쓴 글입니다.
> 제목 : 수식 요청드립니다.
> 안녕하세요?
아래의 식을 적용해보면 이익보전 매도가
1~3차 까지 매수가 일어난후 작동되는거 같아서요~
1차매수후 5%수익나서 일부 매도가 되고
더오르지 못하고 떨어져서 3%수익이 되면 50% 매도
계속떨어져서 1.5% 수익나면 전부 매도
이런식으로 식이 진행되었으면 합니다.
1차매수 또는 2차매수까지 매수가 진행후
주가가 올랐다가 떨어져도 이익보전 매도가 일어났으면 합니다.
아래식은 이익보전이
1차 2차 3차 까지 일어나야 실행이되고
1차만 2차까지 매수된 상태에서는 적용이 안되는거 같아서요~
확인 부탁드립니다. 감사합니다~
input : 금액(3000000),P(400);
var1 = ma(C,P);
if MarketPosition == 0 and L > var1*1.015 and ExitDate(1) != sdate Then
buy("1차매수",atlimit,var1*1.015,Floor((금액*0.7)/min(NextBarOpen,var1*1.015)));
if MarketPosition == 1 then
{
if MaxEntries == 1 and L > var1 Then
buy("2차매수",atlimit,var1,Floor((금액*0.2)/min(NextBarOpen,var1)));
if MaxEntries == 2 and L > var1*0.97 Then
buy("3차매수",atlimit,var1*0.97,Floor((금액*0.1)/min(NextBarOpen,var1*0.97)));
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "5%매도" Then
Condition1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "10%매도" Then
Condition2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "15%매도" Then
Condition3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "3%보전" Then
Condition11 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "1.5%보전" Then
Condition12 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "8%보전" Then
Condition21 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "6%보전" Then
Condition22 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "13%보전" Then
Condition31 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "11%보전" Then
Condition32 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "7%손절" Then
Condition4 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "10%손절" Then
Condition5 = true;
if Condition1 == false Then
ExitLong("5%매도",atlimit,AvgEntryPrice*1.05,"",Floor(CurrentContracts*0.3),1);
if Condition2 == false Then
ExitLong("10%매도",atlimit,AvgEntryPrice*1.10,"",Floor(CurrentContracts*0.5),1);
if Condition3 == false Then
ExitLong("15%매도",atlimit,AvgEntryPrice*1.15);
if Condition1 == true then
{
if Condition11 == false Then
ExitLong("3%보전",AtStop,AvgEntryPrice*1.03,"",Floor(CurrentContracts*0.5),1);
if Condition12 == false Then
ExitLong("1.5%보전",AtStop,AvgEntryPrice*1.015);
}
if Condition2 == true then
{
if Condition21 == false Then
ExitLong("8%보전",AtStop,AvgEntryPrice*1.08,"",Floor(CurrentContracts*0.5),1);
if Condition22 == false Then
ExitLong("6%보전",AtStop,AvgEntryPrice*1.06);
}
if Condition3 == true then
{
if Condition31 == false Then
ExitLong("13%보전",AtStop,AvgEntryPrice*1.13,"",Floor(CurrentContracts*0.5),1);
if Condition32 == false Then
ExitLong("11%보전",AtStop,AvgEntryPrice*1.11);
}
if Condition4 == false Then
ExitLong("7%손절",AtStop,AvgEntryPrice*0.93,"",Floor(CurrentContracts*0.7),1);
if Condition5 == false Then
ExitLong("10%손절",AtStop,AvgEntryPrice*0.90);
}
Else
{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition31 = false;
Condition31 = false;
Condition4 = false;
Condition5 = false;
}
다음글
이전글