커뮤니티
함수요청
2019-10-17 17:06:12
114
글번호 132889
안녕하세요?
글번호 64540번 재질문드립니다.
유선상 힌트를 주셔서 작성해보고자 했는데 원하는 신호가 생성되지 않아 다시 문의드립니다.
항셍선물을 T장에서 거래를 하고 싶습니다.
즉 당일의 시가를 10:15분으로 잡고 싶습니다.
작성주신 스크립트 수정요청드립니다.
Input : Period(20), MultiD(2),endtime(170000);;
var : BBmd(0),BBup(0),BBdn(0),T(0),entry(0);
var : Tcond(false);
BBmd = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
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.",AtMarket);
if MarketPosition == -1 Then
ExitShort("sx.",AtMarket);
}
if bdate != bdate[1] Then
{
Tcond = true;
T = 0;
if dayopen > BBup Then
T = -1;
if dayopen < BBdn Then
T = 1;
entry = 0;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if T == -1 then
{
if entry == 0 and C < BBup Then
sell("s1",AtMarket);
if entry == 1 and CrossDown(c,bbdn) Then
buy("b1",AtMarket);
}
if T == 1 then
{
if entry == 0 and C > BBdn Then
buy("b2",AtMarket);
if entry == 1 and crossup(c,bbup) Then
sell("s2",AtMarket);
}
if MarketPosition == 1 then
{
if Crossup(C,bbmd) Then
exitlong("bx",AtMarket);
}
if MarketPosition == -1 then
{
if CrossDown(C,bbmd) Then
ExitShort("sx",AtMarket);
}
답변 1
예스스탁 예스스탁 답변
2019-10-18 13:26:32
안녕하세요
예스스탁입니다.
Input : Period(20), MultiD(2),starttime(101500),endtime(170000);;
var : BBmd(0),BBup(0),BBdn(0),T(0),entry(0);
var : Tcond(false);
BBmd = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
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.",AtMarket);
if MarketPosition == -1 Then
ExitShort("sx.",AtMarket);
}
#10시 15분이면
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
T = 0;
if open > BBup Then
T = -1;
if open < BBdn Then
T = 1;
entry = 0;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if T == -1 then
{
if entry == 0 and C < BBup Then
sell("s1",AtMarket);
if entry == 1 and CrossDown(c,bbdn) Then
buy("b1",AtMarket);
}
if T == 1 then
{
if entry == 0 and C > BBdn Then
buy("b2",AtMarket);
if entry == 1 and crossup(c,bbup) Then
sell("s2",AtMarket);
}
if MarketPosition == 1 then
{
if Crossup(C,bbmd) Then
exitlong("bx",AtMarket);
}
if MarketPosition == -1 then
{
if CrossDown(C,bbmd) Then
ExitShort("sx",AtMarket);
}
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
글번호 64540번 재질문드립니다.
유선상 힌트를 주셔서 작성해보고자 했는데 원하는 신호가 생성되지 않아 다시 문의드립니다.
항셍선물을 T장에서 거래를 하고 싶습니다.
즉 당일의 시가를 10:15분으로 잡고 싶습니다.
작성주신 스크립트 수정요청드립니다.
Input : Period(20), MultiD(2),endtime(170000);;
var : BBmd(0),BBup(0),BBdn(0),T(0),entry(0);
var : Tcond(false);
BBmd = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
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.",AtMarket);
if MarketPosition == -1 Then
ExitShort("sx.",AtMarket);
}
if bdate != bdate[1] Then
{
Tcond = true;
T = 0;
if dayopen > BBup Then
T = -1;
if dayopen < BBdn Then
T = 1;
entry = 0;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if T == -1 then
{
if entry == 0 and C < BBup Then
sell("s1",AtMarket);
if entry == 1 and CrossDown(c,bbdn) Then
buy("b1",AtMarket);
}
if T == 1 then
{
if entry == 0 and C > BBdn Then
buy("b2",AtMarket);
if entry == 1 and crossup(c,bbup) Then
sell("s2",AtMarket);
}
if MarketPosition == 1 then
{
if Crossup(C,bbmd) Then
exitlong("bx",AtMarket);
}
if MarketPosition == -1 then
{
if CrossDown(C,bbmd) Then
ExitShort("sx",AtMarket);
}