커뮤니티
부탁드립니다.
2019-07-25 20:43:51
189
글번호 130647
청산식 추가 요청드립니다.
기존에 만들어 주신 수식이 잘 동작하지 않고 있습니다.
//매도 진입 수가 5개 이상이고 전체 수익이 +100틱 이상 찍고 다시 0까지 내려가면 청산
//매수 진입 수가 5개 이상이고 전체 수익이 +100틱 이상 찍고 다시 0까지 내려가면 청산
var : ll(0),hh(0);
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = L;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if ll <= AvgEntryPrice-(PriceScale*500)/CurrentContracts Then
ExitShort("sp2",AtStop,LL+(AvgEntryPrice-LL)*0.01);
//매도 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and ll <= AvgEntryPrice-(PriceScale*100)/CurrentContracts Then
ExitShort("sl2",AtStop,AvgEntryPrice);
}
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = l;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if hh >= AvgEntryPrice+(PriceScale*500)/CurrentContracts Then
ExitLong("bp2",AtStop,hh-(hh-AvgEntryPrice)*0.01);
//매수 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and hh >= AvgEntryPrice+(PriceScale*100)/CurrentContracts Then
ExitLong("bl2",AtStop,AvgEntryPrice);
}
답변 1
예스스탁 예스스탁 답변
2019-07-26 11:52:35
안녕하세요
예스스탁입니다.
현재 수익을 새로운 진입이 발생하면 다시 평단가 기준으로 100틱이 발생했었는지 체크합니다.
피라미딩상 5개의 수량이 되기 전에 100틱이상 발생한 것도 포함되게 수정해 드립니다.
var : ll(0),hh(0);
if index == 0 Then
buy();
if index == 100 Then
buy();
if index == 200 Then
buy();
if index == 300 Then
buy();
if index == 400 Then
buy();
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = L;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if ll <= AvgEntryPrice-(PriceScale*500)/CurrentContracts Then
ExitShort("sp2",AtStop,LL+(AvgEntryPrice-LL)*0.01);
//매도 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and MaxPositionProfit >= PriceScale*100 Then
ExitShort("sl2",AtStop,AvgEntryPrice);
}
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = l;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
#if hh >= AvgEntryPrice+(PriceScale*500)/CurrentContracts Then
# ExitLong("bp2",AtStop,hh-(hh-AvgEntryPrice)*0.01);
//매수 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and MaxPositionProfit >= PriceScale*100 Then
ExitLong("bl2",AtStop,AvgEntryPrice);
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 청산식 추가 요청드립니다.
기존에 만들어 주신 수식이 잘 동작하지 않고 있습니다.
//매도 진입 수가 5개 이상이고 전체 수익이 +100틱 이상 찍고 다시 0까지 내려가면 청산
//매수 진입 수가 5개 이상이고 전체 수익이 +100틱 이상 찍고 다시 0까지 내려가면 청산
var : ll(0),hh(0);
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = L;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if ll <= AvgEntryPrice-(PriceScale*500)/CurrentContracts Then
ExitShort("sp2",AtStop,LL+(AvgEntryPrice-LL)*0.01);
//매도 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and ll <= AvgEntryPrice-(PriceScale*100)/CurrentContracts Then
ExitShort("sl2",AtStop,AvgEntryPrice);
}
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
hh = h;
ll = l;
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if hh >= AvgEntryPrice+(PriceScale*500)/CurrentContracts Then
ExitLong("bp2",AtStop,hh-(hh-AvgEntryPrice)*0.01);
//매수 진입 수가 5개 이상이고 전체 수익이 +100틱 이상이었다가 다시 0이 되면 청산
if CurrentContracts >= 5 and hh >= AvgEntryPrice+(PriceScale*100)/CurrentContracts Then
ExitLong("bl2",AtStop,AvgEntryPrice);
}
다음글
이전글