Hey everyone, I just finished back and forward testing a forex trading strategy using MetaTrader 4 connected to my own Python script which does all the calculations and sends order back. I would like to have this run independently. I have two options: rent a VPS and trade through there or make my own server and have it trade at home. What do you prefer? I'm leaning towards making my own server as it is much easier to do testing and maintanance (and it's cool). If I decide to make one myself, what should I keep in mind compared to say, a simple web server. Kind regards :) submitted by
Almost every day people come to this subreddit asking the same basic questions over and over again. I've put this guide together to point you in the right direction and help you get started on your forex journey.
A quick background on me before you ask: My name is Bob, I'm based out of western Canada. I started my forex journey back in January 2018 and am still learning. However I am trading live, not on demo accounts. I also code my own EA's. I not certified, licensed, insured, or even remotely qualified as a professional in the finance industry. Nothing I say constitutes financial advice.
Take what I'm saying with a grain of salt, but everything I've outlined below is a synopsis of some tough lessons I've learned over the last year of being in this business.
LET'S GET SOME UNPLEASANTNESS OUT OF THE WAY
I'm going to call you stupid. I'm also going to call you dumb. I'm going to call you many other things. I do this because odds are, you are stupid, foolish,and just asking to have your money taken away. Welcome to the 95% of retail traders. Perhaps uneducated or uninformed are better phrases, but I've never been a big proponent of being politically correct.
Want to get out of the 95% and join the 5% of us who actually make money doing this? Put your grown up pants on, buck up, and don't give me any of this pc "This is hurting my feelings so I'm not going to listen to you" bullshit that the world has been moving towards.
Let's rip the bandage off quickly on this point - the world does not give a fuck about you
. At one point maybe it did, it was this amazing vision nicknamed the American Dream. It died an agonizing, horrible death at the hand of capitalists and entrepreneurs. The world today revolves around money. Your money, my money, everybody's money. People want to take your money to add it to theirs. They don't give a fuck if it forces you out on the street and your family has to live in cardboard box. The world just stopped caring in general. It sucks, but it's the way the world works now. Welcome to the new world order. It's called Capitalism.
And here comes the next hard truth that you will need to accept - Forex is a cruel bitch of a mistress. She will hurt you. She will torment you. She will give you nightmares. She will keep you awake at night. And then she will tease you with a glimmer of hope to lure you into a false sense of security before she then guts you like a fish and shows you what your insides look like.
This statement applies to all trading markets - they are cruel, ruthless, and not for the weak minded.
The sooner you accept these truths, the sooner you will become profitable. Don't accept it? That's fine. Don't bother reading any further. If I've offended you I don't give a fuck. You can run back home and hide under your bed. The world doesn't care and neither do I.
For what it's worth - I am not normally an major condescending asshole like the above paragraphs would suggest. In fact, if you look through my posts on this subreddit you will see I am actually quite helpful most of the time to many people who come here. But I need you to really understand that Forex is not for most people
. It will make you cry. And if the markets themselves don't do it, the people in the markets will.
LESSON 1 - LEARN THE BASICS
Save yourself and everybody here a bunch of time - learn the basics of forex. You can learn the basics for free - BabyPips has one of the best free courses online which explains what exactly forex is, how it works, different strategies and methods of how to approach trading, and many other amazing topics.
You can access the BabyPips course by clicking this link: https://www.babypips.com/learn/forex
Do EVERY course in the School of Pipsology. It's free, it's comprehensive, and it will save you from a lot of trouble. It also has the added benefit of preventing you from looking foolish and uneducated when you come here asking for help if you already know this stuff.
If you still have questions about how forex works, please see the FREE RESOURCES links on the /Forex
FAQ which can be found here: https://www.reddit.com/Forex/wiki/index
Answer these questions truthfully to yourself:
-What is the difference between a market order, a stop order, and a limit order?
-How do you draw a support/resistance line? (Demonstrate it to yourself)
-What is the difference between MACD, RSI, and Stochastic indicators?
-What is fundamental analysis and how does it differ from technical analysis and price action trading?
-True or False: It's better to have a broker who gives you 500:1 margin instead of 50:1 margin. Be able to justify your reasoning.
If you don't know to answer to any of these questions, then you aren't ready to move on. Go back to the School of Pipsology linked above and do it all again.
If you can answer these questions without having to refer to any kind of reference then congratulations, you are ready to move past being a forex newbie and are ready to dive into the wonderful world of currency trading! Move onto Lesson 2 below.
LESSON 2 - RANDOM STRANGERS ARE NOT GOING TO HELP YOU GET RICH IN FOREX
This may come as a bit of a shock to you, but that random stranger on instagram who is posting about how he is killing it on forex is not trying to insprire you to greatness. He's also not trying to help you. He's also not trying to teach you how to attain financial freedom.
99.99999% of people posting about wanting to help you become rich in forex are LYING TO YOU
Why would such nice, polite people do such a thing? Because THEY ARE TRYING TO PROFIT FROM YOUR STUPIDITY
Plain and simple. Here's just a few ways these "experts" and "gurus" profit from you:
- Referral Links - If they require you to click a specific link to signup for something, it means they are an affiliate. They get a commission from whatever the third party is that they are sending you to. I don't care if it's a brokerage, training program, hell even an Amazon link to a book - if they insist you have to click their super exclusive, can't-get-this-deal-any-other-way-but-clicking-my-link type bullshit, it's an affiliate link. There is nothing inherently wrong with affiliate programs, but you are literally generating money for some stranger because they convinced you to buy something. Some brokers such as ICMarkets have affiliate programs that payout a percentage of the commission you generate - this is a really clever system - whether you profit or blow your entire account, the person who referred you to the broker makes a profit off you. Clever eh?
- Signal Services, Education & Training Programs, Courses - If somebody is telling you they are making a killing with a signal service and are trying to convince you to join it, I guarantee they are getting a piece of your monthly fee. And better still, these signal services often work...for about a week. Just long enough to suck a bunch of poor fools into it. You see people making money, you want in so you agree to pay the $200+/month subscription fee. You follow the signals and it looks like it's making money for a few days or weeks. Then it turns sideways, you start losing money hand over fist. Pretty soon you have lost most of your trading account because you blindly followed a signal service. And better still - when you go screaming at the person running the signal service they will be very quick to point you to their No Refunds policy. To add insult to injury, the buttfucker that referred you to the signal service in the past will likely listen to you getting mad, and then come back with something like "Sorry it didn't work out, but I just joined this other amazing service and it's working great, you should come join it to earn your money back. Here's my link..." You get the point here right?
- Multi-Level Marketing (MLMs) - These people are scum. They are going to offer you training and education, signals, access to forex experts and gurus, and all kinds of other shit with the promise that you will live the dream and become financially free. They are also loading you into a pyrmaid scheme where you will be hounded to recruit other people and make money off them just like you got roped into it. A really prime example here is iMarkets Live (or IML for short). Don't touch this shit with a 10 foot pole. I don't care what they are claiming, you will lose everything using them.
- Fund Managers - These people make my skin crawl. It's a classic scam and it works like this - somebody will post online about how much money they are making trading forex/commodities/stocks/whatever. Most of the time they won't explicitly post they are offering a trading service, rather they just put the message out there and wait for the ignorant masses (that's you) to contact them. They will charm you. They will lie to you. They will promise you the moon if you simply wire them some money or give them API access to your trading account. Care to guess what happens next? If you send a wire transfer (or Western Union...hell any kind of payment to them) they will vanish. Happens usually after they take a bunch of suckers for the ride. You sent them $2,000 and so do 9 other suckers. They just made $20,000 and are gone. With API access to your account, you will find your account gets blown super fast or worse - possibly leaving you open to persecution by the broker you are using.
These are just a few examples. The reality is that very few people make it big in forex or any kind of trading. If somebody is trying to sell you the dream, they are essentially a magician - making you look the other way while they snatch your wallet and clean you out.
Additionally, on the topic of fund managers - legitimate fund managers will be certified, licensed, and insured
. Ask them for proof of those 3 things. What they typically look like are:
- Certified - This varies from country to country, in the US it's FINRA (http://www.finra.org). They need to have their Series 7 certification minimum. You can make the case that other FINRA certifications are acceptable in lieu of Series 7, but the 7 is the gold standard.
- Licensed - They need to have a valid business license issued by the government. It must clearly state they are an investment company, preferrably a hedge fund because they have some super strict requirements to operate (and often require $25,000+ in fees just to get their business license, so you know they at least have some skin in the game).
- Insured - They need to be backed by an insurance company. I'm not talking general insurance for shit like their office burning down. I'm talking about a government-implemented protection insurance program - in the US I believe that is issued by the Securities Investment Protection Corporation (https://www.sipc.org/).
If you are talking to a fund manager and they are insisting they have all of these, get a copy of their verification documents and lookup their licenses on the directories of the issuers to verify they are valid
. If they are, then at least you are talking to somebody who seems to have their shit together and is doing investment management and trading as a professional and you are at least partially protected when the shit hits the fan.
LESSON 3 - UNDERSTAND YOUR RISK
Many people jump into Forex, drop $2000 into a broker account and start trading 1 lot orders because they signed up with a broker thinking they will get rich because they were given 500:1 margin and can risk it all on each trade. Worst-case scenario you lose your account, best case scenario you become a millionaire very quickly. Seems like a pretty good gamble right? You are dead wrong.
As a new trader, you should never risk more than 1% of your account balance on a trade. If you have some experience and are confident and doing well, then it's perfectly natural to risk 2-3% of your account per trade. Anybody who risks more than 4-5% of their account on a single trade deserves to blow their account. At that point you aren't trading, you are gambling. Don't pretend you are a trader when really you are just putting everything on red and hoping the roulette ball lands in the right spot.
It's stupid and reckless and going to screw you very quickly.
Let's do some math here:
You put $2,000 into your trading account. Risking 1%
means you are willing to lose $20 per trade. That means you are going to be trading micro lots, or 0.01 lots most likely ($0.10/pip). At that level you can have a trade stop loss at -200 pips and only lose $20. It's the best starting point for anybody. Additionally, if you SL 20 trades in a row you are only down $200 (or 10% of your account) which isn't that difficult to recover from. Risking 3%
means you are willing to lose $60 per trade. You could do mini lots at this point, which is 0.1 lots (or $1/pip). Let's say you SL on 20 trades in a row. You've just lost $1,200 or 60% of your account. Even veteran traders will go through periods of repeat SL'ing, you are not a special snowflake and are not immune to periods of major drawdown. Risking 5%
means you are willing to lose $100 per trade. SL 20 trades in a row, your account is blown. As Red Foreman would call it - Good job dumbass.
Never risk more than 1% of your account on any trade until you can show that you are either consistently breaking even or making a profit. By consistently, I mean 200 trades minimum. You do 200 trades over a period of time and either break-even or make a profit, then you should be alright to increase your risk.
Unfortunately, this is where many retail traders get greedy and blow it. They will do 10 trades and hit their profit target on 9 of them. They will start seeing huge piles of money in their future and get greedy. They will start taking more risk on their trades than their account can handle.
200 trades of break-even or profitable performance risking 1% per trade. Don't even think about increasing your risk tolerance until you do it. When you get to this point, increase you risk to 2%. Do 1,000 trades at this level and show break-even or profit.
If you blow your account, go back down to 1% until you can figure out what the hell you did differently or wrong, fix your strategy, and try again.
Once you clear 1,000 trades at 2%, it's really up to you if you want to increase your risk. I don't recommend it. Even 2% is bordering on gambling to be honest.
LESSON 4 - THE 500 PIP DRAWDOWN RULE
This is a rule I created for myself and it's a great way to help protect your account from blowing.
Sometimes the market goes insane. Like really insane. Insane to the point that your broker can't keep up and they can't hold your orders to the SL and TP levels you specified. They will try, but during a flash crash like we had at the start of January 2019 the rules can sometimes go flying out the window on account of the trading servers being unable to keep up with all the shit that's hitting the fan.
Because of this I live by a rule I call the 500 Pip Drawdown Rule and it's really quite simple - Have enough funds in your account to cover a 500 pip drawdown on your largest open trade
. I don't care if you set a SL of -50 pips. During a flash crash that shit sometimes just breaks.
So let's use an example - you open a 0.1 lot short order on USDCAD and set the SL to 50 pips (so you'd only lose $50 if you hit stoploss). An hour later Trump makes some absurd announcement which causes a massive fundamental event on the market. A flash crash happens and over the course of the next few minutes USDCAD spikes up 500 pips, your broker is struggling to keep shit under control and your order slips through the cracks. By the time your broker is able to clear the backlog of orders and activity, your order closes out at 500 pips in the red. You just lost $500 when you intended initially to only risk $50.
It gets kinda scary if you are dealing with whole lot orders. A single order with a 500 pip drawdown is $5,000 gone in an instant. That will decimate many trader accounts.
Remember my statements above about Forex being a cruel bitch of a mistress? I wasn't kidding.
Granted - the above scenario is very rare to actually happen. But glitches to happen from time to time. Broker servers go offline. Weird shit happens which sets off a fundamental shift. Lots of stuff can break your account very quickly if you aren't using proper risk management.
LESSON 5 - UNDERSTAND DIFFERENT TRADING METHODOLOGIES
Generally speaking, there are 3 trading methodologies that traders employ. It's important to figure out what method you intend to use before asking for help. Each has their pros and cons, and you can combine them in a somewhat hybrid methodology but that introduces challenges as well.
In a nutshell:
- Price Action Trading (Sometimes called Naked Trading) is very effective at identifying when trends will start and finish. This gives you the advantage of staying ahead of the market and predicting when a change in trend direction will occur. It has the disadvantage of being really easy to screw it up if you don't plot your support and resistance lines properly and interpret the chart wrong. Because you can identify a change in trend direction, you'll generally make more profit on a new trend than a technical strategy will.
- Technical Analytics (or TA) uses math and statistics to try and identify where the market is headed or confirm/reject whether a trend is happening. It has the advantage of being very math and stat driven which is hard to refute the numbers, but it has the disadvantage of being late to the party when it comes to identifying trends (hence why people call TA a lagging strategy). When people fail using TA, it's not because of the math - it's because you misinterpreted what the math is telling you.
- Fundamental Analysis (or FA) uses news and macro scale events to predict what is going on. A really good example right now is Brexit, what a clusterfuck that is. Every time some major brexit news breaks it causes all sorts of choas in almost every currency pair. Fundamental trading has the highest potential profitability per trade but it also has the highest potential drawdown per trade.
Now you may be thinking that you want to be a a price action trader - you should still learn the principles and concepts behind TA and FA. Same if you are planning to be a technical trader - you should learn about price action and fundamental analysis. More knowledge is better, always.
With regards to technical analysis, you need to really understand what the different indicators are tell you. It's very easy to misinterpret what an indicator is telling you, which causes you to make a bad trade and lose money. It's also important to understand that every indicator can be tuned to your personal preferences.
You might find, for example, that using Bollinger Bands with the normal 20 period SMA close, 2 standard deviation is not effective for how you look at the chart, but changing that to say a 20 period EMA average price, 1 standard deviation bollinger band indicator could give you significantly more insight.
LESSON 6 - TIMEFRAMES MATTER
Understanding the differences in which timeframes you trade on will make or break your chosen strategy. Some strategies work really well on Daily timeframes (i.e. Ichimoku) but they fall flat on their face if you use them on 1H timeframes, for example.
There is no right or wrong answer on what timeframe is best to trade on
. Generally speaking however, there are 2 things to consider:
- Speed - If you are scalping (trading on the really fast candles like 1M, 5M, 15M, etc) odds are your trades are very short lived. Maybe 10 minutes to an hour tops. For the most part, scalping strategies will produce little profit per trade but make up for it in the sheer volume of trades. Whereas swing trading may only make a few trades but each one could be worth a significant amount of money.
- Spread (the fee you pay to the broker when you trade) - If you are a scalper, the spread is your worst enemy because you have to overcome it very fast to make a profit on your order. Whereas swing trading the spread hardly impacts you at all.
If you are a total newbie to forex, I suggest you don't trade on anything shorter than the 1H timeframe when you are first learning
. Trading on higher timeframes tends to be much more forgiving and profitable per trade. Scalping is a delicate art and requires finesse and can be very challenging when you are first starting out.
LESSON 7 - AUTOBOTS...ROLL OUT!
Yeah...I'm a geek and grew up with the Transformers franchise decades before Michael Bay came along. Deal with it.
Forex bots are called EA's (Expert Advisors). They can be wonderous and devastating at the same time. /Forex
is not really the best place to get help with them. That is what /algotrading
is useful for. However some of us that lurk on /Forex
code EA's and will try to assist when we can.
Anybody can learn to code an EA. But just like how 95% of retail traders fail, I would estimate the same is true for forex bots. Either the strategy doesn't work, the code is buggy, or many other reasons can cause EA's to fail. Because EA's can often times run up hundreds of orders in a very quick period of time, it's critical that you test them repeatedly before letting them lose on a live trading account so they don't blow your account to pieces
. You have been warned.
If you want to learn how to code an EA, I suggest you start with MQL. It's a programming language which can be directly interpretted by Meta Trader. The Meta Trader terminal client even gives you a built in IDE for coding EA's in MQL. The downside is it can be buggy and glitchy and caused many frustrating hours of work to figure out what is wrong.
If you don't want to learn MQL, you can code an EA up in just about any programming language. Python is really popular for forex bots for some reason. But that doesn't mean you couldn't do it in something like C++ or Java or hell even something more unusual like JQuery if you really wanted.
I'm not going to get into the finer details of how to code EA's, there are some amazing guides out there. Just be careful with them. They can be your best friend and at the same time also your worst enemy when it comes to forex.
One final note on EA's - don't buy them. Ever.
Let me put this into perspective - I create an EA which is literally producing money for me automatically 24/5. If it really is a good EA which is profitable, there is no way in hell I'm selling it. I'm keeping it to myself to make a fortune off of. EA's that are for sale will not work, will blow your account, and the developer who coded it will tell you that's too darn bad but no refunds. Don't ever buy an EA from anybody.
LESSON 8 - BRING ON THE HATERS
You are going to find that this subreddit is frequented by trolls. Some of them will get really nasty. Some of them will threaten you. Some of them will just make you miserable. It's the price you pay for admission to the /Forex
If you can't handle it, then I suggest you don't post here. Find a more newbie-friendly site. It sucks, but it's reality.
We often refer to trolls on this subreddit as shitcunts. That's your word of the day. Learn it, love it. Shitcunts.
YOU MADE IT, WELCOME TO FOREX!
If you've made it through all of the above and aren't cringing or getting scared, then welcome aboard the forex train! You will fit in nicely here. Ask your questions and the non-shitcunts of our little corner of reddit will try to help you.
Assuming this post doesn't get nuked and I don't get banned for it, I'll add more lessons to this post over time. Lessons I intend to add in the future:
- Demo Trading
- Why you will blow your first account and what to do when it happens
- Trading Psychology (this will be a beefy one and will take a while to put together)
- Exotics vs Majors and which you should focus on as a newbie (aka how to blow your account in a single trade with exotics)
- Which Broker Should You Use? (This is covered in pretty good detail on the FAQ already - https://www.reddit.com/Forex/wiki/index - so I may not bother)
- Hedging (there isn't really a good guide written on this anywhere)
- Doubling Your Risk to Save Your Ass or Lose a Shit Ton (aka Martingale & Anti-Martingale)
- Risk On/Off
- Forex Calendars
- Currency Strength / Heat Maps
- Margin Calls (What are they and why are you getting them?)
If there is something else you feel should be included please drop a comment and I'll add it to the above list of pending topics.
Backtesting.py. Backtest trading strategies with Python. Project website. Documentation. Installation $ pip install backtesting Usage from backtesting import Backtest, Strategy from backtesting.lib import crossover from backtesting.test import SMA, GOOG class SmaCross (Strategy): def init (self): price = self. data. Close self. ma1 = self. I ... Backtesting is a fundamental step in testing the viability of your trading ideas and strategies. Here is a simple backtesting implementation in Python. Luke Posey. Jun 16, 2019 · 4 min read. This article showcases a simple implementation for backtesting your first trading strategy in Python. Backtesting is a vital step when building out trading strategies. The core idea here is to develop a ... Backtesting.py is a Python framework for inferring viability of trading strategies on historical (past) data. Of course, past performance is not indicative of future results, but a strategy that proves itself resilient in a multitude of market conditions can, with a little luck, remain just as reliable in the future. I trade Forex and Futures since 2013 and later I added Crypto as well. Coding is not my main focus but I like to see backtesting results of my strategies before I add them to my portfolio. That is why I started to learn Python as a tool to help me with this. I spent countless hours developing my skills on trading and now I want to help another traders to use some of my knowledge. I am sure ... bt - Backtesting for Python. bt “aims to foster the creation of easily testable, re-usable and flexible blocks of strategy logic to facilitate the rapid development of complex trading strategies”. The framework is particularly suited to testing portfolio-based STS, with algos for asset weighting and portfolio rebalancing. Modifying a strategy to run over different time frequencies or ... This room is for Python Forex traders. I use Python and Talib for trading and Pandas for Backtesting. talib pandas oandapy Want to share technical skill and improve my knowloedge. I can share code too if you want. My goal is to create easy EA in python. Post # 2; Quote; Dec 14, 2014 6:53am Dec 14, 2014 6:53am tickoedo Joined Nov 2014 Status: Member 19 Posts. learning python very hard at ... Being a blog about Python for finance, and having an admitted leaning towards scripting, backtesting and optimising systematic strategies I thought I would look at all three at the same time…along with the concept of “multithreading” to help speed things up. So the script we are going to create (2 scripts in fact – one operating in a multi-threaded capacity and the other single ...
In this tutorial, we're going to begin talking about strategy back-testing. The field of back testing, and the requirements to do it right are pretty massive. B... WhatsApp @ +91-7795780804 for Programmatic Trading and Customized Trading Solutions Follow the URL link for Code Input: https://www.profitaddaweb.com/2018/10... Get almost perfect MT4 Expert Advisor back testing results. Use great Forex trading testing software - Duration: 4:23 ... Algorithmic Trading with Python and Quantopian p. 1 - Duration: 15:45 ... Backtesting Strategy- Python Algo Trading Course AlgoJi. Loading... Unsubscribe from AlgoJi? ... Professional Forex Trading Course Lesson 1 By Adam Khoo - Duration: 58:55. Adam Khoo 3,292,049 ... How to use Think Or Swim (TOS) for back testing trade ideas. This feature is PRICELESS... You can look for entry and exit points then apply your trade plan a... Strategy Backtesting with Python. [week] ReinForest[ReignForest] ... How I Backtest a Forex Trading Strategy in 2018 - Duration: 17:26. Michael Bamber 42,551 views. 17:26. 20 Habits of Highly ... How to Build a Winning Machine Learning FOREX Strategy in Python: Getting & Plotting Historical Data - Duration: 18:40. PythonParseltongue 23,293 views In this video, we set up the back-testing for our pattern recognition and predictions. Welcome to the Machine Learning for Forex and Stock analysis and algorithmic trading tutorial series. Python Back Testing Live! Richard Moglen. Loading... Unsubscribe from Richard Moglen? ... 95% Winning Forex Trading Formula - Beat The Market Maker📈 - Duration: 37:53. TRADE ATS 656,060 views ... Example of strategy backtesting using IPython. The notebook can be found here: http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/11352905/notebook...