커뮤니티
시작시간과 종료시간이 전혀 적용되지 않습니다.....
2019-04-24 04:00:15
210
글번호 128067
안녕하세요
예스스탁입니다.
당일청산함수때문에 신호가 나오지 않았습니다.
지정한 endtime봉 완성시 청산하게 수정해 드립니다.
input : 손절틱수(20),수익틱1(35),수익틱2(34);
var : Tcond(false);
input : starttime(180000),endtime(20000);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) Then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if Tcond == false then
{
if MarketPosition <= 0 and
C > dayopen and
C > O and L <= O-PriceScale*5 Then
buy("b",atlimit,O+PriceScale*3);
if MarketPosition >= 0 and
C < dayopen and
C < O and H >= O+PriceScale*5 Then
sell("s",atlimit,O+PriceScale*3);
if MarketPosition == 1 then
{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*수익틱1 Then
ExitLong("bx1",AtStop,highest(H,BarsSinceEntry)-(highest(H,BarsSinceEntry)-EntryPrice)*0.2);
if C >= EntryPrice+PriceScale*수익틱2 Then
ExitLong("bx2");
}
if MarketPosition == -1 then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*수익틱1 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+(EntryPrice-lowest(L,BarsSinceEntry))*0.2);
if C <= EntryPrice-PriceScale*수익틱2 Then
ExitShort("sx2");
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
=============================================================
수정해주신 수식에서 시작시간전에도 진입이 이루어지고
종료시간 후에도 진입이 이루어지며...
당일청산이 아니고 포지션이 다음날로 오버가 되는데요...
종료시간에 당일청산 합니다....
수고하세요...
- 1. 128670_30M.PNG (0.06 MB)
답변 1
예스스탁 예스스탁 답변
2019-04-24 11:09:26
안녕하세요
예스스탁입니다.
식을 수정했습니다.
수식이 stime기준으로 시간을 판단하므로
plot1(stime)으로 각봉 시간확인하시고 시작시간과 종료시간 지정해 주시면 됩니다.
input : 손절틱수(20),수익틱1(35),수익틱2(34);
var : Tcond(false);
input : starttime(180000),endtime(20000);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) Then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if Tcond == true then
{
if MarketPosition <= 0 and
C > dayopen and
C > O and L <= O-PriceScale*5 Then
buy("b",atlimit,O+PriceScale*3);
if MarketPosition >= 0 and
C < dayopen and
C < O and H >= O+PriceScale*5 Then
sell("s",atlimit,O+PriceScale*3);
if MarketPosition == 1 then
{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*수익틱1 Then
ExitLong("bx1",AtStop,highest(H,BarsSinceEntry)-(highest(H,BarsSinceEntry)-EntryPrice)*0.2);
if C >= EntryPrice+PriceScale*수익틱2 Then
ExitLong("bx2");
}
if MarketPosition == -1 then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*수익틱1 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+(EntryPrice-lowest(L,BarsSinceEntry))*0.2);
if C <= EntryPrice-PriceScale*수익틱2 Then
ExitShort("sx2");
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 루루 님이 쓴 글입니다.
> 제목 : 시작시간과 종료시간이 전혀 적용되지 않습니다.....
> 안녕하세요
예스스탁입니다.
당일청산함수때문에 신호가 나오지 않았습니다.
지정한 endtime봉 완성시 청산하게 수정해 드립니다.
input : 손절틱수(20),수익틱1(35),수익틱2(34);
var : Tcond(false);
input : starttime(180000),endtime(20000);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) Then
{
Tcond = false;
if MarketPosition == 1 Then
exitlong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if Tcond == false then
{
if MarketPosition <= 0 and
C > dayopen and
C > O and L <= O-PriceScale*5 Then
buy("b",atlimit,O+PriceScale*3);
if MarketPosition >= 0 and
C < dayopen and
C < O and H >= O+PriceScale*5 Then
sell("s",atlimit,O+PriceScale*3);
if MarketPosition == 1 then
{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*수익틱1 Then
ExitLong("bx1",AtStop,highest(H,BarsSinceEntry)-(highest(H,BarsSinceEntry)-EntryPrice)*0.2);
if C >= EntryPrice+PriceScale*수익틱2 Then
ExitLong("bx2");
}
if MarketPosition == -1 then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice+PriceScale*수익틱1 Then
ExitShort("sx1",AtStop,Lowest(L,BarsSinceEntry)+(EntryPrice-lowest(L,BarsSinceEntry))*0.2);
if C <= EntryPrice-PriceScale*수익틱2 Then
ExitShort("sx2");
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
=============================================================
수정해주신 수식에서 시작시간전에도 진입이 이루어지고
종료시간 후에도 진입이 이루어지며...
당일청산이 아니고 포지션이 다음날로 오버가 되는데요...
종료시간에 당일청산 합니다....
수고하세요...
다음글
이전글