코딩 도움말 - 페이지 62

 

...

2가지 작업을 수행해야 합니다.
- "마침표" 변수를 이중으로 선언(MQL은 나눗셈에서 정수 유형 변수가 사용될 때 이상하게 동작하는 경우가 있음)

- 해당 "마침표" 변수 초기화(지금은 초기화되지 않았으므로 마지막 단계가 작동하지 않음)

그 후에 다음과 같은 것을 얻을 수 있습니다.

좋은 주말 되세요

chenairbin:
#속성 표시기_분리_창

#속성 표시기_버퍼 1

#property indicator_color1 빨간색

#속성 표시기_최대 100

#속성 표시기_레벨1 70

#속성 표시기_레벨2 50

#속성 표시기_레벨3 30

#속성 표시기_최소 0

//---- 입력 매개변수

extern int rsiperiod = 14 ;

extern int 단기 = 5 ;

extern int 중간 기간 = 8;

extern int Longperiod = 13;

extern int mamode = 2 ;

//---- 버퍼

이중 RSI[];

이중 ShortRSI[];

이중 중간RSI[];

이중 LongRSI[];

이중 SMRSI[];

정수 기간 ;

//+----------------------------------------------- -------------------+

//| 커스텀 인디케이터 초기화 기능 |

//+----------------------------------------------- -------------------+

정수 초기화()

{

//---- 표시기

표시 버퍼(5);

SetIndexBuffer(0,SMRSI);

SetIndexBuffer(1,RSI);

SetIndexBuffer(2,ShortRSI);

SetIndexBuffer(3,MiddleRSI);

SetIndexBuffer(4,LongRSI);

//---- DataWindow의 이름 및 표시기 하위 창 레이블

IndicatorShortName("SMRSI("+rsiperiod+","+Shortperiod+","+Middleperiod+","+Longperiod +","+mamode+")");

SetIndexDrawBegin(0,rsiperiod+longperiod);

기간=단기+중기+장기;

리턴(0);

}

//+----------------------------------------------- -------------------+

//| 사용자 지정 표시기 반복 기능 |

//+----------------------------------------------- -------------------+

정수 시작()

{

int counted_bars=IndicatorCounted();

int i, 제한;

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

한도 = Bars-counted_bars;

for( i=limit; i>=0; i--) RSI=iRSI(NULL,0,rsiperiod,0,i);

for( i=limit; i>=0; i--) ShortRSI=iMAOnArray(RSI,0,Shortperiod,0,mamode,i);

for( i=limit; i>=0; i--) MiddleRSI=iMAOnArray(RSI,0,Middleperiod,0,mamode,i);

for( i=limit; i>=0; i--) LongRSI=iMAOnArray(RSI,0,Longperiod,0,mamode,i);

for( i=limit; i>=0; i--) { if(period!=0) SMRSI=(Shortperiod/period)*ShortRSI+(Middleperiod/period)*MiddleRSI+(Longperiod/period)*LongRSI;}

반환(0);

}

//+----------------------------------------------- -------------------+
파일:
smrsi.gif  33 kb
_test0.mq4  3 kb
 

n_n

mladen:
2가지 작업을 수행해야 합니다.
- "마침표" 변수를 이중으로 선언(MQL은 나눗셈에서 정수 유형 변수가 사용될 때 이상하게 동작하는 경우가 있음)

- 해당 "마침표" 변수 초기화(지금은 초기화되지 않았으므로 마지막 단계가 작동하지 않음)

그 후에 다음과 같이 얻을 수 있습니다.

좋은 주말 되세요

고맙습니다 !

 

안녕,

mql4 웹사이트에 첨부된 표시기를 다운로드했습니다. 이 지표를 기반으로 EA를 시도하지만 몇 초 후 백 테스트를 시작하면 플랫폼이 충돌하고 CPU를 많이 사용하기 때문에 지표의 결함이라고 생각합니다.

그래서 이 문제를 해결하기 위해 코드를 가볍게 할 수 있는지 묻고 있습니다.

당신의 무책임함에 감사합니다.

cronex_taichi.mq4

파일:
 

다시오

이 스 니펫으로 테스트했으며 정상적으로 작동합니다. 사용하신 매개변수를 몰라서 그냥 기본 인디케이터라고 부르는데 이 방법은 문제 없습니다

int init()

{

return(0);

}

int start()

{

Comment(iCustom(NULL,0,"Cronex Taichi",0,0));

return(0);

}

dasio:
안녕,

mql4 웹사이트에 첨부된 표시기를 다운로드했습니다. 이 지표를 기반으로 EA를 시도하지만 몇 초 후 백 테스트를 시작하면 플랫폼이 충돌하고 CPU를 많이 사용하기 때문에 지표의 결함이라고 생각합니다.

그래서 이 문제를 해결하기 위해 코드를 가볍게 할 수 있는지 묻고 있습니다.

당신의 무책임함에 감사합니다.

cronex_taichi.mq4
 
mladen:
다시오

이 스 니펫으로 테스트했으며 정상적으로 작동합니다. 사용하신 매개변수를 몰라서 그냥 기본 인디케이터라고 부르는데 이 방법은 문제 없습니다

