- Most Forex traders lose all their money.
- Using the robot posted here in trading Forex does not guarantee success.
- Trading this robot could lead to serious financial loss.
- Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
- To trade this robot, you have to understand how to use the Fibonacci sequence in trading. You are unlikely to gain that knowledge here.
I awoke this morning determined not to code a single line. Sadly, I received a pm from ForexKiwi.
Hunker down guys, this is going to be a bit of a read.
Here is a digest of ForexKiwi's proposal:
- The market on any given day is likely to follow the direction of the previous day.
- ForexKiwi's research showed that when this happens, a 40 pip move is likely if the market is not trending strongly; a 100 pip move is likely in a strong trend.
- If the previous candle was a riser, we are looking to buy. If it was a faller, we are looking to sell.
- At the start of each new D1 candle, draw a fib from the high to the low of the previous day.
- The key levels are the 75 (for buying) and 25 (for selling).
- So:
- Rising candle:
- If the market is above the 75, send a pending buy limit pending trade.
- If the market is already below the 75, send an immediate market order
- Falling candle
- If the market is below the 25, send a pending sell limit pending trade.
- If the market is already above the 25, send an immediate market order
- TP and SL both 100
- Rising candle:
ForexKiwi asked if I can code the robot. What is a guy supposed to do?
So was born the unattractively-named 'ForexKiwi's D1 Fib Retracement auto-trader by SteveHopwood'. I am going to call it FK for short.
FK was an instant backtesting loser. We all know that I do not have a lot of faith in backtesting, but I can state this with certaintly; if an ea loses in backtesting, it gets murdered on a forward demo.
I was playing last night, and coded another Rsi trader to scalp EU. Go long if
- D1 Rsi(20) is above 55 and is higher than it was yesterday
- Chart TF Rsi(20) is higher than it was at the close of the previous candle
This was an instant backtesting loser, so I did some playing with optimising the tp and sl settings, and turned it into a quite magnificent winner. I am a newbie at optimising, so I may not be doing this correctly.
Applying this to FK, I optimised the tp and sl from 50 to 200 in steps of 10 over the last year and turned it into a winner. FK includes an option to use optimised values – AutoCalculateTpSl. The optimised values for the pairs I have optimised are hard-coded into init() and will be used to provide the tp and sl. You can read the list of pairs I have optimised further down; as I optimise more pairs, I will add to the list.
So, question no 1 for the experienced optimisers is this: how far back should I go in time when optimising the D1 chart?
The rest of FK is easy to understand. It draws the fib and sets the tp/sl when it sends trades at the start of each D1 candle. There are the usual management features. Pendings are deleted if unfilled after 18 hours (at least, that is what I intended to code).
Optimised pairs list
- EURUSD
- USDCHF
- GBPUSD
- USDJPY
- GBPJPY
- AUDUSD
Pairs and settings found most profitable by users
- ForexKiwi: GPBUSD: http://www.forexfactory.com/showpost...6&postcount=33
- TP 300
- SL 130
- Breakeven 40: Breakeven pips 20
- Trailing Stop 30: Trail After Breakeven = False
The interesting stuff
Here is where things become complicated, so newbie traders and non-coders might like to skip the next bit.
I know I optimised back over a year, but I wonder if it is really the previous month that is more significant. This made me contemplate how great it would be if FK could do its own optimisation at the start of each new monthly candlestick.
Before I even begin to code self-optimisation, I need to design the algorithm. Here is what I am thinking. At the start of each new MN1 candle:
- TP = 50, SL = 50, BiggestProfit = 0
- open a TP loop
- open a SL loop with a LoopProfit = 0
- open a 30 D1 candle look-back loop, starting with the previous D1 candle
- read the high/low of the candle, define it as rising or falling, and calculate the 75/25 fib levels
- candle was rising:
- current candle opens above or at the 75: simulate a pending buy limit at the 75
- current candle opens below the 75: simulate a market buy order
- candle was falling:
- current candle opens below or at the 25: simulate a pending sell limit at the 25
- current candle opens above the 25: simulate a market sell order
- open a M1 loop indexed at the start of the D1 candlestick
- buy trade
- M1 high >= TP: add the TP pips to LoopProfit and close the loop
- M1 low <= SL: subtract the SL pips from LoopProfit and close the loop
- sell trade
- M1 low <= TP: add the TP pips to LoopProfit and close the loop
- M1 high >= SL: subtract the SL pips from LoopProfit and close the loop
- increment the loop index to move forward in time, closer to now
- buy trade
- end of M1 loop
- if LoopProfit > BiggestProfit then BiggestProfit becomes LoopProfit. The TP and SL that gave this figure are stored in a global variable or a file
- Increment the D1 candle index to go 1 day further back in time
- end of 30 D1 candle look-back loop
- Increment the SL by 10
- open a 30 D1 candle look-back loop, starting with the previous D1 candle
- end of SL loop
- Increment the TP by 10
- open a SL loop with a LoopProfit = 0
- end of TP loop
At the end of this process, we have the TP and SL combo that gave the best returns over the previous month's trading, saved in global variables or a file that FK can re-read whenever it is restarted.
So, any further thoughts, guys? Anything wrong with the algorithm? I have attached the zip with the Open Office document I used to create this page, so you can re-order/correct/add to the algorithm should you see anything wrong.
http://cdn.forexfactory.com/images/s...m/big_grin.gif
___________________________________ ____________________________
Traders familiar with my work need read no further.
Posting restrictions
I have restricted the ability to post in this thread to: traders with at least 1 voucher; and traders on my 'buddy' list. I have done this because I do not want the thread cluttered with 'newbie' questions about the basics. New/inexperienced traders, this is not intended as a direct insult. What I want here is discussion with traders who fully understand what it is they are doing; when you newbs have been around a while, you will come to understand what a difference experience makes to the posts a member writes and shudder at the recollection of some of the questions you asked. I do. http://cdn.forexfactory.com/images/s..._the_floor.gif Go to your profile page; there is a link to the FF page that describes the voucher process.
Do not attempt to get around this by sending me pm's asking for help with your basic problems. Doing so will earn you an automatic ban from all of my threads.
I have set up a partner thread to this one and Nanningbob's at http://www.forexfactory.com/showthre...66#post3948666
Here, you can post the questions that you cannot post here, about anything you need to know. Someone with the knowledge and experience you need will answer. I opened it for Nanningbob traders, but feel free to ask about this robot as well.
Traders/coders with experience who have not yet been vouched for, can get around this restriction be being added to my 'buddy' list; all you have to do is pm me to ask me to do this.