예스스탁
예스스탁 답변
2020-01-29 10:15:27
안녕하세요
예스스탁입니다.
첫번째 전략만 변환이 가능합니다.
이하 2개의 전략은 예스랭귀지에서 지원하지 않는 함수함수들이 있어 변환이 가능하지 않습니다.
Inputs:
TradeUnit(100),
Band1(0), // Should be between 0 and 1
Band2(0), // Should be between 0 and 1
ExitBand(0); // Should be between 0 and .5
Variables:
Support(0), Resistance(0);
If CurrentBar == 1 then Begin
Support = C;
Resistance = C;
End;
If sTime >= 93000 and time <= 100000 then begin
If Close > Resistance then begin
Resistance = Close;
End;
If Close < Support then begin
Support = Close;
End;
End;
#-----------
If sTime > 100000 and stime < 150000 then begin
#-----------
#{ Long Entry }
If Close <= (Resistance + Band1) and Close >= (Resistance - Band2) and Close > Close[1] and marketposition == 0 then begin
Buy("b",AtMarket,def,TradeUnit);
End;
#{ Long Exit }
If marketposition == 1 and marketposition == marketposition(1) then begin
ExitLong("bx1",AtStop,Close - ExitBand);
End;
#{ Long Money Management }
If marketposition == 1 and (Close - EntryPrice)*TradeUnit <= -75 then begin
ExitLong("bx2",AtMarket);
End;
#{ Short Entry }
If Close <= (Support + Band2) and Close >= (Support - Band1) and Close < Close[1] and marketposition == 0 then begin
Sell("s",AtMarket);
End;
#{ Short Exit }
If marketposition == -1 and marketposition == marketposition(1) then begin
ExitShort("sx1",AtStop,Close + ExitBand);
End;
#{ Short Money Management }
If marketposition == -1 and (EntryPrice - Close)*TradeUnit <= -75 then begin
ExitShort("sx2",AtMarket);
End;
end;
즐거운 하루되세요
> 양치기 님이 쓴 글입니다.
> 제목 : 시스템식 부탁드립니다.
> 항상 도움 주셔서 감사합니다.
아래의 Easy Language Code 코드를 예스랭귀지로 변환 부탁드립니다.
감사합니다.
#----------------
# 요청 시스템1
#----------------
Inputs:
TradeUnit(100),
Band1(0), // Should be between 0 and 1
Band2(0), // Should be between 0 and 1
ExitBand(0); // Should be between 0 and .5
Variables:
Support(0), Resistance(0);
If CurrentBar = 1 then Begin
Support = C;
Resistance = C;
End;
If time >= 930 and time <= 1000 then begin
If Close > Resistance then begin
Resistance = Close;
End;
If Close < Support then begin
Support = Close;
End;
End;
#-----------
If time > 1000 and time < 1500 then begin
#-----------
{ Long Entry }
If Close <= (Resistance + Band1) and Close >= (Resistance - Band2) and Close > Close[1] and marketposition = 0 then begin
Buy TradeUnit shares next bar market;
End;
{ Long Exit }
If marketposition = 1 and marketposition = marketposition(1) then begin
Sell TradeUnit shares next bar at (Close - ExitBand) stop;
End;
{ Long Money Management }
If marketposition = 1 and (Close - EntryPrice)*TradeUnit <= -75 then begin
Sell TradeUnit shares next bar market;
End;
{ Short Entry }
If Close <= (Support + Band2) and Close >= (Support - Band1) and Close < Close[1] and marketposition = 0 then begin
Sell short TradeUnit shares next bar market;
End;
{ Short Exit }
If marketposition = -1 and marketposition = marketposition(1) then begin
Buy to cover TradeUnit shares next bar at (Close + ExitBand) stop;
End;
{ Short Money Management }
If marketposition = -1 and (EntryPrice - Close)*TradeUnit <= -75 then begin
Buy to Cover TradeUnit shares next bar market;
End;
#-----------
End;
#-----------
If time >= 1530 then begin
If marketposition = 1 then begin
Sell TradeUnit shares next bar market;
End;
If marketposition = -1 then begin
Buy to Cover TradeUnit shares next bar market;
End;
End;
#----------------
# 요청 시스템2
# Long-Only Strategy
#----------------
Input:
InitialBalance(100000), // The account size at start of trading
NDay(20) // How many days long is this systems basis (20 or 55 day) ;
Variables:
N(0), // Underlying volatility of the stock
DPP(Close), // Dollar per price of the stock
StopLoss(0), // Stop loss value
DollarRisk(0), // Dollar risk value T
radeUnit(100), // How much to trade based on idea that 1N
represents 1% of account equity
UnitsHeld(0), // How many units are currently held NotationalAccount(10000), // Notational Account, hard coded for testing purposes LastAccount(0), // Last account size to reevaluate drawdown Stop_On(False), // Stop loss boolean
Fast_Ave ( 0 ) , // Fast moving average value
Slow_Ave ( 0 ) , // Slow moving average value
Cross_Over (False); // Simple cross-over filter ;
{ Set-up }
Cross_Over = False;
Fast_Ave = Xaverage ( Close , 50 ) ;
Slow_Ave = Xaverage ( Close , 200 ) ;
If Fast_Ave > Slow_Ave and Slow_Ave > Slow_Ave [ 1 ] Then
Cross_Over = True;
{ Position Sizing }
N = VolatilityStdDev(NDay);
DPP = Close; // Price of the stock is equal to its close
DollarRisk = NotationalAccount * 0.01;
TradeUnit = IntPortion(DollarRisk/(N*DPP));
StopLoss = 2 * N;
// Decrease the size of the notational account if 10% drawdown
If NotationalAccount < (LastAccount * 0.9) Then Begin
NotationalAccount = NotationalAccount * 0.8;
Print(File("c: urtle_notational.txt"), NotationalAccount);
End
Else Begin
LastAccount = NotationalAccount;
End;
{ Entry }
// Do not even consider a trade if too many units are on the line
If UnitsHeld < 12 then Begin
// Enter if price exceeds by a single tick high of the preceding NDays)
If Close > HighD(NDay) and Cross_Over then Begin
If marketposition = 0 then begin
Buy ("Long") TradeUnit shares next bar market;
UnitsHeld = UnitsHeld + TradeUnit;
End;
If marketposition = 1 then begin
Buy ("Long more") (TradeUnit / 2) shares next bar market;
UnitsHeld = UnitsHeld + (TradeUnit / 2);
End;
End;
End;
{ Stop }
if ( Close - EntryPrice ) > StopLoss then begin
Stop_On = True;
End
Else begin
Stop_On = False;
End;
{ Exit}
If Close < LowD(NDay/2) and Stop_On then begin
Sell ("Long Exit") currentshares shares next bar market;
UnitsHeld = 0;
End;
#----------------
# 요청 시스템2
# Long-Only Strategy
#----------------
Input:
InitialBalance(100000), // The account size at start of trading
NDay(20) // How many days long is this systems basis (20 or 55 day) ;
Variables:
N(0), // Underlying volatility of the stock
DPP(Close), // Dollar per price of the stock
StopLoss(0), // Stop loss value
DollarRisk(0), // Dollar risk value
TradeUnit(100), // How much to trade based on idea that 1N represents 1% of account equity
UnitsHeld(0), // How many units are currently held NotationalAccount(10000), // Notational Account, hard coded for testing purposes LastAccount(0), // Last account size to reevaluate drawdown Stop_On(False), // Stop loss boolean
Fast_Ave ( 0 ) , // Fast moving average value
Slow_Ave ( 0 ) , // Slow moving average value
Cross_Over (False); // Simple cross-over filter ;
{ Set-up }
Cross_Over = False;
Fast_Ave = Xaverage ( Close , 50 ) ;
Slow_Ave = Xaverage ( Close , 200 ) ;
If Fast_Ave < Slow_Ave and Slow_Ave < Slow_Ave [ 1 ] Then
Cross_Over = True;
{ Position Sizing }
N = VolatilityStdDev(NDay);
DPP = Close; // Price of the stock is equal to its close
DollarRisk = NotationalAccount * 0.01;
TradeUnit = IntPortion(DollarRisk/(N*DPP));
StopLoss = 2 * N;
// Decrease the size of the notational account if 10% drawdown
If NotationalAccount < (LastAccount * 0.9) Then Begin
NotationalAccount = NotationalAccount * 0.8;
Print(File("c: urtle_short_notational.txt"), NotationalAccount);
End
Else Begin
LastAccount = NotationalAccount;
End;
{ Entry }
// Do not even consider a trade if too many units are on the line
#*
If UnitsHeld < 12 then Begin
#*
// Enter if price exceeds by a single tick high of the preceding NDays)
If Close < LowD(NDay) and Cross_Over then Begin
SellShort ("Short") N shares next bar market;
UnitsHeld = UnitsHeld + TradeUnit;
End;
If marketposition = -1 then begin
SellShort ("Short more") (N / 2) shares next bar market;
UnitsHeld = UnitsHeld + (TradeUnit / 2);
End;
End;
#*
End;
#*
{ Stop }
if ( Close - EntryPrice ) < StopLoss then begin
Stop_On = True;
End
Else begin
Stop_On = False;
End;
{ Exit}
If Close > HighD(NDay/2) and Stop_On then begin
BuyToCover ("Short Exit") currentshares shares next bar market;
UnitsHeld = 0;
End;