아래수식은 buy, sell reverse 거래에 사용하는 청산식입니다.
진입수식 신호에 따라 buy 진입이 먼저일 수도, sell 진입이 먼저일 수도 있습니다.
총 2회만 진입합니다.
이 수식을 변형코자 합니다.
buy 진입이 먼저일 때
{
buy 청산식
sell 청산식
}
sell 진입이 먼저일 때
{
buy 청산식
sell 청산식
}
이렇게 2가지 경우로 나누어 부탁드립니다.
항상 고맙습니다.
************************************************************************************
if MarketPosition== 1 Then
{
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop,1);
}
else if MarketPosition== -1 Then
{
SetStopLoss(1.5,PointStop);
SetStopTrailing(3,0,PointStop,1);
}
Else
{
SetStopLoss(0);
SetStopTrailing(0);
}
답변 1
예스스탁
예스스탁 답변
2024-06-05 10:04:37
안녕하세요
예스스탁입니다.
진입회수 카운트해서 첫진입일때와 두번째일때로 구분하시면 됩니다.
var : entry(0);
if Bdate != Bdate[1] Then
entry = 0;
if ( MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if MarketPosition== 1 Then
{
if entry == 1 Then
{
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop,1);
}
if entry == 2 Then
{
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop,1);
}
}
else if MarketPosition== -1 Then
{
if entry == 1 Then
{
SetStopLoss(1.5,PointStop);
SetStopTrailing(3,0,PointStop,1);
}
if entry == 2 Then
{
SetStopLoss(1.5,PointStop);
SetStopTrailing(3,0,PointStop,1);
}
}
Else
{
SetStopLoss(0);
SetStopTrailing(0,0);
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 아래수식은 buy, sell reverse 거래에 사용하는 청산식입니다.
진입수식 신호에 따라 buy 진입이 먼저일 수도, sell 진입이 먼저일 수도 있습니다.
총 2회만 진입합니다.
이 수식을 변형코자 합니다.
buy 진입이 먼저일 때
{
buy 청산식
sell 청산식
}
sell 진입이 먼저일 때
{
buy 청산식
sell 청산식
}
이렇게 2가지 경우로 나누어 부탁드립니다.
항상 고맙습니다.
************************************************************************************
if MarketPosition== 1 Then
{
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop,1);
}
else if MarketPosition== -1 Then
{
SetStopLoss(1.5,PointStop);
SetStopTrailing(3,0,PointStop,1);
}
Else
{
SetStopLoss(0);
SetStopTrailing(0);
}