커뮤니티
문의 드립니다.
2015-08-27 17:05:25
121
글번호 89874
아래 수정해 주신 수식 적용해서 돌려 보았으나...
근데 이렇게 나옵니다...
1계약에서 갑자기 4계약으로 건너뛰고요,,
갑자기 8계약이 나오고;;
그리고 또 2010년12월10일 이후로
거래 안합니다...
안녕하세요
예스스탁입니다.
식을 수정했습니다.
Input : 기본계약수(1);
Vars : Vol(0), Profit(0.01), Loss(0.004);
SetStopProfittarget(Profit,PointStop);
SetStopLoss(Loss,PointStop);
If MarketPosition !=0 Then
{
If PositionProfit >= 0 Then
Vol = 기본계약수;
Else
Vol = CurrentContracts*2;
}
If MarketPosition==0 Then
{
If PositionProfit(1) >= 0 Then
Vol = 기본계약수;
Else
Vol = Vol[BarsSinceExit(1)]*2;
}
If MarketPosition==0 and CrossUp(Ma(C,16), Ma(C,45)) Then Buy("Buy", OnClose, DEF, Vol);
If MarketPosition==0 and CrossDown(Ma(C,16), Ma(C,45)) Then Sell("Sell", OnClose, DEF, Vol);
- 1. 90382_1.jpg (0.23 MB)
답변 1
예스스탁 예스스탁 답변
2015-08-27 17:53:29
안녕하세요
예스스탁입니다.
기존식에 vol에 값을 계산하는 시점을 지정하지 않아
큰값이 나왔습니다 식을 수정했습니다.
아래 내용 참고하시기 바랍니다.
Input : 기본계약수(1);
Vars : Vol(0), Profit(0.01), Loss(0.004);
SetStopProfittarget(Profit,PointStop);
SetStopLoss(Loss,PointStop);
If MarketPosition==0 and CrossUp(Ma(C,16), Ma(C,45)) Then {
if PositionProfit(1) >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
Buy("Buy", OnClose, DEF, Vol);
}
If MarketPosition==0 and CrossDown(Ma(C,16), Ma(C,45)) Then{
if PositionProfit(1) >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
Sell("Sell", OnClose, DEF, Vol);
}
만일 식에서 스위칭을 하는 내용이 있으시면
가능하다면 아래와 같이 작성하시면 됩니다.
Input : 기본계약수(1);
Vars : Vol(0), Profit(0.01), Loss(0.004);
SetStopProfittarget(Profit,PointStop);
SetStopLoss(Loss,PointStop);
If CrossUp(Ma(C,16), Ma(C,45)) Then {
if MarketPosition == 0 Then{
if PositionProfit(1) >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
}
if MarketPosition == -1 Then{
if PositionProfit >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
}
Buy("Buy", OnClose, DEF, Vol);
}
If CrossDown(Ma(C,16), Ma(C,45)) Then{
if MarketPosition == 0 Then{
if PositionProfit(1) >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
}
if MarketPosition == 1 Then{
if PositionProfit >= 0 then
Vol = 기본계약수;
Else
Vol = Vol*2;
}
Sell("Sell", OnClose, DEF, Vol);
}
즐거운 하루되세요
> 무결점 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래 수정해 주신 수식 적용해서 돌려 보았으나...
근데 이렇게 나옵니다...
1계약에서 갑자기 4계약으로 건너뛰고요,,
갑자기 8계약이 나오고;;
그리고 또 2010년12월10일 이후로
거래 안합니다...
안녕하세요
예스스탁입니다.
식을 수정했습니다.
Input : 기본계약수(1);
Vars : Vol(0), Profit(0.01), Loss(0.004);
SetStopProfittarget(Profit,PointStop);
SetStopLoss(Loss,PointStop);
If MarketPosition !=0 Then
{
If PositionProfit >= 0 Then
Vol = 기본계약수;
Else
Vol = CurrentContracts*2;
}
If MarketPosition==0 Then
{
If PositionProfit(1) >= 0 Then
Vol = 기본계약수;
Else
Vol = Vol[BarsSinceExit(1)]*2;
}
If MarketPosition==0 and CrossUp(Ma(C,16), Ma(C,45)) Then Buy("Buy", OnClose, DEF, Vol);
If MarketPosition==0 and CrossDown(Ma(C,16), Ma(C,45)) Then Sell("Sell", OnClose, DEF, Vol);
다음글
이전글