커뮤니티
수정부탁드립니다.
2015-06-05 12:58:01
141
글번호 86844
index >= 0 일땐 값이 같은데, 아래와같이 Index >= 99의 값과 차트에서 100봉줄인것과 결과값이 다르게 나옵니다. 같게 만들어주세요
Var : MP(0),BuySellEntryPrice(0),OpenPP(0),NP(0);
var : ma1(0),ma2(0);
ma1 = ma(C,5);
ma2 = ma(C,20);
If Index >= 99 Then{
If MP <= 0 and CrossUp(ma1,ma2) Then{
if MP == -1 Then{
NP = NP+(BuySellEntryPrice-C);
}
BuySellEntryPrice = C;
MP = 1;
}
If MP >= 0 and CrossDown(ma1,ma2) Then{
if MP == 1 Then{
NP = NP+(C-BuySellEntryPrice);
}
BuySellEntryPrice = C;
MP = -1;
}
If MP == 1 Then{
OpenPP = (C-BuySellEntryPrice);
}
If MP == -1 Then {
OpenPP = (BuySellEntryPrice-C);
}
}
MessageLog("시가,%.4f,종가,%.4f,MP,%.0f,NP,%.4f,OpenPP,%.4f",open,close,MP,NP,OpenPP);
==================================================================
var : ma1(0),ma2(0);
ma1 = ma(C,5);
ma2 = ma(C,20);
If MarketPosition == 0 Then {
if CrossUp(ma1,ma2) Then{
Buy();
}
if CrossDown(ma1,ma2) Then{
Sell();
}
}
If MarketPosition > 0 && CrossDown(ma1,ma2) Then {
Sell();
}
If MarketPosition < 0 && CrossUp(ma1,ma2) Then {
Buy();
}
답변 1
예스스탁 예스스탁 답변
2015-06-05 15:00:53
안녕하세요
예스스탁입니다.
index는 차트봉번호 입니다.
index>= 99는 차트에서 전체봉에서 99번봉 이후에
골드나 데드가 발생할때부터 계산을 하게 됩니다.
지표에서 index >= 99조건을 주셨으면
시스템도 해당 조건을 주셔야 합니다.
var : ma1(0),ma2(0);
ma1 = ma(C,5);
ma2 = ma(C,20);
if index >= 99 then{
If MarketPosition == 0 Then {
if CrossUp(ma1,ma2) Then{
Buy();
}
if CrossDown(ma1,ma2) Then{
Sell();
}
}
If MarketPosition > 0 && CrossDown(ma1,ma2) Then {
Sell();
}
If MarketPosition < 0 && CrossUp(ma1,ma2) Then {
Buy();
}
}
즐거운 하루되세요
> 9단 님이 쓴 글입니다.
> 제목 : 수정부탁드립니다.
> index >= 0 일땐 값이 같은데, 아래와같이 Index >= 99의 값과 차트에서 100봉줄인것과 결과값이 다르게 나옵니다. 같게 만들어주세요
Var : MP(0),BuySellEntryPrice(0),OpenPP(0),NP(0);
var : ma1(0),ma2(0);
ma1 = ma(C,5);
ma2 = ma(C,20);
If Index >= 99 Then{
If MP <= 0 and CrossUp(ma1,ma2) Then{
if MP == -1 Then{
NP = NP+(BuySellEntryPrice-C);
}
BuySellEntryPrice = C;
MP = 1;
}
If MP >= 0 and CrossDown(ma1,ma2) Then{
if MP == 1 Then{
NP = NP+(C-BuySellEntryPrice);
}
BuySellEntryPrice = C;
MP = -1;
}
If MP == 1 Then{
OpenPP = (C-BuySellEntryPrice);
}
If MP == -1 Then {
OpenPP = (BuySellEntryPrice-C);
}
}
MessageLog("시가,%.4f,종가,%.4f,MP,%.0f,NP,%.4f,OpenPP,%.4f",open,close,MP,NP,OpenPP);
==================================================================
var : ma1(0),ma2(0);
ma1 = ma(C,5);
ma2 = ma(C,20);
If MarketPosition == 0 Then {
if CrossUp(ma1,ma2) Then{
Buy();
}
if CrossDown(ma1,ma2) Then{
Sell();
}
}
If MarketPosition > 0 && CrossDown(ma1,ma2) Then {
Sell();
}
If MarketPosition < 0 && CrossUp(ma1,ma2) Then {
Buy();
}