Q&A 게시판 HOME > Q&A 게시판
작성자 : 예스스탁 작성일 : 2021-06-23 10:51:57 조회수 : 319
Re:Hit the bulls eye 매수가 설정
안녕하세요?

투자금액 1백만원으로 작성한 식입니다.
금액은 수식에서 변경하시거나 시스템트레이딩 설정창의 변수 탭에서 변경하시면 됩니다.

input : 투자금액(1000000);
Inputs: RangeLength(5), XAvgLength(50), BarstoEnter(5), Factor(3); 
Variables: BuyEntry(0), BuySetup(False), BuyCounter(0), LongExitTarget(0); 
Variables: SellEntry(0), SellSetup(False), SellCounter(0), ShortExitTarget(0); 

Condition1 = High == Highest(High, RangeLength); 
Condition2 = Close > High[2]; 
Condition3 = ema(Close, XAvgLength) > ema(Close, XAvgLength)[1]; 
Condition4 = Low == Lowest(Low, RangeLength); 
Condition5 = Close < Low[2]; 
Condition6 = ema(Close, XAvgLength) < ema(Close, XAvgLength)[1];  

If MarketPosition <> 1 AND Condition1 AND Condition2 AND Condition3 Then Begin 
 BuyEntry = MedianPrice[2]; 
 BuyCounter = 0; 
 BuySetup = True; 
 LongExitTarget = High + Factor * (High - BuyEntry); 
End; 

If BuyCounter > BarstoEnter Then 
 BuySetup = False; 
Else 
 BuyCounter = BuyCounter + 1; 

If MarketPosition == 1 Then Begin 
 BuySetup = False; 
 ExitLong("EL_Target",atlimit,LongExitTarget); 
End; 

If BuySetup Then 
 Buy("Buy",atlimit,BuyEntry, 투자금액/C); 
  
If MarketPosition <> -1 AND Condition4 AND Condition5 AND Condition6 Then Begin 
 SellEntry = MedianPrice[2]; 
 SellCounter = 0; 
 SellSetup = True; 
 ShortExitTarget = Low - Factor * (SellEntry - Low); 
  
End; 

If SellCounter > BarstoEnter Then 
 SellSetup = False; 
Else 
 SellCounter = SellCounter + 1; 

/*If MarketPosition == -1 Then Begin 
 SellSetup = False; 
 ExitShort("ES_Target",atlimit,ShortExitTarget);  
End;*/ 

If SellSetup Then 
 Sell("EL_sell",atlimit,SellEntry, 투자금액/C);  

# ATR Protective Stop 
Inputs: ProtectiveATRs(3); 
var : AtrV(0); 

AtrV = ATR(30); 

If MarketPosition <> 0 Then { 
 ExitLong("EL_Protective Stop", atstop, EntryPrice - AtrV*ProtectiveATRs);  
 ExitShort("ES_Protective Stop", atstop, EntryPrice + AtrV*ProtectiveATRs);  




감사합니다.
목록 답변