I have the the problem <enum BuyOrSell >

 

I have an ea(mt4),it has the code like this:

(enum BuyOrSell0 {only buy = 0,only sell = 1,buy and sell = 2};

input BuyOrSell0   = 2;

when I type 1 where <input BuyOrSell>, it only sells,type 0,it only buys,

type 2,it  buys and sells.

But I have to finish this bfore it starts.

I want it automatically change the direction.I hope that when FastMA>SlowMA, it will buy and stop selling and when FastMA<SlowMA it will stop buying and continue selling..

How can I add some code like this?

Can anyone help me?

 
manafu:

I have an ea(mt4),it has the code like this:

(enum BuyOrSell0 {only buy = 0,only sell = 1,buy and sell = 2};

input BuyOrSell0   = 2;

when I type 1 where <input BuyOrSell>, it only sells,type 0,it only buys,

type 2,it  buys and sells.

But I have to finish this bfore it starts.

I want it automatically change the direction.I hope that when FastMA>SlowMA, it will buy and stop selling and when FastMA<SlowMA it will stop buying and continue selling..

How can I add some code like this?

Can anyone help me?

just change the variable。
if (FastMA<SlowMA)BuyOrSell0=0;


 

@Feng Guozheng

Thanks for your help

Feng Guozheng
Feng Guozheng
  • 2019.08.23
  • www.mql5.com
交易者的个人资料
 
manafu:

@Feng Guozheng

Thanks for your help

ywc