编码帮助 - 页 555

 
mntiwana:
最亲爱的MLADEN。

谢谢老板,那么在这种情况下,代码可能是这样的? 请纠正我。

问候

===================================================================

原始的 "简单MA交叉EA "代码

//

#define _doNothing 0

#define _doBuy 1

#define _doSell 2

int start()

{

int doWhat = _doNothing;

double diffc = iMA(NULL,0,Ma1Period,0,Ma1Method,Ma1Price,BarToUse) -iMA(NULL,0,Ma2Period,0,Ma2Method,Ma2Price,BarToUse) 。

double diffp = iMA(NULL,0,Ma1Period,0,Ma1Method,Ma1Price,BarToUse+1)-iMA(NULL,0,Ma2Period,0,Ma2Method,Ma2Price,BarToUse+1) 。

如果((diffc*diffp)<0)

如果(diffc>0)

doWhat = _doBuy;

否则 doWhat = _doSell;

如果(doWhat==_doNothing)返回(0)。

//

================================================

这样改一下

#define _doNothing 0

#define _doBuy 1

#define _doSell 2

int start()

{

int doWhat = _doNothing;

double diffc = iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse)

-iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse)。

double diffp = iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2) 。

如果 ((diffc*diffp)<0)

如果(diffc>0)

doWhat = _doBuy;

否则 doWhat = _doSell;

如果(doWhat==_doNothing)返回(0)。

//

=====================================

mntiwana

替换这个:

double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2);[/PHP]

with this :

[PHP]double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse+1)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse+1);
 

ADX过滤器的帮助

嗨,专业编码人员。

我想实现一个ADX过滤器,它将过滤横盘震荡的市场状况。

如果ADX低于25,就不应该开仓交易,我已经编码了这个简单的过滤器。

extern int ADXPeriod=14;

double CurrentADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,0);

double PreviousADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,1);

bool ADXfilter=false;

if(CurrentADX>25&&PreviousADX<25)

{

ADXfilter=true;

}

if(ADXfilter=true)

{

BUY();

.

.

SELL();

}

[/CODE]

For some reason the filer is not working. I have put the ADX filter before placing the buy / sell order.

Also putting it to the entry conditions signal is not working.

[CODE]

if(ADXfilter=true && MAFIB=="true" && BUY=="true")

谁能告诉我?谢谢你的建议。

 
tfi_markets:
嗨,专业编码人员。

我想实现一个ADX过滤器,它将过滤横盘震荡的市场状况。

如果ADX指数低于25,它就不应该打开交易,我已经编码了这个简单的过滤器。

extern int ADXPeriod=14;

double CurrentADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,0);

double PreviousADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,1);

bool ADXfilter=false;

if(CurrentADX>25&&PreviousADX<25)

{

ADXfilter=true;

}

if(ADXfilter=true)

{

BUY();

.

.

SELL();

}

[/CODE]

For some reason the filer is not working. I have put the ADX filter before placing the buy / sell order.

Also putting it to the entry conditions signal is not working.

[CODE]

if(ADXfilter=true && MAFIB=="true" && BUY=="true")

谁能提供建议?谢谢你的建议!

tfi_markets

你的条件只有在adx在当前条形上越过25水平时才会起作用。

请用这个简单的方法代替。

if(CurrentADX>25) ADXfilter=true;

 
mladen:
mntiwana

替换掉这个:

double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2);[/PHP]

with this :

[PHP]double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse+1)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse+1);

亲爱的MLADEN,

再次感谢您的帮助,这部分已经完成,请您告诉我在图片中指出的EXTERN(MA1,MA2方法)中添加/替换什么。

问候

附加的文件:
10.png  128 kb
 
mntiwana:
亲爱的MLADEN,

再次感谢您,在您的帮助下,这部分已经完成了,请您告诉我在图片中指出的EXTERN(MA1,MA2方法)中应该添加/替换什么。

问候

mntiwana

你可以从那里删除MA方法。它们完全不需要了。

 
mladen:
mntiwana 你可以从那里删除ma方法。它们完全不需要了。

亲爱的MLADEN,

非常感谢BOSS,今天的课程和改进是远远不够的。

问候

 

亲爱的各位。

我正在寻找mql4中的sigmoid函数。这是我目前找到的东西。

//--------------------------- sigmoid() ---------------------------------

// 1/(1+exp(-x))

double sigmoid(double x)

{

如果(x>50)返回(1)。

如果(x<-50)返回(0)。

返回(1.0/(1.0+MathExp(-x)))。

}//sigmoid()

https://www.mql5.com/en/code/9002 和这个辩论神经网络 - 快速sigmoid算法 - Stack Overflow

谁能帮帮我?谢谢。

 
nevar:
亲爱的各位。

我正在寻找mql4中的sigmoid函数。这是我目前找到的东西。

//--------------------------- sigmoid() ---------------------------------

// 1/(1+exp(-x))

double sigmoid(double x)

{

如果(x>50)返回(1)。

如果(x<-50)返回(0)。

返回(1.0/(1.0+MathExp(-x)))。

}//sigmoid()

https://www.mql5.com/en/code/9002 和这个辩论神经网络 - 快速sigmoid算法 - Stack Overflow

有谁能帮忙吗?

nevar

这里用了一个:https://www.mql5.com/en/forum/179686/page13

 

hi mladen ....wowww它比我的指标.....,你是最好的。非常感谢你的帮助.....,许多人非常感谢你.....,真诚地...

 

HI mladen,

你们找到我代码中的错误了吗?

谢谢

原因: