안녕하세요?
아래글번호 81756번 재질문입니다.
당일 매매인데 매수든 매도든 진입 기준 최대 1번으로 수정 부탁드립니다.
즉 당일에 신호가 생성된다면,
1. 매수진입-> 매수청산
2. 매도진입-> 매도청산
둘 중 하나입니다.
1
input : short(12),long(26),sig(9);
var : macdv(0),macds(0);
macdv = macd(short,long);
macds = ema(macdv,sig);
if Bdate != Bdate[1] Then
{
var1 = 0;
Var2 = 0;
}
Condition1 = macdv > 0 and macds > 0 and CrossDown(macdv,macds);
Condition2 = macdv < 0 and macds < 0 and CrossUp(macdv,macds);
if Condition1 == true Then
{
var1 = var1+1;
if var1 == 3 Then
Sell("s",AtMarket);
}
if MarketPosition == -1 and Condition2 == true Then
ExitShort("sx",AtMarket);
if Condition2 == true Then
{
var2 = var2+1;
if var2 == 3 Then
Buy("b",AtMarket);
}
if MarketPosition == 1 and Condition1 == true Then
ExitLong("bx",AtMarket);
SetStopEndofday(152000);
답변 1
예스스탁
예스스탁 답변
2023-04-20 13:16:55
안녕하세요
예스스탁입니다.
input : short(12),long(26),sig(9);
var : macdv(0),macds(0),entry(0);
macdv = macd(short,long);
macds = ema(macdv,sig);
if Bdate != Bdate[1] Then
{
var1 = 0;
Var2 = 0;
entry = 0;
}
Condition1 = macdv > 0 and macds > 0 and CrossDown(macdv,macds);
Condition2 = macdv < 0 and macds < 0 and CrossUp(macdv,macds);
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Condition1 == true Then
{
var1 = var1+1;
if var1 == 3 and entry < 1 Then
Sell("s",AtMarket);
}
if MarketPosition == -1 and Condition2 == true Then
ExitShort("sx",AtMarket);
if Condition2 == true Then
{
var2 = var2+1;
if var2 == 3 and entry < 1 Then
Buy("b",AtMarket);
}
if MarketPosition == 1 and Condition1 == true Then
ExitLong("bx",AtMarket);
SetStopEndofday(152000);
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
아래글번호 81756번 재질문입니다.
당일 매매인데 매수든 매도든 진입 기준 최대 1번으로 수정 부탁드립니다.
즉 당일에 신호가 생성된다면,
1. 매수진입-> 매수청산
2. 매도진입-> 매도청산
둘 중 하나입니다.
1
input : short(12),long(26),sig(9);
var : macdv(0),macds(0);
macdv = macd(short,long);
macds = ema(macdv,sig);
if Bdate != Bdate[1] Then
{
var1 = 0;
Var2 = 0;
}
Condition1 = macdv > 0 and macds > 0 and CrossDown(macdv,macds);
Condition2 = macdv < 0 and macds < 0 and CrossUp(macdv,macds);
if Condition1 == true Then
{
var1 = var1+1;
if var1 == 3 Then
Sell("s",AtMarket);
}
if MarketPosition == -1 and Condition2 == true Then
ExitShort("sx",AtMarket);
if Condition2 == true Then
{
var2 = var2+1;
if var2 == 3 Then
Buy("b",AtMarket);
}
if MarketPosition == 1 and Condition1 == true Then
ExitLong("bx",AtMarket);
SetStopEndofday(152000);