예스스탁
예스스탁 답변
2022-10-20 14:07:52
안녕하세요
예스스탁입니다.
input : Exit_PT(500),Exit_LPT(250),BuyProfit(250),SellProfit(250),StopTick(250);
input : TradingStartTime1(105000),TradingEndTime1(033500);
var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0);
input : FastPeriod(55), SlowPeriod(150), SignalPeriod(80);
var : v0(0),v1(0),cond44(False);
v0 = MACD(FastPeriod, SlowPeriod);
v1 = Ema(v0, SignalPeriod);
if Bdate != Bdate[1] Then
{
ProfitPoint = 0;
Today_P = 0;
Pre_NetProfit = NetProfit;
condition99 = false;
condition88 = false;
}
Today_P = NetProfit - Pre_NetProfit;
myOpenProfit = OpenPositionProfit;
If (Today_P + myOpenProfit) >= (Exit_PT * PriceScale ) Then
condition99 = true;
If (Today_P + myOpenProfit) <= (-Exit_LPT * PriceScale) Then
condition88 = true;
if (sdate != sdate[1] and stime >= TradingEndTime1) or
(sdate == sdate[1] and stime >= TradingEndTime1 and stime[1] < TradingEndTime1) Then
{
COND44 = False;
if MarketPosition <> 0 Then
{
ExitLong("마감 매수 청산");
ExitShort("마감 매도 청산");
}
}
if (sdate != sdate[1] and stime >= TradingStartTime1) or
(sdate == sdate[1] and stime >= TradingStartTime1 and stime[1] < TradingStartTime1) Then
COND44 = true;
ProfitPoint = Exit_PT * PriceScale - Today_P - myOpenProfit;
LossPoint = Exit_LPT * PriceScale + Today_P + myOpenProfit;
if 1 == MarketPosition then
{
ExitLong("매수 익절마감", Atlimit, close + ProfitPoint);
ExitLong("매수 손절마감", AtStop, close - LossPoint);
ExitLong("매수 청산", Atlimit, EntryPrice + BuyProfit * PriceScale );
}
if -1 == MarketPosition then
{
ExitShort("매도 익절마감", Atlimit, close - ProfitPoint);
ExitShort("매도 손절마감", AtStop, close + LossPoint);
ExitShort("매도 청산", Atlimit, EntryPrice - SellProfit * PriceScale );
}
if Cond44 And false == condition99 And false == condition88 Then
{
if CrossUp(v0,v1) Then
Buy("매수");
if CrossDown(v0,v1) Then
Sell("매도");
}
SetStopLoss(StopTick * PriceScale,pointstop);
즐거운 하루되세요
> jyck 님이 쓴 글입니다.
> 제목 : 시그널메이커를 변환하고 싶습니다.
> 안녕하세요?
아래 시스템트레이딩 수식은 시그널메이커에서 사용하는 수식입니다.
예스트레이더를 사용하려니 변환이 필요합니다.
도와주세요~~~
input : Exit_PT(500),Exit_LPT(250),BuyProfit(250),SellProfit(250),StopTick(250);
var :SP(0);
Params : TradingStartTime1(105000),TradingEndTime1(033500);
var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0);
Params : FastPeriod(55), SlowPeriod(150), SignalPeriod(80);
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);