커뮤니티
손절,trailing stop 적용
2018-04-04 11:31:52
154
글번호 117942
아래 수식은 1차 진입과 2차 진입이 가능한 수식이며
buy진입과 sell진입이 구별된 수식입니다.
각각 1차진입 손절,tr stop과 2차진입 손절,tr stop을 구별하는 수식을 원하며 input에 반영해주세요.
1.buy수식
- input:
1차진입 손절(20),tr stop(20)
2차진입 손절(20),tr stop(20)
2.sell수식
- input:
1차진입 손절(20),tr stop(20)
2차진입 손절(20),tr stop(20)
*************************************************************
1. buy수식
input : b1(11),b2(13),진입시간(090000);
var : T1(0),entry(0),HH(0),EL(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and
C <= DayHigh-PriceScale*b1 and C[1] > DayHigh-PriceScale*b1 Then
buy("b1");
if TotalTrades > TotalTrades[1] Then
HH = H;
if H > HH Then
HH = H;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C <= HH-PriceScale*b2 and C[1] > HH-PriceScale*b2 Then
buy("b2");
2. sell 수식
input : s1(20),s2(20),진입시간(090000);
var : T1(0),entry(0),LL(0),EH(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and C >= daylow+PriceScale*s1 and C[1] < daylow+PriceScale*s1 Then
sell("s1");
if TotalTrades > TotalTrades[1] Then
LL = L;
if L < LL Then
LL = L;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C >= LL+PriceScale*s2 and C[1] < LL+PriceScale*s2 Then
sell("s2");
답변 1
예스스탁 예스스탁 답변
2018-04-04 13:29:31
안녕하세요
예스스탁입니다.
1
input : b1(11),b2(13),진입시간(090000);
input : 손절1(20),TR1(20);
input : 손절2(20),TR2(20);
var : T1(0),entry(0),HH(0),EL(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and
C <= DayHigh-PriceScale*b1 and C[1] > DayHigh-PriceScale*b1 Then
buy("b1");
if TotalTrades > TotalTrades[1] Then
HH = H;
if H > HH Then
HH = H;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C <= HH-PriceScale*b2 and C[1] > HH-PriceScale*b2 Then
buy("b2");
if MarketPosition == 1 then
{
if IsExitName("b1") == true then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR1);
}
if IsExitName("b2") == true then
{
ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2);
ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*TR2);
}
}
2
input : s1(20),s2(20),진입시간(090000);
input : 손절1(20),TR1(20);
input : 손절2(20),TR2(20);
var : T1(0),entry(0),LL(0),EH(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and C >= daylow+PriceScale*s1 and C[1] < daylow+PriceScale*s1 Then
sell("s1");
if TotalTrades > TotalTrades[1] Then
LL = L;
if L < LL Then
LL = L;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C >= LL+PriceScale*s2 and C[1] < LL+PriceScale*s2 Then
sell("s2");
if MarketPosition == -1 then
{
if IsExitName("s1") == true then
{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR1);
}
if IsExitName("s2") == true then
{
ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2);
ExitShort("str2",AtStop,Lowest(l,BarsSinceEntry)+PriceScale*TR2);
}
}
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 손절,trailing stop 적용
> 아래 수식은 1차 진입과 2차 진입이 가능한 수식이며
buy진입과 sell진입이 구별된 수식입니다.
각각 1차진입 손절,tr stop과 2차진입 손절,tr stop을 구별하는 수식을 원하며 input에 반영해주세요.
1.buy수식
- input:
1차진입 손절(20),tr stop(20)
2차진입 손절(20),tr stop(20)
2.sell수식
- input:
1차진입 손절(20),tr stop(20)
2차진입 손절(20),tr stop(20)
*************************************************************
1. buy수식
input : b1(11),b2(13),진입시간(090000);
var : T1(0),entry(0),HH(0),EL(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and
C <= DayHigh-PriceScale*b1 and C[1] > DayHigh-PriceScale*b1 Then
buy("b1");
if TotalTrades > TotalTrades[1] Then
HH = H;
if H > HH Then
HH = H;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C <= HH-PriceScale*b2 and C[1] > HH-PriceScale*b2 Then
buy("b2");
2. sell 수식
input : s1(20),s2(20),진입시간(090000);
var : T1(0),entry(0),LL(0),EH(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 and stime >= 진입시간 and C >= daylow+PriceScale*s1 and C[1] < daylow+PriceScale*s1 Then
sell("s1");
if TotalTrades > TotalTrades[1] Then
LL = L;
if L < LL Then
LL = L;
if MarketPosition == 0 and entry == 1 and stime >= 진입시간 and C >= LL+PriceScale*s2 and C[1] < LL+PriceScale*s2 Then
sell("s2");
다음글