안녕하세요?
아래 수식에 하루매매횟수를 외부변수로 넣고싶습니다.
감사합니다.
Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000);
Variable : ent_position(0);
if MarketPosition == 0 Then
{
var1 = 0;
ent_position = 0;
}
If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then
{
Buy("매수",AtMarket);
Var1 = NextBarOpen;
ent_position = 1;
}
If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then
{
Sell("매도",AtMarket);
Var1 = NextBarOpen;
ent_position = -1;
}
SetStopProfittarget(profit_pt,PointStop);
SetStopLoss(loss_pt,PointStop);
SetStopEndofday(장종료청산);
답변 1
예스스탁
예스스탁 답변
2020-08-25 11:15:06
안녕하세요
예스스탁입니다.
Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000),entrycnt(3);
Variable : ent_position(0);
var : entry(0);
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 MarketPosition == 0 Then
{
var1 = 0;
ent_position = 0;
}
If entry < entrycnt and ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then
{
Buy("매수",AtMarket);
Var1 = NextBarOpen;
ent_position = 1;
}
If entry < entrycnt and ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then
{
Sell("매도",AtMarket);
Var1 = NextBarOpen;
ent_position = -1;
}
SetStopProfittarget(profit_pt,PointStop);
SetStopLoss(loss_pt,PointStop);
SetStopEndofday(장종료청산);
즐거운 하루되세요
> 대구어린울프 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 안녕하세요?
아래 수식에 하루매매횟수를 외부변수로 넣고싶습니다.
감사합니다.
Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000);
Variable : ent_position(0);
if MarketPosition == 0 Then
{
var1 = 0;
ent_position = 0;
}
If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then
{
Buy("매수",AtMarket);
Var1 = NextBarOpen;
ent_position = 1;
}
If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then
{
Sell("매도",AtMarket);
Var1 = NextBarOpen;
ent_position = -1;
}
SetStopProfittarget(profit_pt,PointStop);
SetStopLoss(loss_pt,PointStop);
SetStopEndofday(장종료청산);