int init()

{

return(0);

}

int start()

{

Comment(iCustom(NULL,0,"Cronex Taichi",0,0));

return(0);

}

당신의 답변에 감사드립니다,

내가 보는 것은 기록에서 표시기가 반복적으로 로드되어 새로운 촛불 이벤트에서만 icustom의 코드를 이동하지만 문제는 여전히 지속된다는 것입니다.

이유를 모르겠습니다.

그러나 귀하의 무책임함에 감사드립니다.

 

안녕,

나는 문제를 발견했다. 이제 괜찮습니다.

나는 다른 ea에 또 다른 문제가 있습니다.

이 두 개의 코드가 있고 Lotti() 함수 는 나에게 주문 보내기에 대한 로트 번호를 반환합니다.

컴파일할 때 Posizioni 내부 오류가 발생합니다. 뭐가 문제 야? 고맙습니다;

int OTBM(int intMagic)//OrdersTotalByMagic

{

int intCount=0;

int intPOS=0;

bool boolTerm=false;

while(boolTerm==false)

{

if(OrderSelect(intPOS,SELECT_BY_POS))

{

if(OrderMagicNumber()==intMagic) intCount++;

intPOS++;

}

else

boolTerm=true;

}

return(intCount);

}

[/PHP]

[PHP]int Lotti(){

int Lotti;

int Posizioni=OTBM(MagicNumber);

switch (Posizioni)

{

case 0 : Lotti=0.1; break;

case 1 : Lotti=0.2; break;

case 2 : Lotti=0.4; break;

case 3 : Lotti=0.8; break;

case 4 : Lotti=1.6; break;

case 5 : Lotti=3.2; break;

case 6 : Lotti=6.4; break;

case 7 : Lotti=12.8; break;

}

return(Lotti);

}
 

OTBM()을 다음으로 교체해 보십시오.

int OTBM(int intMagic)//OrdersTotalByMagic

{

int intCount=0;

for (int i=OrdersTotal()-1; i>=0; i--)

{

if(OrderSelect(i,SELECT_BY_POS))

{

if(OrderMagicNumber()==intMagic) intCount++;

}

}

return(intCount);

}

[/PHP]

dasio:
Hi,

i found the problem. Now all its ok.

I have another problem with another ea.

I have this two code and the function Lotti() would be return me the number of lot for an ordersend.

When i compile it i receive Posizioni Internal Error. What's wrong? Thank you;

int OTBM(int intMagic)//OrdersTotalByMagic

{

int intCount=0;

int intPOS=0;

bool boolTerm=false;

while(boolTerm==false)

{

if(OrderSelect(intPOS,SELECT_BY_POS))

{

if(OrderMagicNumber()==intMagic) intCount++;

intPOS++;

}

else

boolTerm=true;

}

return(intCount);

}

[PHP]int Lotti(){

int Lotti;

int Posizioni=OTBM(MagicNumber);

switch (Posizioni)

{

case 0 : Lotti=0.1; break;

case 1 : Lotti=0.2; break;

case 2 : Lotti=0.4; break;

case 3 : Lotti=0.8; break;

case 4 : Lotti=1.6; break;

case 5 : Lotti=3.2; break;

case 6 : Lotti=6.4; break;

case 7 : Lotti=12.8; break;

}

return(Lotti);

}
 

안녕, -.-"

나는 이 코드들과 평화를 찾지 못한다 에헤헤.

나에게 모든 openorder의 이익을 가져다주는 기능 에 문제가 있지만 조건이 결코 존중되지 않았기 때문에 작동하지 않는다고 생각합니다. 코드 아래:

.....

if(Profit()>=0.....[/PHP]

[PHP]double Profit()

{

int total=OrdersTotal();

double profit=0;

for(int i=0; i<total; i++)

{

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) continue;

profit+=OrderProfit();

}

return(profit);

}
 

다시오

다음과 같이 시도하십시오.

.....

if(Profit()>=0.....[/PHP]

double Profit()

{

int total=OrdersTotal();

double profit=0;

for(int i=0; i<total-1; i++)

{

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber) continue;

profit+=OrderProfit();

}

return(profit);

}[/PHP]

dasio:
Hi, -.-"

I do not find peace with these codes eheheh.

I have a problem with a function that have to result me the profit of all openorder but i think it's not work because the condition never been respected. Below the code:

[PHP].....

if(Profit()>=0.....

[PHP]double Profit()

{

int total=OrdersTotal();

double profit=0;

for(int i=0; i<total; i++)

{

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) continue;

profit+=OrderProfit();

}

return(profit);

}
 
mladen:
다시오

다음과 같이 시도하십시오.

.....

if(Profit()>=0.....[/PHP]

[PHP]double Profit()

{

int total=OrdersTotal();

double profit=0;

for(int i=0; i<total-1; i++)

{

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber) continue;

profit+=OrderProfit();

}

return(profit);

}

이런 식으로 지정된 magicnumber로 열리지 않은 주문을 확인합니까? 특정 심볼과 매직넘버로 주문을 확인해야 합니다. 중요한지는 모르겠지만 전략 테스터 에서 오류를 발견했습니다.