예스스탁
예스스탁 답변
2020-03-05 14:31:52
안녕하세요
예스스탁입니다.
SetStopTrailing은 최소수익후 일정값 하락하면 청산입니다.
반대로 최소손실은 지정하셔야 합니다. 손절1로 지정하시면 됩니다.
input : 손절1(10);
var : BH(0),BL(0),SL(0),SH(0),HE(0),LE(0);
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
BL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 then
{
ExitLong("B익절1",AtStop,BH-(BH-EntryPrice)*익절1하락퍼센트);
}
if BL <= EntryPrice-PriceScale*손절1 then
{
ExitLong("B손절1",Atlimit,BL+PriceScale*5);
}
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
SH = Highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 then
{
ExitShort("S익절1",AtStop,SL+(EntryPrice-SL)*익절1하락퍼센트);
}
if BH >= EntryPrice+PriceScale*손절1 then
{
ExitShort("S손절1",Atlimit,BH-PriceScale*5);
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 아래식에서
SetStopTrailing의 최대 익절대비 5틱 하락시 청산과 같은 방법으로
SetStopLoss도 최대 손실 대비 5틱 상승시 청산으로 수정부탁드립니다.
청산 명령어가 없으면 1)식에서 최대한 같은 식으로 수정 부탁드립니다.
SetStopTrailing(5,익절,PointStop);
SetStopLoss(손절,PointStop);
1)식
var : BH(0),SL(0),HE(0),LE(0);
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 then{
ExitLong("B익절1",AtStop,BH-(BH-EntryPrice)*익절1하락퍼센트); }
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 then{
ExitShort("S익절1",AtStop,SL+(EntryPrice-SL)*익절1하락퍼센트); }
}