첨부 이미지
그림1
input : StartTime(220000),EndTime(035000),진입횟수(5),익절틱수(40),손절틱수(25);
var : Tcond(false),entry(0);
if StartTime < EndTime Then
{
SetStopEndofday(EndTime);
}
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
if StartTime > EndTime Then
SetStopEndofday(0);
Tcond = true;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition == 0 and C > O and entry < 진입횟수 Then
{
Buy("b");
}
if MarketPosition == 0 and C < O and entry < 진입횟수 Then
{
Sell("s");
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
----------------------
진입신호후 buy , sell 둘 다 -30틱에 주문이 되는 수식어를 포함 하고자 합니다.
미리 감사 드립니다.
답변 1
예스스탁
예스스탁 답변
2021-05-07 15:44:16
안녕하세요
예스스탁입니다.
1
기존 수식이 무포지션에서 양봉이나 음봉에 진입후
익절이나 손절이 발생해야 다음진입에 들어가게 되므로
무포지션에서 최초로 발생하는 양봉이나 음봉을 기준으로 -+30틱에 진입되게 작성해 드립니다.
2
매도는 음봉의 종가에서 30틱 상승하면 신호가 발생하게 작성해 드립니다.
만약 매도도 음봉의 종가에서 30틱 하락할때 신호를 발생하게 하시려면
아래수식에서
Sell("s",AtLimit,S+PriceScale*30);
위 내용을 아래식으로 바꾸시면 됩니다.
Sell("s",AtStrop,S-PriceScale*30);
3
input : StartTime(220000),EndTime(035000),진입횟수(5),익절틱수(40),손절틱수(25);
var : Tcond(false),entry(0),T(0),S(0);
if StartTime < EndTime Then
{
SetStopEndofday(EndTime);
}
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
if StartTime > EndTime Then
SetStopEndofday(0);
Tcond = true;
entry = 0;
T = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition == 0 and entry < 진입횟수 Then
{
if T == 0 and C > O Then
{
T = 1;
S = C;
}
if T == 0 and C < O Then
{
T = 1;
S = C;
}
if T == 1 Then
Buy("b",AtLimit,S-PriceScale*30);
if T == -1 Then
Sell("s",AtLimit,S+PriceScale*30);
}
if MarketPosition != 0 Then
T = 0;
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 수식작성
> input : StartTime(220000),EndTime(035000),진입횟수(5),익절틱수(40),손절틱수(25);
var : Tcond(false),entry(0);
if StartTime < EndTime Then
{
SetStopEndofday(EndTime);
}
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
if StartTime > EndTime Then
SetStopEndofday(0);
Tcond = true;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition == 0 and C > O and entry < 진입횟수 Then
{
Buy("b");
}
if MarketPosition == 0 and C < O and entry < 진입횟수 Then
{
Sell("s");
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
----------------------
진입신호후 buy , sell 둘 다 -30틱에 주문이 되는 수식어를 포함 하고자 합니다.
미리 감사 드립니다.