Algo trading Fx

About me: I’m a computer programmer and about a year ago stumbled on Forex trading. Being a programmer started to look for any API available for FX trading and guess what, found Oanda API.
I started coding against Oanda API about 8 months ago. About 6 months ago started using my program in Demo account. Seeing it worked started developing few strategies and traded in Demo.

Today I placed my first live trade with $200 using my code. I have used simple candle stick pattern to determine setup and trade with single pair EUR/USD. Strategy works on 4hour.

I’ll post my progress every week here. I’m excited!

14 Likes

I love experiences such as these. Wish you make a killing!

Looking forward to your updates. Let us know if you need help.

1 Like

Great, I am waiting for your updates how you strtegy and system work?

1 Like

My strategy analyzes four 4 hours candles and trade on 5th candle. Trade lifetime is 4 hours, either it hit profit or close at the end of the candle. This strategy was back tested on 3 years of data and was able to convert $200 to $1600. Im not expecting the same results in live but I expect at least 20% of $200. Will see…

3 Likes

Week #1

Total trades: 8 Winners: 5 Losers: 3
Start balance: $200 End balance: $223.59
PL: $23.59 (12%)

Based on my back test I have tweaked my code for next week and onwards…

  • Added 50 pips stop loss. My back-test results showed that uncertainty can’t be avoided, and I incur huge loss without stop loss. After putting 50 pips stop, results improved significantly.
  • Added one more candle in my strategy. Now instead of 4 candles, 5 candles are considered while analyzing setup.
  • Closing trade before 5 pm to avoid any finance fee. Oanda charge a fee if you keep trade for a day. For this small account that hurts.

Please let me know if you guys have any suggestion, question or anything that can improve my trading.

See you all next week…Happy trading!

image

5 Likes

Week#2

Had a 10% drawdown in the beginning of the week. Nearly recovered by the end of the week.

Total trades:12 Winners:8 Losers:4
Start balance: $223.59 End balance: $221.56
PL: $-2.03 (-0.9%)

Till Date:

Start balance: $200 End balance: $221.56
PL: $21.56 (10.78%)
PL ratio:0.81
Winning trades: 65%
Losing trades: 35%

2 Likes

I just started to use the Oanda API too. There were no REST wrappers for Delphi, so I wrote those first… Now Im using MT4 to generate my signals (Because MT4 has the built in indicators) and let My app that I wrote deal with the orders. Going to move the whole thing over to Oanda API eventually…

2 Likes

Pipmonkey- Good to know! My algo do calculations based on open, high, low and close but API was not returning the correct open and I had to face 10% loss. When I contacted their customer service came to know that there is a parameter ‘smooth’ to get last candle close as open for new candle. Did that and was able to recover from losses.
My Algo runs on cloud 24/7 except market close. There is no manual interaction whatsoever. I have never done forex manual trading so I have no idea of MT4 or any other manual trading tool.

It’s great to see the way your strategy has worked for you. Keep on sharing your strategies, it would be of great help.

1 Like

Week#3

My Algo doesn’t trade on US, EUR & GBP holidays hence this week was short. Algo has produced better results than expected in 3 weeks. I’m waiting for the losing week to see how much low it can go. As per my 15 years of back test data the average drawdown is 35%. Max drawdown 81% in 2008 (market crash year).

Total trades: 7 Winners: 5 Losers: 2
Start balance: $221.56 End balance: $257.04
PL: 35.48 (16.01%)

Till Date:

Start balance: $200 End balance: $257.04
PL: 57.05 (28.52%)
PL ratio:0.93
Winning trades: 67%
Losing trades: 33%

2 Likes

Week#4

What a tough week! 50 pips stop hit for the first time in 4 weeks. Lost in the beginning recovered in the middle then again lost. Still up 18%.

Total trades: 14 Winners: 5 Losers: 9
Start balance: $257.04 End balance: $237.77
PL: $-19.27(-7.50%)

Till Date:

Start balance: $200 End balance: $237.77
PL: $37.77 (18.89%)
Winning trades: 56%
Losing trades: 44%

1 Like

Week#5

What a week! Lots of records broken. 5 consecutive losses, 4 consecutive wins & then again 4 consecutive losses. 3 big losses finally brought my account in RED. Still holding up, as per back tests it will rebound. Will see…

Total trades: 13 Winners: 4 Losers: 9
Start balance: $237.77 End balance: $189.67
PL: $-48.10(-20.23%)

