커뮤니티
수식문의
2018-11-09 14:49:53
158
글번호 123526
아래는 피라미딩 시 손절을 강제청산함수로 사용한 수식입니다.
1.익절
2.트레일링stop
위 2가지 내용도 강제청산함수로 바꿔주시기 바랍니다.
*************************************************************************
손절을 진입별로 지정하기 위해서는
강제청산함수로 지정하시면 됩니다.
input : up손절(74),up익절(192),upTR(130);
input : dn손절(74),dn익절(180),dnTR(110);
if MarketPosition == 1 then
{
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR);
}
if MarketPosition == -1 then
{
ExitShort("sp1",AtLimit,EntryPrice-pricescale*dn익절);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+pricescale*dnTR);
}
if MarketPosition == 1 Then
SetStopLoss(PriceScale*up손절,PointStop);
else if MarketPosition == -1 Then
SetStopLoss(PriceScale*dn손절,PointStop);
Else
SetStopLoss(0);
답변 1
예스스탁 예스스탁 답변
2018-11-12 11:31:35
안녕하세요
예스스탁입니다.
익절만 처리해 드립니다.
트레일링stop의 경우 강제청삼함수에는 최소수익값이 필요합니다.
수식에는 해당 내용이 없이 단순 진입이후 최고가와 최저가가 기준입니다.
input : up손절(74),up익절(192),upTR(130);
input : dn손절(74),dn익절(180),dnTR(110);
if MarketPosition == 1 then
{
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR);
}
if MarketPosition == -1 then
{
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+pricescale*dnTR);
}
if MarketPosition == 1 Then
{
SetStopLoss(PriceScale*up손절,PointStop);
SetStopProfittarget(PriceScale*up익절,PointStop);
}
else if MarketPosition == -1 Then
{
SetStopLoss(PriceScale*dn손절,PointStop);
SetStopProfittarget(PriceScale*dn익절,PointStop);
}
Else
{
SetStopLoss(0);
SetStopProfittarget(0);
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 수식문의
> 아래는 피라미딩 시 손절을 강제청산함수로 사용한 수식입니다.
1.익절
2.트레일링stop
위 2가지 내용도 강제청산함수로 바꿔주시기 바랍니다.
*************************************************************************
손절을 진입별로 지정하기 위해서는
강제청산함수로 지정하시면 됩니다.
input : up손절(74),up익절(192),upTR(130);
input : dn손절(74),dn익절(180),dnTR(110);
if MarketPosition == 1 then
{
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR);
}
if MarketPosition == -1 then
{
ExitShort("sp1",AtLimit,EntryPrice-pricescale*dn익절);
ExitShort("str1",AtStop,Lowest(l,BarsSinceEntry)+pricescale*dnTR);
}
if MarketPosition == 1 Then
SetStopLoss(PriceScale*up손절,PointStop);
else if MarketPosition == -1 Then
SetStopLoss(PriceScale*dn손절,PointStop);
Else
SetStopLoss(0);
다음글
이전글