커뮤니티
부탁드립니다.
2015-12-22 13:11:14
100
글번호 93689
if MarketPosition <= 0 Then
buy("b",AtStop,dayopen+0.5);
if MarketPosition >= 0 Then
sell("s",AtStop,dayopen-0.5);
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/0.5);
exitlong("bx",AtStop,EntryPrice-0.5+(0.5*var1));
}
if MarketPosition == -1 Then{
var2 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/0.5);
ExitShort("sx",AtStop,EntryPrice+0.5-(0.5*var1));
}
위의 수식에 마틴게일방법을 대입 시킬수 있을까요?? 주석달려있는식과 없는식을따로 주시면 감사하겠습니다.
답변 1
예스스탁 예스스탁 답변
2015-12-22 16:33:26
안녕하세요
예스스탁입니다
주석은 이전 답변에 달아드렸습니다.
1.
input : 기본수량(1);
#무포지션상태
if MarketPosition == 0 then {
#이전 거래가 수익이면 기본수량으로 매수
if PositionProfit(1) >= 0 Then
buy("b1",AtStop,dayopen+0.5,기본수량);
Else#이전 거래가 손실이면 이전거래수량의 두배로 매수
buy("b2",AtStop,dayopen+0.5,MaxContracts(1)*2);
}
#매도포지션 상태에서 스위칭
if MarketPosition == -1 then {
#현재 거래가 수익이면 기본수량으로 매수
if PositionProfit >= 0 Then
buy("sb1",AtStop,dayopen+0.5,기본수량);
Else#현재 거래가 손실이면 현재거래수량의 두배로 매수
buy("sb2",AtStop,dayopen+0.5,MaxContracts*2);
}
#무포지션 상태
if MarketPosition == 0 Then{
#이전 거래가 수익이면 기본수량으로 매도
if PositionProfit(1) >= 0 Then
sell("s1",AtStop,dayopen-0.5,기본수량);
Else#이전 거래가 손실이면 이전거래수량의 두배로 매도
sell("s2",AtStop,dayopen-0.5,MaxContracts(1)*2);
}
#매수포지션 상태에서 스위칭
if MarketPosition == 1 Then{
#현재 거래가 수익이면 기본수량으로 매수
if PositionProfit >= 0 Then
sell("bs1",AtStop,dayopen-0.5,기본수량);
Else#현재 거래가 손실이면 현재거래수량의 두배로 매도
sell("bs2",AtStop,dayopen-0.5,MaxContracts*2);
}
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/0.5);
exitlong("bx",AtStop,EntryPrice-0.5+(0.5*var1));
}
if MarketPosition == -1 Then{
var2 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/0.5);
ExitShort("sx",AtStop,EntryPrice+0.5-(0.5*var1));
}
2
input : 기본수량(1);
if MarketPosition == 0 then {
if PositionProfit(1) >= 0 Then
buy("b1",AtStop,dayopen+0.5,기본수량);
Else
buy("b2",AtStop,dayopen+0.5,MaxContracts(1)*2);
}
if MarketPosition == -1 then {
if PositionProfit >= 0 Then
buy("sb1",AtStop,dayopen+0.5,기본수량);
Else
buy("sb2",AtStop,dayopen+0.5,MaxContracts*2);
}
if MarketPosition == 0 Then{
if PositionProfit(1) >= 0 Then
sell("s1",AtStop,dayopen-0.5,기본수량);
Else
sell("s2",AtStop,dayopen-0.5,MaxContracts(1)*2);
}
if MarketPosition == 1 Then{
if PositionProfit >= 0 Then
sell("bs1",AtStop,dayopen-0.5,기본수량);
Else
sell("bs2",AtStop,dayopen-0.5,MaxContracts*2);
}
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/0.5);
exitlong("bx",AtStop,EntryPrice-0.5+(0.5*var1));
}
if MarketPosition == -1 Then{
var2 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/0.5);
ExitShort("sx",AtStop,EntryPrice+0.5-(0.5*var1));
}
즐거운 하루되세요
> 아가리똥내 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> if MarketPosition <= 0 Then
buy("b",AtStop,dayopen+0.5);
if MarketPosition >= 0 Then
sell("s",AtStop,dayopen-0.5);
if MarketPosition == 1 Then{
var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/0.5);
exitlong("bx",AtStop,EntryPrice-0.5+(0.5*var1));
}
if MarketPosition == -1 Then{
var2 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/0.5);
ExitShort("sx",AtStop,EntryPrice+0.5-(0.5*var1));
}
위의 수식에 마틴게일방법을 대입 시킬수 있을까요?? 주석달려있는식과 없는식을따로 주시면 감사하겠습니다.