예스스탁
예스스탁 답변
2021-03-03 14:01:08
안녕하세요
예스스탁입니다.
input : Exit_PT(200),Exit_LPT(200),BuyProfit(150),SellProfit(150),StopTick(100);
var : SP(0),V0(0),V1(0),Cond44(False);
input : TradingStartTime1(090000),TradingEndTime1(045400);
var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0);
input : FastPeriod(92), SlowPeriod(109), SignalPeriod(85);
SP = MarketPosition;
TickPoint = PriceScale;
V0 = MACD(FastPeriod, SlowPeriod);
V1 = XAverage(V0, SignalPeriod);
if sTime == 090000 Or (sTime >= 090000 And (sTime[1] < 090000 Or bDate<>bdate[1])) Then
Begin
ProfitPoint = 0;
Today_P = 0;
Pre_NetProfit = NetProfit[1];
condition99 = false;
condition88 = false;
End;
Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익
myOpenProfit = OpenPositionProfit;
If (Today_P + myOpenProfit) >= (Exit_PT * TickPoint ) Then
condition99 = true;
If (Today_P + myOpenProfit) <= (-Exit_LPT * TickPoint) Then
condition88 = true;
if TradingStartTime1 < TradingEndTime1 Then
Begin
If TradingStartTIME1 <= sTIME And sTIME <= TradingEndTIME1 Then
COND44 = True;
Else
COND44 = False;
End
Else
Begin
If TradingStartTIME1 <= sTIME Or sTIME <= TradingEndTIME1 Then
COND44 = True;
Else
COND44 = False;
End;
If Cond44 == False Then
Begin
if SP <> 0 Then
Begin
ExitLong("마감 매수 청산",OnClose,def,def,CurrentContracts);
ExitShort("마감 매도 청산",OnClose,def,def,CurrentContracts);
End;
Cond44 = False;
End;
ProfitPoint = Exit_PT * TickPoint - Today_P - myOpenProfit;
LossPoint = Exit_LPT * TickPoint + Today_P + myOpenProfit;
if 1 == Sp then
Begin
ExitLong("매수 익절마감", Atlimit, close + ProfitPoint);
ExitLong("매수 손절마감", AtStop, close - LossPoint);
ExitLong("매수 청산", Atlimit, EntryPrice + BuyProfit * TickPoint );
End
Else if -1 == Sp then
Begin
ExitShort("매도 익절마감", Atlimit, close - ProfitPoint);
ExitShort("매도 손절마감", AtStop, close + LossPoint);
ExitShort("매도 청산", Atlimit, EntryPrice - SellProfit * TickPoint );
End;
//지정한 시간대에만 거래
if Cond44 And false == condition99 And false == condition88 Then
Begin
if CrossUp(V0,V1) Then
Buy("매수");
Else if CrossDown(V0,V1) Then
Sell("매도");
End;
SetStopLoss(StopTick * TickPoint,pointstop);
//Trailing 적용하기
input : up_price1(135), dn_price1(100), up_price2(100), dn_price2(80),up_price3(50), dn_price3(1);
var : TickSize(0);
TickSize = PriceScale;
If MaxPositionProfit < TickSize * (up_price1 + 10) Then
SetStopTrailing(TickSize * dn_price1, TickSize * up_price1,PointStop);
Else if MaxPositionProfit < TickSize * (up_price2 + 10) Then
setstopTrailing(TickSize * dn_price2, TickSize * up_price2,PointStop);
Else
SetStopTrailing(TickSize * dn_price3, TickSize * up_price3,PointStop);
즐거운 하루되세요
> jyck 님이 쓴 글입니다.
> 제목 : 시그널메이커를 예스로요~
> 안녕하세요?
시그널메이커에서 예스로 이사중입니다.꼭좀 변환 부탁드립니다.^^
input : Exit_PT(200),Exit_LPT(200),BuyProfit(150),SellProfit(150),StopTick(100);
var :SP(0);
Params : TradingStartTime1(090000),TradingEndTime1(045400);
var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0);
Params : FastPeriod(92), SlowPeriod(109), SignalPeriod(85);
SP = SignalPosition;
TickPoint = OneTick * PriceScale;
V0 = MACD(C, FastPeriod, SlowPeriod);
V1 = XAverage(V0, SignalPeriod);
if Time = 090000 Or (Time >= 090000 And (Time[1] < 090000 Or Date<>date[1])) Then
Begin
ProfitPoint = 0;
Today_P = 0;
Pre_NetProfit = NetProfit[1];
condition99 = false;
condition88 = false;
End;
Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익
myOpenProfit = OpenPositionProfit;
If (Today_P + myOpenProfit) >= (Exit_PT * TickPoint ) Then
condition99 = true;
If (Today_P + myOpenProfit) <= (-Exit_LPT * TickPoint) Then
condition88 = true;
if TradingStartTime1 < TradingEndTime1 Then
Begin
If TradingStartTIME1 <= TIME And TIME <= TradingEndTIME1 Then COND44 = True
Else COND44 = False;
End
Else
Begin
If TradingStartTIME1 <= TIME Or TIME <= TradingEndTIME1 Then COND44 = True
Else COND44 = False;
End;
If Cond44 = False Then
Begin
if SP <> 0 Then
Begin
ExitLong("마감 매수 청산",OnClose,def,def,CurrentContracts);
ExitShort("마감 매도 청산",OnClose,def,def,CurrentContracts);
End;
Cond44 = False;
End;
ProfitPoint = Exit_PT * TickPoint? - Today_P - myOpenProfit;
LossPoint = Exit_LPT * TickPoint + Today_P + myOpenProfit;
if 1 = Sp then
Begin
ExitLong("매수 익절마감", Atlimit, close + ProfitPoint);
ExitLong("매수 손절마감", AtStop, close - LossPoint);
ExitLong("매수 청산", Atlimit, EntryPrice + BuyProfit * TickPoint );
End
Else if -1 = Sp then
Begin
ExitShort("매도 익절마감", Atlimit, close - ProfitPoint);
ExitShort("매도 손절마감", AtStop, close + LossPoint);
ExitShort("매도 청산", Atlimit, EntryPrice - SellProfit * TickPoint );
End;
//지정한 시간대에만 거래
if Cond44 And false = condition99 And false = condition88 Then
Begin
if CrossUp(V0,V1) Then
Buy("매수")
Else if CrossDown(V0,V1) Then
Sell("매도");
End;
SetStopLoss(StopTick * TickPoint * currentcontracts ,pointstop);
//Trailing 적용하기
Params : up_price1(135), dn_price1(100), up_price2(100), dn_price2(80),up_price3(50), dn_price3(1);
var : TickSize(0);
TickSize = OneTick * PriceScale;
If MaxContractProfit < TickSize * (up_price1 + 10) Then SetStopTrailing(TickSize * dn_price1, TickSize * up_price1)
Else if MaxContractProfit < TickSize * (up_price2 + 10) Then setstopTrailing(TickSize * dn_price2, TickSize * up_price2)
Else SetStopTrailing(TickSize * dn_price3, TickSize * up_price3);