Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I am still trying to build my first basic EA. I finally have parts of it working but not all of it.
My idea is to buy/sell on retracements. So far, I am only working on the "Sell" portion of the EA. The "Buy" part will come later...hopefully.
The way that I want it to work is that I want to track the lowest point (CurrentLow) and when the price retraces by Ret1 (75 pips), to put a sell order in. If price comes back to CurrentLow, take profit and start the process over.
If price keeps going against me and it retraces by Ret2 (150 pips from CurrentLow), I want to put another sell order x 2 lots with take profit at the point of the first order plus one pip.
Stop Loss is placed at 225 pips from CurrentLow.
My EA is placing the order from the first level but not from the second level. I was able to get it to place orders from the second level but only at the same price as the first level.
Can someone please look at my code to see how I am screwing up.
I think you forgot about which low you use as currentlow. See, I can't imagine if you mean the low of current bar. If you mean what I think you mean, try to use iLowest[]. See it in dictionary of Metaeditor.
sorry, I didn't see you put currentlow = 1000;. But suggestion remains. See, currentlow = 1000; 1000 what? 1.0000 like in GBP/USD? 1000 point, from where? So, still the same, use iLowest[] for currentlow. I think it would work fine.
What I am trying to achieve is not based on a high or low of any timeframe but the lowest point prior to a Ret1 (75 pip) retracement. I am focusing on the EUR/USD to start.
CurrentLow is supposed to track the lowest point before the retracement.
The following is an example of what I am trying to achieve.
a) Let's say we open the EA and the price is 1.4000 and it ranges between 1.4030 and 1.3970 before going to 1.4045. I would want CurrentLow to be 1.3970 (Lowest point) and to place the first sell order at 1.4045 (Entry1) with a SL of 1.4195 (SL1 =150 pips) and a Take Profit (TPA = 75 pips) of 1.3970.
b) if the price continues to go up to 1.4120 (Entry2), I would want a 2nd sell order placed with take profit (TPB =76 pips) of 1.4044 and SL of 1.4195 (same as on the first order).
My EA seems to work for the first order but it doesn't seem to get to the second order. I have been able to get it to place the second order but the price was the same as the first order and the SL was screwed up.
My long term goal is to have it decide whether it should be a buy or sell based on long term trend indicators and of course to have a buy set up like this sell set up as shown here. I have no idea whether it will be profitable but I am trying to learn and will surely make a million modifications before it is completed. I have come to the conclusion that to find out if any strategy works, it needs to be automated and take the human error out of the decision making. Obviously, fundamentals need to be looked at but that will come later...maybe.
Any help from Sendra or anyone else will be highly appreciated.
In order to answer your question about CurrentLow, I gave it a value of 1000 as that will always be bigger than any E/U price. This is to make sure that it takes the first EU price when it opens. If I would set it to 0, the price would never be lower and therefore no trades would ever take place.
I have never seen iLowest but I will check into it to see if it would work for me.
Putz, what do you mean, "seems to work"? Either it is working or it is not. if it does work for the first order, then you should base your second order upon it (use OrderOpenPrice() as the basis of your second order instead of your currentlow like the first one).