Not working BuySignal, please help a newbie
marve7ou_marc: a Buy and a Sell Position at once,
- Can't be done, must be done sequentially. Can't be done on US brokers, no hedging allowed.
if(MAshort==(Ask-(vspread/2)))
Doubles are rarely equal. The == operand. - MQL4 forum And that isn't checking for a cross.if(BuySignal == true) if(OrderSelect(ShortOrder,SELECT_BY_TICKET)==true)
You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So Don't write if(bool == true), just use if(bool) or if(!bool).if(MAshort==(Ask-(vspread/2))) { BuySignal = true; } else BuySignal = false;
Simplify https://www.mql5.com/en/forum/193541#comment_5118866
whroeder1:
- Can't be done, must be done sequentially. Can't be done on US brokers, no hedging allowed.
- Doubles are rarely equal.
The == operand. -
MQL4 forum And that isn't checking for a cross.
- You would never write if( (2+2 == 4) == true) would
you? if(2+2 == 4) is sufficient. So Don't write if(bool == true),
just use if(bool) or if(!bool).
- Simplify https://www.mql5.com/en/forum/193541#comment_5118866
Thank you very much whroeder1,
I think I got most of your points, and now it is trading. But the sell and buy orders are most of the time executed not at the same time, can you maybe explain how to do the order sequentially to achieve simultaneous orders or what you mean by this in general. My Broker allows hedging in general. Thank you very very much.
Dear Gents,
I just started coding a little bit with mql4 and after studying some literature I wrote my first own EA. Compiling was without errors, but I cant get my EA to go into positions. My Idea was to open a Buy and a Sell Position at once, when the current Bar is crossing a shortterm Moving Average.
The code is the following:
Thank you in advance for any help.