커뮤니티
2가지 매도 적용방법 구현요청 드립니다.
2018-09-02 22:54:22
132
글번호 121803
아래와 같이 로직을 짜면.....
Condition1=false; Condition2=false; Condition3=false; Condition4=false;
Condition1 = ma(c,5);
Condition2 = ma(c,10);
Condition3 = ma(c,20);
Condition4 = ma(c,30);
if (Condition1 == True or Condition2 == True or Condition3 == True or Condition4 == True ) then buy("매수");
SetStopProfittarget(PriceScale*40,PointStop);
SetStopLoss(PriceScale*30,PointStop);
위와같이 로직을 짜면 손절및 이익 을 2가지로 할수는 없나요?
아래과 같이 두개를 하나로 합치면서 이익및 손실을 두가지로 구현 불가 인가요?
if (Condition1 == True or Condition2 == True ) then buy("매수1);
SetStopProfittarget(PriceScale*40,PointStop);
SetStopLoss(PriceScale*30,PointStop);
if (Condition3 == True or Condition4 == True ) then buy("매수2);
SetStopProfittarget(PriceScale*20,PointStop);
SetStopLoss(PriceScale*20,PointStop);
이것을 하나로는 불가능 한가요?
* 항상 많은 도움에 고맙습니다. 꾸벅..............
답변 1
예스스탁 예스스탁 답변
2018-09-06 10:03:33
안녕하세요
예스스탁입니다.
진입조건별로 손절과 익절을 다르게 하고자 하시면 신호를 나누어야 하고
아래와 같이 강제청산도 이름을 지정해 처리하셔야 합니다.
if (Condition1 == True or Condition2 == True ) then
buy("매수1");
if (Condition3 == True or Condition4 == True ) then
buy("매수2");
if MarketPosition == 1 and IsEntryName("매수1") == true Then
{
SetStopProfittarget(PriceScale*40,PointStop);
SetStopLoss(PriceScale*40,PointStop);
}
else if MarketPosition == 1 and IsEntryName("매수2") == true Then
{
SetStopProfittarget(PriceScale*20,PointStop);
SetStopLoss(PriceScale*20,PointStop);
}
Else
{
#지정한 이름의 진입이 아니면 모두 해제
SetStopProfittarget(0);
SetStopLoss(0);
}
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 2가지 매도 적용방법 구현요청 드립니다.
> 아래와 같이 로직을 짜면.....
Condition1=false; Condition2=false; Condition3=false; Condition4=false;
Condition1 = ma(c,5);
Condition2 = ma(c,10);
Condition3 = ma(c,20);
Condition4 = ma(c,30);
if (Condition1 == True or Condition2 == True or Condition3 == True or Condition4 == True ) then buy("매수");
SetStopProfittarget(PriceScale*40,PointStop);
SetStopLoss(PriceScale*30,PointStop);
위와같이 로직을 짜면 손절및 이익 을 2가지로 할수는 없나요?
아래과 같이 두개를 하나로 합치면서 이익및 손실을 두가지로 구현 불가 인가요?
if (Condition1 == True or Condition2 == True ) then buy("매수1);
SetStopProfittarget(PriceScale*40,PointStop);
SetStopLoss(PriceScale*30,PointStop);
if (Condition3 == True or Condition4 == True ) then buy("매수2);
SetStopProfittarget(PriceScale*20,PointStop);
SetStopLoss(PriceScale*20,PointStop);
이것을 하나로는 불가능 한가요?
* 항상 많은 도움에 고맙습니다. 꾸벅..............
다음글
이전글