답변완료
손절 후 조건 부합 시 매매 시작
수고하십니다. 아래 내용 문의 합니다.
볼린저밴드에서
종가가 상단밴드 상향이면 매도
종가가 하단밴드 하향이면 매도청산
+5Point 이면 손절매
전 매매가 손절이면 MyStopLoss = 1
종가가 밴드 이평 하향이면 MyStopLoss = 0
에서
(1) 손절 후 종가가 밴드 이평 하향 전까지는 매매 금지 (MyStopLoss = 1 유지)
(2) 손절 후 종가가 밴드 이평 하향 후 부터 재 매매 시작 (MyStopLoss = 0 유지)
(3) 손절이 발생하면 MyStopLoss = 1 유지
(1) ~ (3)번 실행 가능한 수식 부탁합니다
===============================
Input : Period(20), MultiD(2);
var : MAv(0),BBup(0),BBdn(0),MyStopLoss(0);
MAv = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
if CrossUp(C,BBup) Then Sell("매도",AtMarket);
if CrossDown(C,BBdn)Then ExitShort("매도청",AtMarket);
SetStopLoss(5,PointStop);
IF IsExitName("StopLoss",1) == True Then MyStopLoss = 1 ;
if CrossDown(C,MAv) then MyStopLoss = 1 ;
2024-03-19
486
글번호 177625
시스템
답변완료
문의 드립니다.
input : StartTime(70000),EndTime(50000);
input : 익절틱수(50),손절틱수(0);
var : Tcond(False),entry(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] or (sDate != Date) Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
}
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b2",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*10 Then
{
Sell("s2",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b3",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s3",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b4",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*10 Then
{
Sell("s4",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
if L ==lowest(L,1) and highest(H,2) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b5",AtStop,(highest(H,2)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 2 Then
ExitShort();
if H == highest(H,1) and lowest(L,2) <= highest(H,2)+PriceScale*10 Then
{
Sell("s5",AtStop,(lowest(L,2)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 2 Then
ExitLong();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
-------
위 수식어에 아래 3가지가 포함된 각각 별도의 수식어를 부탁드립니다.
1. 익,손절후 당일 매매정지
2. 익절후 5시간 진입금지
3. 익절후 3번째 캔들까지 진입신호금지
2024-03-19
607
글번호 177612
시스템