Download MetaTrader 5
To add comments, please log in or register
Do you want to become a well-known developer? Execute the orders of traders in the Freelance service!
Gabriel Brasil
153
Gabriel Brasil 2014.02.27 14:11 

Hi there guys!

I just made a little EA to test a strategy here but my knowledge of programming goes only so far and there are a few problems I want to solve and hoped you guys could help me out here:

1) The ea needs to open a trade right at the open of a new candle, if the rules are met on the previous. Its doing that all right, but if the TP is hit in that same candle, it will open more trades and that`s not good, so I need the EA to trade only at the openning of the candle, not when the candle has already moved. (so I think I need something like a "trade only on the first tick" command or something).

2) I need the ea to open a trade every time a new signal is given despite i have orders already opened. Right now, it opens one trade and until that trade is closed it will not trade any new signals.

I hope you guys can help me out. I would need that someone told me where I should place these new command lines also, cuz I won`t have any idea.

Thank you very much!

Keith Watford
Moderator
7908
Keith Watford 2014.02.27 14:26  

You can loop through OrdersHistory and OpenOrders and see if OrderOpenTime >Time[0]

If it is true, then you will know that a trade has already been opened in that bar, so don't open another.

Gabriel Brasil
153
Gabriel Brasil 2014.02.27 14:34  
GumRai, I haven`t find "OrderOpenTime" in the script... could you help?
Files:
robo.txt 5 kb
Gabriel Brasil
153
Gabriel Brasil 2014.03.02 14:16  
Up!
whroeder1
13616
whroeder1 2014.03.02 14:32  
gbraidotti: GumRai, I haven`t find "OrderOpenTime" in the script... could you help?
learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
/
To add comments, please log in or register