Can I set my Buy & Sell EA to ONLY Buy or ONLY Sell?
-
Hi Guys,
I have created an EA that opens a Buy trade when certain conditions are met and opens a Sell trade when the opposite conditions are met.
How can I set this EA to only open Buy trades and ignore Sell signals and vice versa when I feel there is a favourable direction?
I was hoping that there would simply be an option in MT5 (perhaps in the Properties of the EA) but it appears not.
Or would I have to create a separate Buy and separate Sell EA altogether?
Thanks,
Dre
-
Hi, you should share your project so we can help you.
-

Thank you
-
@dre Hi.
you should use two "No position" blocks for separating.
you need few blocks for control ON or OFF "No position" blocks.
for example, you can use "Constants" for manually controlling or check ATR for On or OFF blocks.... -
Thanks for your help.
I am having difficulty understanding what you mean.
I am fine with manually setting if I want the EA to "sell only" or "buy only".
So I need to add some "Turn OFF Blocks" blocks and "Turn ON Blocks" blocks?
How do I allow them to be controlled as inputs in MetaTrader using Constants?
I am fine with using simple Constants like inputting a Lot Size in MetaTrader etc. but unsure how I would control the "Turn OFF Blocks" and "Turn ON Blocks" blocks with Constants.
Thanks
-
@dre i hope you can take idea...
3 status are here for input, you can write, Both, Buy or Sell and control blocks for activatehttps://fxdreema.com/shared/wGwOoNHQb
sorry for my English

-
@dre I updated the link now
-
Hello;
you can do it this way
-
@dre If you don't want that logic in your EA, you might set the desired setting in EA properties as well.

-
@dragonfly617 this way is not safe. maybe profit is negative and close positions aren't good idea
-
@xfire This setting only applies to opening a new position afaik
-
@trader-philipps i think not working in mt5
-
@trader-philipps if before new position other positions were open then we cant use block "3" as not safe.
if wasn't open any position then block "3" didn't need. -
@xfire said in Can I set my Buy & Sell EA to ONLY Buy or ONLY Sell?:
@dre I updated the link now
@Xfire Thank you.
I think I understand it but how do I write the Constant? I guess we are trying to make a drop-down box to select either "Buy Only", "Sell Only" or "Both"? What data type of Constant will this be - "enum"? I am not familiar with "enum" but will try to work it out if this is what I need to use.
Thanks
-
@dragonfly617 Thanks for the advice. I'm probably just being stupid (I'm new to fxDreema) but I don't understand the logic here. But thanks for trying to help.
-
@trader-philipps said in Can I set my Buy & Sell EA to ONLY Buy or ONLY Sell?:
@dre If you don't want that logic in your EA, you might set the desired setting in EA properties as well.

This would be IDEAL! This is all I want. But I don't have this option. Is this in MT4? I am using MT5.
-
@dre in the left corner you can click and open a window to create your constant.
if you can use Enum you can take a sample from indicators mq5 files and change for yourself in Ea mq5 file.

-
@Xfire Thank you very much. I will give it a go

-
@dre Screenshot ist mt4
-
i also looking for the same solution here