Till Date:

Start balance: $200 End balance: $189.67
PL: $-10.32(-5.16%)
Winning trades: 50%
Losing trades: 50%

2 Likes

Hi @s_kushwah, As has been demonstrated and finally admitted to by various Brokers over the last 5 years, you are trading against your Brokers (LP’s) Algorithm which is only using the InterBank Markets prices as a guide… Nothing more… (Example)

I develop Indicators, Bots (EA’s) Strategies and extensively backtest a lot of code as well. After a while you will start to see patterns in the market makers algorithms. They become more obvious and more deliberate the more strategies I backtest…

Now…can I predict the markets?.. Hell no… but I can detect when the algorithm is running in one direction or the other…ie: Someone designs a Bot that makes a fortune from the get go… and it works perfectly for a while… then suddenly it no longer generates a profit… it is broken as they say… all that has happened is price action has flipped it’s signalling (Negative /Positive).

You can test this with any moving average crossover… do some backtesting to optimise parameters such as Time Frames… Periods… MA Type… even OCHL source… (I use powerful optimising software that tests 1000’s of combinations of these parameters over a matter of hours)

So, you find a combination and it works perfectly, now you let the EA lose on a Demo (or Live) account for some real results. It starts generating profits for 2-3 days maybe even a week or two (TF dependant)… then without changing any settings… it begins to lose each and every trade… 90% of the time taking your banked profit amounts right back to zero… This anomaly can be found with virtually ALL Indicators… hence why most trading strategies will require multiple Indicators / conditions (or NO Indicators) to be somewhat successful.

How many have seen these results from one of their time tested strategies?

Read across 1000’s of pages of Forex literature and you will see this phenomenon discussed ad nauseam… It’s how price action is designed to work… stretched margins, fooled Indicators… Continual Stop Hits… all conspiring to confuse traders and destroy profitable strategies engaged in these markets.

Week#5… The above is what you are witnessing…

Edit… Adding a Bool switch to an EA (reverse logic)… and test it… it will surprise you…

3 Likes

Hello @trendswithbenefits, thank you for enlightening me!

Fortunately I don’t use any kind of indicators. My strategy works on candlestick pattern recognition. Calculations are highly dependent on OHLC. If the broker screws that then I’m done.
I was expecting results like week#5 based on my backtests.

2 Likes

Yup, this is what Ive always preached… Charts and indicators are worthless… The only thing backtesting does is stress test your idea. Gives you an idea. I run my numbers and stats for 3 weeks back, and the previous week. thats it. I use no indicators… Just stats, and try to trade a butt ton so I can even the odds. I really treat the market like a dangerous casino. I think trying to read charts is a great distraction from what is really happening behind he scenes .

2 Likes

Week#6

I was able to recover last week’s losses. Maybe recovered this time but who knows what will happen next. Will see…

My stop hit one time because of news (US unemployment). Take away, update algo not to take trade on major news events.

In addition, did few modifications in the Algo. 1) Send an email if error happens while taking a trade or closing a trade. It was there however I made it very specific now. 2) Don’t take a trade at 5pm EST. Spread is so high at this time.

Total trades: 11 Winners: 7 Losers: 4
Start balance: $189.67 End balance: $217.43
PL: $27.76(14.64%)

Till Date:

Start balance: $200 End balance: $217.43
PL: $17.44(8.72%)
Winning trades: 52%
Losing trades: 48%

1 Like

Week#7

South Florida is expecting a hurricane this weekend. However, I have already experienced it this week. At one time my account was up 25% and by the end of week it is now in negative. In addition, my close order failed and I’m still in trade.

Changes in Algo…

  1. Circuit breaker: Now there is a daily and weekly loss limit. Once daily hit, no more trading for the day. However it will resume at 5:00pm EST. Same with weekly. Once weekly hits, no more trading for a week. It will resume at 5:00pm EST on Sunday.
  2. Reduce the position size for short trades. Stats are telling me that I’m losing most on short trades.

Onada now has a trading performance dashboard. Below are the numbers from that…

This week:

Till Date:

1 Like

Journey so far…

Greetings, very interesting post. I love Algo trading. How are you evaluating your strategies before putting them ‘online’.

I do a back test and demo test before going live. Oanda provides 15 years of historical data (from 2005). I back tested my strategy on 15 years of data and after seeing its resilience decided to go live with that.

1 Like