Hi Guys,
How can I define "one trade if conditions meet" in the EA...PLease help.
Thanks
How can I define "one trade if conditions meet" in the EA...PLease help.
Thanks
EA that can trade through all market conditions 23 replies
Market Conditions Not To Trade 0 replies
Trading Plan, Rules and Conditions to Enter a Trade 10 replies
Prove profitability without revealing trade conditions? 36 replies
two version of FF tunnel Chart, one say down, one say up, which one is correct? 3 replies
Quoting smjonesDislikedCould you restate your question with much more detail and the software you are talking about? thanksIgnored
Quoting babarmughalDislikedHI smjones,
thanks for your reply, i am writing an EA and I want it to open only one trade say BUY and if that trade hits TP then wait for the SELL conditions to meet and then place the sell order...i can not think of a right statment, i have tested the EA and if the buy trade hits tp in next say 2 min and if the conditions are met for buy then it will straight away open another buy trade...what i want is WAIT for the SELL conditions to meet no matter how long it takes..
Thanks for helping me in advanceIgnored
Quoting smjonesDislikedOk, I see you you are saying now. I am going to move this thread to the Metatrader forum, where I am sure you will get an answer quickly...
Thanks ScottIgnored
Quoting babarmughalDislikedHI smjones,
thanks for your reply, i am writing an EA and I want it to open only one trade say BUY and if that trade hits TP then wait for the SELL conditions to meet and then place the sell order...i can not think of a right statment, i have tested the EA and if the buy trade hits tp in next say 2 min and if the conditions are met for buy then it will straight away open another buy trade...what i want is WAIT for the SELL conditions to meet no matter how long it takes..
Thanks for helping me in advanceIgnored
Quoting stockwetDislikedYou just have to program some logic to remember what the previous trade was then test for it.
Here's an example. You could set a variable, say, tradedir as an integer. When you enter a buy trade, set it to 1. When your buy trade closes, you check tradedir. If it's equal to 1, prevent the expert from opening a sell trade. When your sell condition is met, place the trade and set tradedir to 0. Repeat as with the buy signal.
Does that help?Ignored
Quoting babarmughalDislikedto be honest looks a bit difficult, i am not that good in mt4 programming, is there a simple way of writing this into the EA
ThanksIgnored
Quoting stockwetDislikedTry this:
if(BuyCondition && LastTrade == "Sell")
Do the same for the sell condition, except LastTrade == "Buy".Ignored
Quoting stockwetDislikedTry this:
if(BuyCondition && LastTrade == "Sell")
Do the same for the sell condition, except LastTrade == "Buy".Ignored
Quoting babarmughalDislikedOK Tried and no trades placed.....Ignored
Quoting stockwetDislikedI don't know your code, but, you need to initialize the variable somewhere. Right now, it's not assigned any value. You need to give it a value to start off with, or, you need to tell the expert to place a buy or sell trade if there is no value:
if(BuyCondition && (LastTrade == "Sell" || LastTrade == "")) - you might have to use LastTrade == NULL or something like that.Ignored
Quoting babarmughalDislikedHi Stockwet,
i have tried this aswell but no trade opens.....
ThanksIgnored
Quoting stockwetDislikedHey man,
First of all, please don't shout.
Second of all, I gave you all the information you need to do what you asked. Without looking at ALL of your code, that's about it. I think any other coder would agree.
Third, take some time to figure out why this isn't working. Look through the documentation. Test out various things. Use the Print() function to print and see if various variables are printing.
Fourth, if you'd like to pay, I'm sure someone would be willing to do all the work for you. But, this is an open forum. We're all busy and we all have lots of things to juggle. We provide help and will point people in the right direction. But, in the end, you will learn more by figuring this issue out yourself.Ignored