안녕하세요?
아래 글번호 75170번 재질문입니다.
일중거래인데 당일 첫봉에서 신호가 생성되면 그 신호를 스킵하고자 합니다.
기존의 생성된 신호는 유지하되 당일 첫봉에서 신호가 생성되면 그 다음 신호부터 진입을 하게 스크립트 수정 부탁드립니다.
감사합니다.
Input : shortPeriod(12), longPeriod(26),sigPeriod(9);
Var : macdv(0),macds(0),entry(0);
macdv = MACD(shortPeriod, longPeriod);
macds = ema(macdv,sigPeriod);
if Bdate != Bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
If CrossUP(macdv, macds) and macdv < -30 Then
{
if entry < 1 Then
Buy();
Else
ExitShort();
}
If CrossDown(macdv, macds) and macdv > 30 Then
{
if entry < 1 Then
Sell();
Else
ExitLong();
}
SetStopEndofday(151500);
답변 1
예스스탁
예스스탁 답변
2021-12-22 09:14:05
안녕하세요
예스스탁입니다.
Input : shortPeriod(12), longPeriod(26),sigPeriod(9);
Var : macdv(0),macds(0),entry(0);
macdv = MACD(shortPeriod, longPeriod);
macds = ema(macdv,sigPeriod);
if Bdate != Bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
If Bdate == Bdate[1] and CrossUP(macdv, macds) and macdv < -30 Then
{
if entry < 1 Then
Buy();
Else
ExitShort();
}
If Bdate == Bdate[1] and CrossDown(macdv, macds) and macdv > 30 Then
{
if entry < 1 Then
Sell();
Else
ExitLong();
}
SetStopEndofday(151500);
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
아래 글번호 75170번 재질문입니다.
일중거래인데 당일 첫봉에서 신호가 생성되면 그 신호를 스킵하고자 합니다.
기존의 생성된 신호는 유지하되 당일 첫봉에서 신호가 생성되면 그 다음 신호부터 진입을 하게 스크립트 수정 부탁드립니다.
감사합니다.
Input : shortPeriod(12), longPeriod(26),sigPeriod(9);
Var : macdv(0),macds(0),entry(0);
macdv = MACD(shortPeriod, longPeriod);
macds = ema(macdv,sigPeriod);
if Bdate != Bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
If CrossUP(macdv, macds) and macdv < -30 Then
{
if entry < 1 Then
Buy();
Else
ExitShort();
}
If CrossDown(macdv, macds) and macdv > 30 Then
{
if entry < 1 Then
Sell();
Else
ExitLong();
}
SetStopEndofday(151500);