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.
You're welcome. btw, the original code should have worked, I just re-did it to exclude the use of multiple 'return's (which bugs me!) - are you sure it isn't an OrdersHistoryTotal() problem as described above?
Omelette,
I do not understand what you mean by "OrdersHistoryTotal() problem as described above". The problem I have experienced is that the EA would open the wrong position size after a loss.
I do not understand what you mean by "OrdersHistoryTotal() problem as described above". The problem I have experienced is that the EA would open the wrong position size after a loss.
EX:
1st trade = .1 lot resulting in a loss
then it would open
2nd trade = .3 lots
It should have been .2 lots
OrdersHistoryTotal() is buggy, meaning it will not work properly when backtesting. Also, when it is used in an EA that is being forward-tested, (such as this one) if there is no closed orders visible in the 'Accounts History' tab, the 'LotSizeFactor' variable (which is causing the problem) will not be set correctly...
That said, I have had a proper look at the code and the problem seems to be a 'recovery' issue, and not the code per-se - so I have restored the original code and added some 'recovery' code! (original post) Making an EA 'robust' to account for 'recovery' problems can be more difficult then writing the EA itself! And there is no guarantee with what I've done here - so let me know how it goes!
All the trades opened per the rules except EUR/CHF. It meet the 3 requirements on the candle close (< SMA, < PSAR, 10 day ADR @ 51). The red arrow you see in the pic was a few days ago on the original EA. Any idea why it would not open according to the code? Thanks again for all your help. Would you like to test along with us?
I've just realised I do not even know what the strategy is - could you outline exactly what is involved, as it's easier to know what the EA should be doing, rather than trying to work it out from the code - entry conditions I understand, but are you scaling into a position, semi-martingale-style, and waiting until a certain dollar value is achieved, or are losers closed out???
Also, is the EURCHF problem in addition to the lot-sizing bug?
omelette
Senior Member Join Date: Jan 2006
Posts: 1,070
I've just realised I do not even know what the strategy is - could you outline exactly what is involved, as it's easier to know what the EA should be doing, rather than trying to work it out from the code - entry conditions I understand, but are you scaling into a position, semi-martingale-style, and waiting until a certain dollar value is achieved, or are losers closed out???
Also, is the EURCHF problem in addition to the lot-sizing bug?
Omelette,
The system is very simple (hence its name). It is based on the daily candle close.
Entry for a short position:
If the candle closes below the SMA (currently set @ 20), below the PSAR (currently set a default), and the previous 10 day ADR is > 50 pips then an entry for a short is made on the open of the next daily candle.
Entry for a long position:
If the candle closes above the SMA (currently set @ 20), above the PSAR (currently set a default), and the previous 10 day ADR is > 50 pips then an entry for a long is made on the open of the next daily candle.
Stop loss & take profit:
I have both of these set to 100 pips giving a 1:1 risk/reward ratio
Money management:
The mm is designed to increase lot size by a factor of 1. It increases the lot size after a loss and decreases it after a win. Just image going up and down on a latter eventually returning to the ground when the job is finished.
Notes:
The system should have only 1 trade open per pair at any given time (contingent on all indicators agreeing of course). A new trade in that pair can't be opened until either the take profit or stop loss has been hit for the current trade. I am counting on our win rate to be 50% or better over the long haul. If this is the case, then our mm will recover the losses along the way.
I hope this summary gives you a good overview on how the SDS - simple daily system works.
Last edited by lcfxtrader; 08-19-2008 at 08:09 PM.
Also, is the EURCHF problem in addition to the lot-sizing bug?
I don't think so because I deactivated the old EA and loaded your version along with opening a new demo account. It meet the criteria for a short on the last daily candle. I will watch it again tonight and see what happens.
Thanks, that explain things nicely (and also what SDS stood for )
The EURCHF order you mentioned not opening - is this an additional bug?
Edit: Aha, I see you have just answered!
I don't know. The criteria was there to open a short. I doubled checked the open and closed orders and didn't see it. I will watch for the short tonight (0:00 GMT).