커뮤니티
문의드립니다.
2019-07-03 13:36:27
286
글번호 129997
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
외부변수 : 특정수익
특정수익(포인트) 이상 수익 생기면 롱 숏가던 것을 반대로 진입하도록 부탁드립니다.
Inputs: InitMin(90);
Variables: SessStartMin(0), TradeTime(0), SetHigh(0), SetLow(0), LongFlag(False), ShortFlag(False);
#conversion of hour-based time to minute-based time
SessStartMin = TimeToMinutes(90000);
TradeTime = TimeToMinutes(sTime);
input :
진입횟수(1),
손절률(1),
익절률(1)
;
var : count(0),T1(0);
input : 진입시간(90000),제한시간(150000),청산시간(153400);
var : Tcond(false);
SetStopLoss(손절률,PercentStop);
SetStopProfittarget(익절률,PercentStop);
if (sdate != sdate[1] and stime >= 청산시간) or
(sdate == sdate[1] and stime >= 청산시간 and stime[1] < 청산시간) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) then
{
Tcond = true;
T1 = TotalTrades;
}
if (sdate != sdate[1] and stime >= 제한시간) or
(sdate == sdate[1] and stime >= 제한시간 and stime[1] < 제한시간) then
{
Tcond = false;
}
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
if Count < 진입횟수 and Tcond == true then
{
#Setup - establishment of the initial range
If TradeTime <= SessStartMin + InitMin Then Begin
If Date <> Date[1] Then Begin
SetHigh = High;
SetLow = Low;
LongFlag = True;
ShortFlag = True;
End
Else Begin
If High > SetHigh Then
SetHigh = High;
If Low < SetLow Then
SetLow = Low;
End;
End
Else Begin
#Entries once the initial period has ended
If LongFlag AND CrossUp( Close , SetHigh) Then
Buy();
If ShortFlag AND CrossDown(Close , SetLow) Then
Sell();
End;
}
#Long Protective Exit
If MarketPosition == 1 Then Begin
LongFlag = False;
ExitLong("",atstop,SetLow );
End;
#Short Protective Exit
If MarketPosition == -1 Then Begin
ShortFlag = False;
ExitShort("",atstop,SetHigh );
End;
input: TsValue(80);
var: Hvalue(0),Lvalue(0);
If MarketPosition() == 1 Then {
Hvalue = Highest(H,BarsSinceEntry+1);
ExitLong("trailstop_EL", Atstop, Hvalue-TsValue*PriceScale);
}
If MarketPosition() == -1 Then {
Lvalue = Lowest(L,BarsSinceEntry+1);
ExitShort("trailStop_Es", Atstop, Lvalue + TsValue*PriceScale);
}
2. 기타
1번 본수식을 이전 진입이 수익이면 반대로 손실이면 그대로 진입하도록 수정 부탁드립니다.
3. 기타
1번 본수식에서
-If LongFlag AND CrossUp( Close , SetHigh) Then
-이 조건(sell도 마찬가지)에서 고가셋업(sell이면 저가)하고 그 지점에서 n틱만큼 반대방향으로 갔을 때(Long이면 떨어지고 숏이면 올라가고) 그 방향 진입(매수면 매수, 매도면 매도)
답변 1
예스스탁 예스스탁 답변
2019-07-03 14:32:53
안녕하세요
예스스탁입니다.
1
Inputs: InitMin(90);
Variables: SessStartMin(0), TradeTime(0), SetHigh(0), SetLow(0), LongFlag(False), ShortFlag(False);
#conversion of hour-based time to minute-based time
SessStartMin = TimeToMinutes(90000);
TradeTime = TimeToMinutes(sTime);
input : 진입횟수(1),손절률(1),익절률(1);
var : count(0),T1(0);
input : 진입시간(90000),제한시간(150000),청산시간(153400),특정수익(3);
var : Tcond(false);
SetStopLoss(손절률,PercentStop);
SetStopProfittarget(익절률,PercentStop);
if (sdate != sdate[1] and stime >= 청산시간) or
(sdate == sdate[1] and stime >= 청산시간 and stime[1] < 청산시간) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) then
{
Tcond = true;
T1 = TotalTrades;
}
if (sdate != sdate[1] and stime >= 제한시간) or
(sdate == sdate[1] and stime >= 제한시간 and stime[1] < 제한시간) then
{
Tcond = false;
}
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
if Count < 진입횟수 and Tcond == true then
{
#Setup - establishment of the initial range
If TradeTime <= SessStartMin + InitMin Then
{
If Date <> Date[1] Then
{
SetHigh = High;
SetLow = Low;
LongFlag = True;
ShortFlag = True;
}
Else
{
If High > SetHigh Then
SetHigh = High;
If Low < SetLow Then
SetLow = Low;
}
}
Else
{
#Entries once the initial period has ended
If LongFlag AND CrossUp( Close , SetHigh) Then
{
Buy();
}
If ShortFlag AND CrossDown(Close , SetLow) Then
{
Sell();
}
}
}
#Long Protective Exit
If MarketPosition == 1 Then Begin
LongFlag = False;
ExitLong("",atstop,SetLow );
ExitLong("BS",atlimit,EntryPrice+특정수익 );
End;
#Short Protective Exit
If MarketPosition == -1 Then Begin
ShortFlag = False;
ExitShort("",atstop,SetHigh );
ExitShort("SB",atlimit,EntryPrice-특정수익 );
End;
input: TsValue(80);
var: Hvalue(0),Lvalue(0);
If MarketPosition() == 1 Then {
Hvalue = Highest(H,BarsSinceEntry+1);
ExitLong("trailstop_EL", Atstop, Hvalue-TsValue*PriceScale);
}
If MarketPosition() == -1 Then {
Lvalue = Lowest(L,BarsSinceEntry+1);
ExitShort("trailStop_Es", Atstop, Lvalue + TsValue*PriceScale);
}
2
Inputs: InitMin(90);
Variables: SessStartMin(0), TradeTime(0), SetHigh(0), SetLow(0), LongFlag(False), ShortFlag(False);
#conversion of hour-based time to minute-based time
SessStartMin = TimeToMinutes(90000);
TradeTime = TimeToMinutes(sTime);
input : 진입횟수(1),손절률(1),익절률(1);
var : count(0),T1(0);
input : 진입시간(90000),제한시간(150000),청산시간(153400),특정수익(3);
var : Tcond(false),pl(0),ps(0);
SetStopLoss(손절률,PercentStop);
SetStopProfittarget(익절률,PercentStop);
if (sdate != sdate[1] and stime >= 청산시간) or
(sdate == sdate[1] and stime >= 청산시간 and stime[1] < 청산시간) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) then
{
Tcond = true;
T1 = TotalTrades;
}
if (sdate != sdate[1] and stime >= 제한시간) or
(sdate == sdate[1] and stime >= 제한시간 and stime[1] < 제한시간) then
{
Tcond = false;
}
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
if Count < 진입횟수 and Tcond == true then
{
#Setup - establishment of the initial range
If TradeTime <= SessStartMin + InitMin Then
{
If Date <> Date[1] Then
{
SetHigh = High;
SetLow = Low;
LongFlag = True;
ShortFlag = True;
}
Else
{
If High > SetHigh Then
SetHigh = High;
If Low < SetLow Then
SetLow = Low;
}
}
Else
{
#Entries once the initial period has ended
if MarketPosition == 0 Then
{
pl = PositionProfit(1);
ps = MarketPosition(1);
}
Else
{
pl = PositionProfit(0);
ps = MarketPosition(0);
}
If LongFlag AND CrossUp( Close , SetHigh) Then
{
if pl <= 0 or (PL > 0 and ps != 1) Then
Buy();
}
If ShortFlag AND CrossDown(Close , SetLow) Then
{
if pl <= 0 or (pl > 0 and ps != -1) then
Sell();
}
}
}
#Long Protective Exit
If MarketPosition == 1 Then
{
LongFlag = False;
ExitLong("",atstop,SetLow );
ExitLong("BS",atlimit,EntryPrice+특정수익 );
}
#Short Protective Exit
If MarketPosition == -1 Then
{
ShortFlag = False;
ExitShort("",atstop,SetHigh );
ExitShort("SB",atlimit,EntryPrice-특정수익 );
}
input: TsValue(80);
var: Hvalue(0),Lvalue(0);
If MarketPosition() == 1 Then {
Hvalue = Highest(H,BarsSinceEntry+1);
ExitLong("trailstop_EL", Atstop, Hvalue-TsValue*PriceScale);
}
If MarketPosition() == -1 Then {
Lvalue = Lowest(L,BarsSinceEntry+1);
ExitShort("trailStop_Es", Atstop, Lvalue + TsValue*PriceScale);
}
3
Inputs: InitMin(90);
Variables: SessStartMin(0), TradeTime(0), SetHigh(0), SetLow(0), LongFlag(False), ShortFlag(False);
#conversion of hour-based time to minute-based time
SessStartMin = TimeToMinutes(90000);
TradeTime = TimeToMinutes(sTime);
input : 진입횟수(1),손절률(1),익절률(1);
var : count(0),T1(0);
input : 진입시간(90000),제한시간(150000),청산시간(153400),특정수익(3),n(5);
var : Tcond(false),pl(0),ps(0),T(0),S(0);
SetStopLoss(손절률,PercentStop);
SetStopProfittarget(익절률,PercentStop);
if (sdate != sdate[1] and stime >= 청산시간) or
(sdate == sdate[1] and stime >= 청산시간 and stime[1] < 청산시간) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) then
{
Tcond = true;
T1 = TotalTrades;
T = 0;
}
if (sdate != sdate[1] and stime >= 제한시간) or
(sdate == sdate[1] and stime >= 제한시간 and stime[1] < 제한시간) then
{
Tcond = false;
}
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
if Count < 진입횟수 and Tcond == true then
{
#Setup - establishment of the initial range
If TradeTime <= SessStartMin + InitMin Then
{
If Date <> Date[1] Then
{
SetHigh = High;
SetLow = Low;
LongFlag = True;
ShortFlag = True;
}
Else
{
If High > SetHigh Then
SetHigh = High;
If Low < SetLow Then
SetLow = Low;
}
}
Else
{
#Entries once the initial period has ended
if MarketPosition == 0 Then
{
pl = PositionProfit(1);
ps = MarketPosition(1);
}
Else
{
pl = PositionProfit(0);
ps = MarketPosition(0);
}
If LongFlag AND CrossUp( Close , SetHigh) Then
{
T = 1;
S = H-PriceScale*n;
}
If ShortFlag AND CrossDown(Close , SetLow) Then
{
T = -1;
S = L-PriceScale*n;
}
if T == 1 and (pl <= 0 or (PL > 0 and ps != 1)) Then
Buy("b",atlimit,S);
if T == -1 and (pl <= 0 or (PL > 0 and ps != 1)) Then
sell("s",atlimit,S);
}
}
#Long Protective Exit
If MarketPosition == 1 Then
{
LongFlag = False;
ExitLong("",atstop,SetLow );
ExitLong("BS",atlimit,EntryPrice+특정수익 );
}
#Short Protective Exit
If MarketPosition == -1 Then
{
ShortFlag = False;
ExitShort("",atstop,SetHigh );
ExitShort("SB",atlimit,EntryPrice-특정수익 );
}
input: TsValue(80);
var: Hvalue(0),Lvalue(0);
If MarketPosition() == 1 Then {
Hvalue = Highest(H,BarsSinceEntry+1);
ExitLong("trailstop_EL", Atstop, Hvalue-TsValue*PriceScale);
}
If MarketPosition() == -1 Then {
Lvalue = Lowest(L,BarsSinceEntry+1);
ExitShort("trailStop_Es", Atstop, Lvalue + TsValue*PriceScale);
}
즐거운 하루되세요
> 잡다백수 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
외부변수 : 특정수익
특정수익(포인트) 이상 수익 생기면 롱 숏가던 것을 반대로 진입하도록 부탁드립니다.
Inputs: InitMin(90);
Variables: SessStartMin(0), TradeTime(0), SetHigh(0), SetLow(0), LongFlag(False), ShortFlag(False);
#conversion of hour-based time to minute-based time
SessStartMin = TimeToMinutes(90000);
TradeTime = TimeToMinutes(sTime);
input :
진입횟수(1),
손절률(1),
익절률(1)
;
var : count(0),T1(0);
input : 진입시간(90000),제한시간(150000),청산시간(153400);
var : Tcond(false);
SetStopLoss(손절률,PercentStop);
SetStopProfittarget(익절률,PercentStop);
if (sdate != sdate[1] and stime >= 청산시간) or
(sdate == sdate[1] and stime >= 청산시간 and stime[1] < 청산시간) then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) then
{
Tcond = true;
T1 = TotalTrades;
}
if (sdate != sdate[1] and stime >= 제한시간) or
(sdate == sdate[1] and stime >= 제한시간 and stime[1] < 제한시간) then
{
Tcond = false;
}
if MarketPosition == 0 Then
count = TotalTrades-T1;
Else
count = TotalTrades-T1+1;
if Count < 진입횟수 and Tcond == true then
{
#Setup - establishment of the initial range
If TradeTime <= SessStartMin + InitMin Then Begin
If Date <> Date[1] Then Begin
SetHigh = High;
SetLow = Low;
LongFlag = True;
ShortFlag = True;
End
Else Begin
If High > SetHigh Then
SetHigh = High;
If Low < SetLow Then
SetLow = Low;
End;
End
Else Begin
#Entries once the initial period has ended
If LongFlag AND CrossUp( Close , SetHigh) Then
Buy();
If ShortFlag AND CrossDown(Close , SetLow) Then
Sell();
End;
}
#Long Protective Exit
If MarketPosition == 1 Then Begin
LongFlag = False;
ExitLong("",atstop,SetLow );
End;
#Short Protective Exit
If MarketPosition == -1 Then Begin
ShortFlag = False;
ExitShort("",atstop,SetHigh );
End;
input: TsValue(80);
var: Hvalue(0),Lvalue(0);
If MarketPosition() == 1 Then {
Hvalue = Highest(H,BarsSinceEntry+1);
ExitLong("trailstop_EL", Atstop, Hvalue-TsValue*PriceScale);
}
If MarketPosition() == -1 Then {
Lvalue = Lowest(L,BarsSinceEntry+1);
ExitShort("trailStop_Es", Atstop, Lvalue + TsValue*PriceScale);
}
2. 기타
1번 본수식을 이전 진입이 수익이면 반대로 손실이면 그대로 진입하도록 수정 부탁드립니다.
3. 기타
1번 본수식에서
-If LongFlag AND CrossUp( Close , SetHigh) Then
-이 조건(sell도 마찬가지)에서 고가셋업(sell이면 저가)하고 그 지점에서 n틱만큼 반대방향으로 갔을 때(Long이면 떨어지고 숏이면 올라가고) 그 방향 진입(매수면 매수, 매도면 매도)
다음글
이전글