#
submitted by LimarcAmbalina to datasets [link] [comments]
type symbolPush struct{ symbol string clients int feed string lastV float32 atIndex int }a SymbolPush instance stores an index atIndex which is the index of the shared dataset, it's symbol (which is like it's namespace/websocket channel) and the last closing price.
type seriesPoint struct { Symbol string `json:"symb"` LastValue float32 `json:"lastVal"` MinValue float32 `json:"min"` PointData OHLC `json:"data"` } func (s *symbolPush) GetPoint() seriesPoint { s.atIndex++ lastVV := s.lastV if(s.atIndex == (len(dataPoints) -1)){ s.atIndex = 0 } //index 3 is the close value s.lastV = dataPoints[s.atIndex][3] minVal := dataPoints[s.atIndex][2] return seriesPoint{ Symbol: s.symbol, LastValue: lastVV, MinValue: minVal, PointData: dataPoints[s.atIndex], } }Now right now it's obvious I am not returning anything that can be used from symbolsock since last night I deleted my old code since it wasn't working and just left it incomplete since I feel I would like to hear some input before I do a sloppy solution.
call the closure function with the JSONblob and return an object like seriesSockets := symbolsock.SymbolStream(theData)Step2:
Use this object to seriesSockets.joinStream("APPL") which will call newStream function in symbol sockets, either creating a new struct or incrementing the clients field.Also:
signal when a user has unsubscribed to a feed, which will delete the feed if clients == 0Also:
get a point from these structs to be broadcasted to subscribed clients like seriesSockets.getSeriesPoint("APPL")So my main question is how can I return an object like seriesSockets that accomplishes these things?
submitted by qrpike to algotrading [link] [comments]
Teknik
Arsitektur
MIPA
Psikologi
Hukum
CompSci, Teknik Informatika, or Sistem Informatika
![]() | Firstly, thanks for the overwhelming comments and feedback. Genuinely really appreciated. I am pleased 500+ of you find it useful. submitted by getmrmarket to Forex [link] [comments] If you didn't read the first post you can do so here: risk management part I. You'll need to do so in order to make sense of the topic. As ever please comment/reply below with questions or feedback and I'll do my best to get back to you. Part II
Letting stops breatheWe talked earlier about giving a position enough room to breathe so it is not stopped out in day-to-day noise.Let’s consider the chart below and imagine you had a trailing stop. It would be super painful to miss out on the wider move just because you left a stop that was too tight. Imagine being long and stopped out on a meaningless retracement ... ouch! One simple technique is simply to look at your chosen chart - let’s say daily bars. And then look at previous trends and use the measuring tool. Those generally look something like this and then you just click and drag to measure. For example if we wanted to bet on a downtrend on the chart above we might look at the biggest retracement on the previous uptrend. That max drawdown was about 100 pips or just under 1%. So you’d want your stop to be able to withstand at least that. If market conditions have changed - for example if CVIX has risen - and daily ranges are now higher you should incorporate that. If you know a big event is coming up you might think about that, too. The human brain is a remarkable tool and the power of the eye-ball method is not to be dismissed. This is how most discretionary traders do it. There are also more analytical approaches. Some look at the Average True Range (ATR). This attempts to capture the volatility of a pair, typically averaged over a number of sessions. It looks at three separate measures and takes the largest reading. Think of this as a moving average of how much a pair moves. For example, below shows the daily move in EURUSD was around 60 pips before spiking to 140 pips in March. Conditions were clearly far more volatile in March. Accordingly, you would need to leave your stop further away in March and take a correspondingly smaller position size. ATR is available on pretty much all charting systems Professional traders tend to use standard deviation as a measure of volatility instead of ATR. There are advantages and disadvantages to both. Averages are useful but can be misleading when regimes switch (see above chart). Once you have chosen a measure of volatility, stop distance can then be back-tested and optimised. For example does 2x ATR work best or 5x ATR for a given style and time horizon? Discretionary traders may still eye-ball the ATR or standard deviation to get a feeling for how it has changed over time and what ‘normal’ feels like for a chosen study period - daily, weekly, monthly etc. Reasons to change a stopAs a general rule you should be disciplined and not change your stops. Remember - losers average losers. This is really hard at first and we’re going to look at that in more detail later.There are some good reasons to modify stops but they are rare. One reason is if another risk management process demands you stop trading and close positions. We’ll look at this later. In that case just close out your positions at market and take the loss/gains as they are. Another is event risk. If you have some big upcoming data like Non Farm Payrolls that you know can move the market +/- 150 pips and you have no edge going into the release then many traders will take off or scale down their positions. They’ll go back into the positions when the data is out and the market has quietened down after fifteen minutes or so. This is a matter of some debate - many traders consider it a coin toss and argue you win some and lose some and it all averages out. Trailing stops can also be used to ‘lock in’ profits. We looked at those before. As the trade moves in your favour (say up if you are long) the stop loss ratchets with it. This means you may well end up ‘stopping out’ at a profit - as per the below example. The mighty trailing stop loss order It is perfectly reasonable to have your stop loss move in the direction of PNL. This is not exposing you to more risk than you originally were comfortable with. It is taking less and less risk as the trade moves in your favour. Trend-followers in particular love trailing stops. One final question traders ask is what they should do if they get stopped out but still like the trade. Should they try the same trade again a day later for the same reasons? Nope. Look for a different trade rather than getting emotionally wed to the original idea. Let’s say a particular stock looked cheap based on valuation metrics yesterday, you bought, it went down and you got stopped out. Well, it is going to look even better on those same metrics today. Maybe the market just doesn’t respect value at the moment and is driven by momentum. Wait it out. Otherwise, why even have a stop in the first place? Entering and exiting winning positionsTake profits are the opposite of stop losses. They are also resting orders, left with the broker, to automatically close your position if it reaches a certain price.Imagine I’m long EURUSD at 1.1250. If it hits a previous high of 1.1400 (150 pips higher) I will leave a sell order to take profit and close the position. The rookie mistake on take profits is to take profit too early. One should start from the assumption that you will win on no more than half of your trades. Therefore you will need to ensure that you win more on the ones that work than you lose on those that don’t. Sad to say but incredibly common: retail traders often take profits way too early This is going to be the exact opposite of what your emotions want you to do. We are going to look at that in the Psychology of Trading chapter. Remember: let winners run. Just like stops you need to know in advance the level where you will close out at a profit. Then let the trade happen. Don’t override yourself and let emotions force you to take a small profit. A classic mistake to avoid. The trader puts on a trade and it almost stops out before rebounding. As soon as it is slightly in the money they spook and cut out, instead of letting it run to their original take profit. Do not do this. Entering positions with limit ordersThat covers exiting a position but how about getting into one?Take profits can also be left speculatively to enter a position. Sometimes referred to as “bids” (buy orders) or “offers” (sell orders). Imagine the price is 1.1250 and the recent low is 1.1205. You might wish to leave a bid around 1.2010 to enter a long position, if the market reaches that price. This way you don’t need to sit at the computer and wait. Again, typically traders will use tech analysis to identify attractive levels. Again - other traders will cluster with your orders. Just like the stop loss we need to bake that in. So this time if we know everyone is going to buy around the recent low of 1.1205 we might leave the take profit bit a little bit above there at 1.1210 to ensure it gets done. Sure it costs 5 more pips but how mad would you be if the low was 1.1207 and then it rallied a hundred points and you didn’t have the trade on?! There are two more methods that traders often use for entering a position. Scaling in is one such technique. Let’s imagine that you think we are in a long-term bulltrend for AUDUSD but experiencing a brief retracement. You want to take a total position of 500,000 AUD and don’t have a strong view on the current price action. You might therefore leave a series of five bids of 100,000. As the price moves lower each one gets hit. The nice thing about scaling in is it reduces pressure on you to pick the perfect level. Of course the risk is that not all your orders get hit before the price moves higher and you have to trade at-market. Pyramiding is the second technique. Pyramiding is for take profits what a trailing stop loss is to regular stops. It is especially common for momentum traders. Pyramiding into a position means buying more as it goes in your favour Again let’s imagine we’re bullish AUDUSD and want to take a position of 500,000 AUD. Here we add 100,000 when our first signal is reached. Then we add subsequent clips of 100,000 when the trade moves in our favour. We are waiting for confirmation that the move is correct. Obviously this is quite nice as we humans love trading when it goes in our direction. However, the drawback is obvious: we haven’t had the full amount of risk on from the start of the trend. You can see the attractions and drawbacks of both approaches. It is best to experiment and choose techniques that work for your own personal psychology as these will be the easiest for you to stick with and build a disciplined process around. Risk:reward and win ratiosBe extremely skeptical of people who claim to win on 80% of trades. Most traders will win on roughly 50% of trades and lose on 50% of trades. This is why risk management is so important!Once you start keeping a trading journal you’ll be able to see how the win/loss ratio looks for you. Until then, assume you’re typical and that every other trade will lose money. If that is the case then you need to be sure you make more on the wins than you lose on the losses. You can see the effect of this below. A combination of win % and risk:reward ratio determine if you are profitable A typical rule of thumb is that a ratio of 1:3 works well for most traders. That is, if you are prepared to risk 100 pips on your stop you should be setting a take profit at a level that would return you 300 pips. One needn’t be religious about these numbers - 11 pips and 28 pips would be perfectly fine - but they are a guideline. Again - you should still use technical analysis to find meaningful chart levels for both the stop and take profit. Don’t just blindly take your stop distance and do 3x the pips on the other side as your take profit. Use the ratio to set approximate targets and then look for a relevant resistance or support level in that kind of region. Risk-adjusted returnsNot all returns are equal. Suppose you are examining the track record of two traders. Now, both have produced a return of 14% over the year. Not bad!The first trader, however, made hundreds of small bets throughout the year and his cumulative PNL looked like the left image below. The second trader made just one bet — he sold CADJPY at the start of the year — and his PNL looked like the right image below with lots of large drawdowns and volatility. Would you rather have the first trading record or the second? If you were investing money and betting on who would do well next year which would you choose? Of course all sensible people would choose the first trader. Yet if you look only at returns one cannot distinguish between the two. Both are up 14% at that point in time. This is where the Sharpe ratio helps . A high Sharpe ratio indicates that a portfolio has better risk-adjusted performance. One cannot sensibly compare returns without considering the risk taken to earn that return. If I can earn 80% of the return of another investor at only 50% of the risk then a rational investor should simply leverage me at 2x and enjoy 160% of the return at the same level of risk. This is very important in the context of Execution Advisor algorithms (EAs) that are popular in the retail community. You must evaluate historic performance by its risk-adjusted return — not just the nominal return. Incidentally look at the Sharpe ratio of ones that have been live for a year or more ... Otherwise an EA developer could produce two EAs: the first simply buys at 1000:1 leverage on January 1st ; and the second sells in the same manner. At the end of the year, one of them will be discarded and the other will look incredible. Its risk-adjusted return, however, would be abysmal and the odds of repeated success are similarly poor. Sharpe ratioThe Sharpe ratio works like this:
You don’t really need to know how to calculate Sharpe ratios. Good trading software will do this for you. It will either be available in the system by default or you can add a plug-in. VARVAR is another useful measure to help with drawdowns. It stands for Value at Risk. Normally people will use 99% VAR (conservative) or 95% VAR (aggressive). Let’s say you’re long EURUSD and using 95% VAR. The system will look at the historic movement of EURUSD. It might spit out a number of -1.2%. A 5% VAR of -1.2% tells you you should expect to lose 1.2% on 5% of days, whilst 95% of days should be better than that This means it is expected that on 5 days out of 100 (hence the 95%) the portfolio will lose 1.2% or more. This can help you manage your capital by taking appropriately sized positions. Typically you would look at VAR across your portfolio of trades rather than trade by trade. Sharpe ratios and VAR don’t give you the whole picture, though. Legendary fund manager, Howard Marks of Oaktree, notes that, while tools like VAR and Sharpe ratios are helpful and absolutely necessary, the best investors will also overlay their own judgment. Investors can calculate risk metrics like VaR and Sharpe ratios (we use them at Oaktree; they’re the best tools we have), but they shouldn’t put too much faith in them. The bottom line for me is that risk management should be the responsibility of every participant in the investment process, applying experience, judgment and knowledge of the underlying investments.Howard Marks of Oaktree Capital What he’s saying is don’t misplace your common sense. Do use these tools as they are helpful. However, you cannot fully rely on them. Both assume a normal distribution of returns. Whereas in real life you get “black swans” - events that should supposedly happen only once every thousand years but which actually seem to happen fairly often. These outlier events are often referred to as “tail risk”. Don’t make the mistake of saying “well, the model said…” - overlay what the model is telling you with your own common sense and good judgment. Coming up in part IIIAvailable hereSqueezes and other risks Market positioning Bet correlation Crap trades, timeouts and monthly limits *** Disclaimer:This content is not investment advice and you should not place any reliance on it. The views expressed are the author's own and should not be attributed to any other person, including their employer. |
![]() | Thanks for all the upvotes and comments on the previous pieces: submitted by getmrmarket to Forex [link] [comments] From the first half of the news trading note we learned some ways to estimate what is priced in by the market. We learned that we are trading any gap in market expectations rather than the result itself. A good result when the market expected a fantastic result is disappointing! We also looked at second order thinking. After all that, I hope the reaction of prices to events is starting to make more sense to you. Before you understand the core concepts of pricing in and second order thinking, price reactions to events can seem mystifying at times We'll add one thought-provoking quote. Keynes (that rare economist who also managed institutional money) offered this analogy. He compared selecting investments to a beauty contest in which newspaper readers would write in with their votes and win a prize if their votes most closely matched the six most popularly selected women across all readers: It is not a case of choosing those (faces) which, to the best of one’s judgment, are really the prettiest, nor even those which average opinions genuinely thinks the prettiest. We have reached the third degree where we devote our intelligences to anticipating what average opinion expects the average opinion to be. Trading is no different. You are trying to anticipate how other traders will react to news and how that will move prices. Perhaps you disagree with their reaction. Still, if you can anticipate what it will be you would be sensible to act upon it. Don't forget: meanwhile they are also trying to anticipate what you and everyone else will do. Part II
Preparing for quantitative and qualitative releasesThe majority of releases are quantitative. All that means is there’s some number. Like unemployment figures or GDP.Historic results provide interesting context. We are looking below the Australian unemployment rate which is released monthly. If you plot it out a few years back you can spot a clear trend, which got massively reversed. Knowing this trend gives you additional information when the figure is released. In the same way prices can trend so do economic data. A great resource that's totally free to use This makes sense: if for example things are getting steadily better in the economy you’d expect to see unemployment steadily going down. Knowing the trend and how much noise there is in the data gives you an informational edge over lazy traders. For example, when we see the spike above 6% on the above you’d instantly know it was crazy and a huge trading opportunity since a) the fluctuations month on month are normally tiny and b) it is a huge reversal of the long-term trend. Would all the other AUDUSD traders know and react proportionately? If not and yet they still trade, their laziness may be an opportunity for more informed traders to make some money. Tradingeconomics.com offers really high quality analysis. You can see all the major indicators for each country. Clicking them brings up their history as well as an explanation of what they show. For example, here’s German Consumer Confidence. Helpful context There are also qualitative events. Normally these are speeches by Central Bankers. There are whole blogs dedicated to closely reading such texts and looking for subtle changes in direction or opinion on the economy. Stuff like how often does the phrase "in a good place" come up when the Chair of the Fed speaks. It is pretty dry stuff. Yet these are leading indicators of how each member may vote to set interest rates. Ed Yardeni is the go-to guy on central banks. Data surprise indexThe other thing you might look at is something investment banks produce for their customers. A data surprise index. I am not sure if these are available in retail land - there's no reason they shouldn't be but the economic calendars online are very basic.You’ll remember we talked about data not being good or bad of itself but good or bad relative to what was expected. These indices measure this difference. If results are consistently better than analysts expect then you’ll see a positive number. If they are consistently worse than analysts expect a negative number. You can see they tend to swing from positive to negative. Mean reversion at its best! Data surprise indices measure how much better or worse data came in vs forecast There are many theories for this but in general people consider that analysts herd around the consensus. They are scared to be outliers and look ‘wrong’ or ‘stupid’ so they instead place estimates close to the pack of their peers. When economic conditions change they may therefore be slow to update. When they are wrong consistently - say too bearish - they eventually flip the other way and become too bullish. These charts can be interesting to give you an idea of how the recent data releases have been versus market expectations. You may try to spot the turning points in macroeconomic data that drive long term currency prices and trends. Using recent events to predict future reactionsThe market reaction function is the most important thing on an economic calendar in many ways. It means: what will happen to the price if the data is better or worse than the market expects?That seems easy to answer but it is not. Consider the example of consumer confidence we had earlier.
One clue is to look at what happened to the price of risk assets at the last event. For example, let’s say we looked at unemployment and it came in a lot worse than forecast last month. What happened to the S&P back then? 2% drop last time on a 'worse than expected' number ... so it it is 'better than expected' best guess is we rally 2% higher So this tells us that - at least for our most recent event - the S&P moved 2% lower on a far worse than expected number. This gives us some guidance as to what it might do next time and the direction. Bad number = lower S&P. For a huge surprise 2% is the size of move we’d expect. Again - this is a real limitation of online calendars. They should show next to the historic results (expected/actual) the reaction of various instruments. Buy the rumour, sell the factA final example of an unpredictable reaction relates to the old rule of ‘Buy the rumour, sell the fact.’ This captures the tendency for markets to anticipate events and then reverse when they occur. Buy the rumour, sell the fact In short: people take profit and close their positions when what they expected to happen is confirmed. So we have to decide which driver is most important to the market at any point in time. You obviously cannot ask every participant. The best way to do it is to look at what happened recently. Look at the price action during recent releases and you will get a feel for how much the market moves and in which direction. Trimming or taking off positionsOne thing to note is that events sometimes give smart participants information about positioning. This is because many traders take off or reduce positions ahead of big news events for risk management purposes.Imagine we see GBPUSD rises in the hour before GDP release. That probably indicates the market is short and has taken off / flattened its positions. The price action before an event can tell you about speculative positioning If GDP is merely in line with expectations those same people are likely to add back their positions. They avoided a potential banana skin. This is why sometimes the market moves on an event that seemingly was bang on consensus. But you have learned something. The speculative market is short and may prove vulnerable to a squeeze. Two kinds of reversalsFairly often you’ll see the market move in one direction on a release then turn around and go the other way.These are known as reversals. Traders will often ‘fade’ a move, meaning bet against it and expect it to reverse. Logical reversalsSometimes this happens when the data looks good at first glance but the details don’t support it.For example, say the headline is very bullish on German manufacturing numbers but then a minute later it becomes clear the company who releases the data has changed methodology or believes the number is driven by a one-off event. Or maybe the headline number is positive but buried in the detail there is a very negative revision to previous numbers. Fading the initial spike is one way to trade news. Try looking at what the price action is one minute after the event and thirty minutes afterwards on historic releases. Crazy reversalsSome reversals don't make sense Sometimes a reversal happens for seemingly no fundamental reason. Say you get clearly positive news that is better than anyone expects. There are no caveats to the positive number. Yet the price briefly spikes up and then falls hard. What on earth? This is a pure supply and demand thing. Even on bullish news the market cannot sustain a rally. The market is telling you it wants to sell this asset. Try not to get in its way. Some key releasesAs we have already discussed, different releases are important at different times. However, we’ll look at some consistently important ones in this final section.Interest rates decisionsThese can sometimes be unscheduled. However, normally the decisions are announced monthly. The exact process varies for each central bank. Typically there’s a headline decision e.g. maintain 0.75% rate.You may also see “minutes” of the meeting in which the decision was reached and a vote tally e.g. 7 for maintain, 2 for lower rates. These are always top-tier data releases and have capacity to move the currency a lot. A hawkish central bank (higher rates) will tend to move a currency higher whilst a dovish central bank (lower rates) will tend to move a currency lower. A central banker speaking is always a big event Non farm payrollsThese are released once per month. This is another top-tier release that will move all USD pairs as well as equities.There are three numbers:
In general a positive response should move the USD higher but check recent price action. Other countries each have their own unemployment data releases but this is the single most important release. SurveysThere are various types of surveys: consumer confidence; house price expectations; purchasing managers index etc.Each one basically asks a group of people if they expect to make more purchases or activity in their area of expertise to rise. There are so many we won’t go into each one here. A really useful tool is the tradingeconomics.com economic indicators for each country. You can see all the major indicators and an explanation of each plus the historic results. GDPGross Domestic Product is another big release. It is a measure of how much a country’s economy is growing.In general the market focuses more on ‘advance’ GDP forecasts more than ‘final’ numbers, which are often released at the same time. This is because the final figures are accurate but by the time they come around the market has already seen all the inputs. The advance figure tends to be less accurate but incorporates new information that the market may not have known before the release. In general a strong GDP number is good for the domestic currency. InflationCountries tend to release measures of inflation (increase in prices) each month. These releases are important mainly because they may influence the future decisions of the central bank, when setting the interest rate.See the FX fundamentals section for more details. Industrial dataThings like factory orders or or inventory levels. These can provide a leading indicator of the strength of the economy.These numbers can be extremely volatile. This is because a one-off large order can drive the numbers well outside usual levels. Pay careful attention to previous releases so you have a sense of how noisy each release is and what kind of moves might be expected. CommentsOften there is really good stuff in the comments/replies. Check out 'squitstoomuch' for some excellent observations on why some news sources are noisy but early (think: Twitter, ZeroHedge). The Softbank story is a good recent example: was in ZeroHedge a day before the FT but the market moved on the FT. Also an interesting comment on mistakes, which definitely happen on breaking news, and can cause massive reversals. |
![]() | Welcome to the third and final part of this chapter. submitted by getmrmarket to Forex [link] [comments] Thank you all for the 100s of comments and upvotes - maybe this post will take us above 1,000 for this topic! Keep any feedback or questions coming in the replies below. Before you read this note, please start with Part I and then Part II so it hangs together and makes sense. Part III
Squeezes and other risksWe are going to cover three common risks that traders face: events; squeezes, asymmetric bets.EventsEconomic releases can cause large short-term volatility. The most famous is Non Farm Payrolls, which is the most widely watched measure of US employment levels and affects the price of many instruments.On an NFP announcement currencies like EURUSD might jump (or drop) 100 pips no problem.This is fine and there are trading strategies that one may employ around this but the key thing is to be aware of these releases.You can find economic calendars all over the internet - including on this site - and you need only check if there are any major releases each day or week. For example, if you are trading off some intraday chart and scalping a few pips here and there it would be highly sensible to go into a known data release flat as it is pure coin-toss and not the reason for your trading. It only takes five minutes each day to plan for the day ahead so do not get caught out by this. Many retail traders get stopped out on such events when price volatility is at its peak. SqueezesShort squeezes bring a lot of danger and perhaps some opportunity.The story of VW and Porsche is the best short squeeze ever. Throughout these articles we've used FX examples wherever possible but in this one instance the concept (which is also highly relevant in FX) is best illustrated with an historical lesson from a different asset class. A short squeeze is when a participant ends up in a short position they are forced to cover. Especially when the rest of the market knows that this participant can be bullied into stopping out at terrible levels, provided the market can briefly drive the price into their pain zone. There's a reason for the car, don't worry Hedge funds had been shorting VW stock. However the amount of VW stock available to buy in the open market was actually quite limited. The local government owned a chunk and Porsche itself had bought and locked away around 30%. Neither of these would sell to the hedge-funds so a good amount of the stock was un-buyable at any price. If you sell or short a stock you must be prepared to buy it back to go flat at some point. To cut a long story short, Porsche bought a lot of call options on VW stock. These options gave them the right to purchase VW stock from banks at slightly above market price. Eventually the banks who had sold these options realised there was no VW stock to go out and buy since the German government wouldn’t sell its allocation and Porsche wouldn’t either. If Porsche called in the options the banks were in trouble. Porsche called in the options which forced the shorts to buy stock - at whatever price they could get it. The price squeezed higher as those that were short got massively squeezed and stopped out. For one brief moment in 2008, VW was the world’s most valuable company. Shorts were burned hard. Incredible event Porsche apparently made $11.5 billion on the trade. The BBC described Porsche as “a hedge fund with a carmaker attached.” If this all seems exotic then know that the same thing happens in FX all the time. If everyone in the market is talking about a key level in EURUSD being 1.2050 then you can bet the market will try to push through 1.2050 just to take out any short stops at that level. Whether it then rallies higher or fails and trades back lower is a different matter entirely. This brings us on to the matter of crowded trades. We will look at positioning in more detail in the next section. Crowded trades are dangerous for PNL. If everyone believes EURUSD is going down and has already sold EURUSD then you run the risk of a short squeeze. For additional selling to take place you need a very good reason for people to add to their position whereas a move in the other direction could force mass buying to cover their shorts. A trading mentor when I worked at the investment bank once advised me: Always think about which move would cause the maximum people the maximum pain. That move is precisely what you should be watching out for at all times. Asymmetric lossesAlso known as picking up pennies in front of a steamroller. This risk has caught out many a retail trader. Sometimes it is referred to as a "negative skew" strategy.Ideally what you are looking for is asymmetric risk trade set-ups: that is where the downside is clearly defined and smaller than the upside. What you want to avoid is the opposite. A famous example of this going wrong was the Swiss National Bank de-peg in 2012. The Swiss National Bank had said they would defend the price of EURCHF so that it did not go below 1.2. Many people believed it could never go below 1.2 due to this. Many retail traders therefore opted for a strategy that some describe as ‘picking up pennies in front of a steam-roller’. They would would buy EURCHF above the peg level and hope for a tiny rally of several pips before selling them back and keep doing this repeatedly. Often they were highly leveraged at 100:1 so that they could amplify the profit of the tiny 5-10 pip rally. Then this happened. Something that changed FX markets forever The SNB suddenly did the unthinkable. They stopped defending the price. CHF jumped and so EURCHF (the number of CHF per 1 EUR) dropped to new lows very fast. Clearly, this trade had horrific risk : reward asymmetry: you risked 30% to make 0.05%. Other strategies like naively selling options have the same result. You win a small amount of money each day and then spectacularly blow up at some point down the line. Market positioningWe have talked about short squeezes. But how do you know what the market position is? And should you care?Let’s start with the first. You should definitely care. Let’s imagine the entire market is exceptionally long EURUSD and positioning reaches extreme levels. This makes EURUSD very vulnerable. To keep the price going higher EURUSD needs to attract fresh buy orders. If everyone is already long and has no room to add, what can incentivise people to keep buying? The news flow might be good. They may believe EURUSD goes higher. But they have already bought and have their maximum position on. On the flip side, if there’s an unexpected event and EURUSD gaps lower you will have the entire market trying to exit the position at the same time. Like a herd of cows running through a single doorway. Messy. We are going to look at this in more detail in a later chapter, where we discuss ‘carry’ trades. For now this TRYJPY chart might provide some idea of what a rush to the exits of a crowded position looks like. A carry trade position clear-out in action Knowing if the market is currently at extreme levels of long or short can therefore be helpful. The CFTC makes available a weekly report, which details the overall positions of speculative traders “Non Commercial Traders” in some of the major futures products. This includes futures tied to deliverable FX pairs such as EURUSD as well as products such as gold. The report is called “CFTC Commitments of Traders” ("COT"). This is a great benchmark. It is far more representative of the overall market than the proprietary ones offered by retail brokers as it covers a far larger cross-section of the institutional market. Generally market participants will not pay a lot of attention to commercial hedgers, which are also detailed in the report. This data is worth tracking but these folks are simply hedging real-world transactions rather than speculating so their activity is far less revealing and far more noisy. You can find the data online for free and download it directly here. Raw format is kinda hard to work with However, many websites will chart this for you free of charge and you may find it more convenient to look at it that way. Just google “CFTC positioning charts”. But you can easily get visualisations You can visually spot extreme positioning. It is extremely powerful. Bear in mind the reports come out Friday afternoon US time and the report is a snapshot up to the prior Tuesday. That means it is a lagged report - by the time it is released it is a few days out of date. For longer term trades where you hold positions for weeks this is of course still pretty helpful information. As well as the absolute level (is the speculative market net long or short) you can also use this to pick up on changes in positioning. For example if bad news comes out how much does the net short increase? If good news comes out, the market may remain net short but how much did they buy back? A lot of traders ask themselves “Does the market have this trade on?” The positioning data is a good method for answering this. It provides a good finger on the pulse of the wider market sentiment and activity. For example you might say: “There was lots of noise about the good employment numbers in the US. However, there wasn’t actually a lot of position change on the back of it. Maybe everyone who wants to buy already has. What would happen now if bad news came out?” In general traders will be wary of entering a crowded position because it will be hard to attract additional buyers or sellers and there could be an aggressive exit. If you want to enter a trade that is showing extreme levels of positioning you must think carefully about this dynamic. Bet correlationRetail traders often drastically underestimate how correlated their bets are.Through bitter experience, I have learned that a mistake in position correlation is the root of some of the most serious problems in trading. If you have eight highly correlated positions, then you are really trading one position that is eight times as large. Bruce Kovner of hedge fund, Caxton Associates For example, if you are trading a bunch of pairs against the USD you will end up with a simply huge USD exposure. A single USD-trigger can ruin all your bets. Your ideal scenario — and it isn’t always possible — would be to have a highly diversified portfolio of bets that do not move in tandem. Look at this chart. Inverted USD index (DXY) is green. AUDUSD is orange. EURUSD is blue. Chart from TradingView So the whole thing is just one big USD trade! If you are long AUDUSD, long EURUSD, and short DXY you have three anti USD bets that are all likely to work or fail together. The more diversified your portfolio of bets are, the more risk you can take on each. There’s a really good video, explaining the benefits of diversification from Ray Dalio. A systematic fund with access to an investable universe of 10,000 instruments has more opportunity to make a better risk-adjusted return than a trader who only focuses on three symbols. Diversification really is the closest thing to a free lunch in finance. But let’s be pragmatic and realistic. Human retail traders don’t have capacity to run even one hundred bets at a time. More realistic would be an average of 2-3 trades on simultaneously. So what can be done? For example:
The key thing is to start thinking about a portfolio of bets and what each new trade offers to your existing portfolio of risk. Will it diversify or amplify a current exposure? Crap trades, timeouts and monthly limitsOne common mistake is to get bored and restless and put on crap trades. This just means trades in which you have low conviction.It is perfectly fine not to trade. If you feel like you do not understand the market at a particular point, simply choose not to trade. Flat is a position. Do not waste your bullets on rubbish trades. Only enter a trade when you have carefully considered it from all angles and feel good about the risk. This will make it far easier to hold onto the trade if it moves against you at any point. You actually believe in it. Equally, you need to set monthly limits. A standard limit might be a 10% account balance stop per month. At that point you close all your positions immediately and stop trading till next month. Be strict with yourself and walk away Let’s assume you started the year with $100k and made 5% in January so enter Feb with $105k balance. Your stop is therefore 10% of $105k or $10.5k . If your account balance dips to $94.5k ($105k-$10.5k) then you stop yourself out and don’t resume trading till March the first. Having monthly calendar breaks is nice for another reason. Say you made a load of money in January. You don’t want to start February feeling you are up 5% or it is too tempting to avoid trading all month and protect the existing win. Each month and each year should feel like a clean slate and an independent period. Everyone has trading slumps. It is perfectly normal. It will definitely happen to you at some stage. The trick is to take a break and refocus. Conserve your capital by not trading a lot whilst you are on a losing streak. This period will be much harder for you emotionally and you’ll end up making suboptimal decisions. An enforced break will help you see the bigger picture. Put in place a process before you start trading and then it’ll be easy to follow and will feel much less emotional. Remember: the market doesn’t care if you win or lose, it is nothing personal. When your head has cooled and you feel calm you return the next month and begin the task of building back your account balance. That's a wrap on risk managementThanks for taking time to read this three-part chapter on risk management. I hope you enjoyed it. Do comment in the replies if you have any questions or feedback.Remember: the most important part of trading is not making money. It is not losing money. Always start with that principle. I hope these three notes have provided some food for thought on how you might approach risk management and are of practical use to you when trading. Avoiding mistakes is not a sexy tagline but it is an effective and reliable way to improve results. Next up I will be writing about an exciting topic I think many traders should look at rather differently: news trading. Please follow on here to receive notifications and the broad outline is below. News Trading Part I
Disclaimer:This content is not investment advice and you should not place any reliance on it. The views expressed are the author's own and should not be attributed to any other person, including their employer. |
Platform | Notes |
---|---|
ADM Investor Services | No API |
Ally Invest | Does not support futures instruments |
Alpaca | Only supports US Equities |
Alpha Vantage | Does not support futures instruments |
AMP | Broker with a huge number of platforms available including some with APIs |
ApexFutures | No API |
Arcade Trader | No API |
AvaTrade | Does not support futures instruments |
Backtrader | Not a data feed; otherwise looks cool but also looks like a one-man shop |
Cannon Trading | Broker with a variety of platforms, some have API access such as TT |
Centerpoint | No API |
Charles Schwab | API does not support futures instruments |
Cobra | No API |
Daniels Trading | No API |
Discount Trading | Broker with a variety of platforms including CQG, Rithmic, TT, some with APIs |
Edge Clear | Broker with a variety of platforms including CQG, Rithmic, TT, some with APIs |
Eroom | Now part of Dashprime. Offer a variety of APIs including CQG, TT, CBOE's Silexx, and others via FIX. |
ETNA Trader | Only supports equities, options (including multi-legs), ETFs, Mutual Funds (Forex with cryptocurrencies coming soon) |
ETrade | API seems robust but OAuth authorization needs to be refreshed via login once per 24 hours |
Futures Online | No API |
Gain Capital Futures | API available, based on .NET; unsure if they are open to retail clients |
GFF Brokers | Broker with a large number of platforms including some with API access |
High Ridge Futures | Broker with a variety of platforms including CQG, Rithmic, TT, some with APIs |
iBroker | API available; contact them for more info |
IEX Cloud | Looks great but does not support futures instruments |
Infinity Futures | JSON API available; contact them for more info |
Interactive Brokers | Client Web API looks promising if clunky |
Intrinio | Supports futures instruments but is expensive |
Koyfin | No API |
Lightspeed | C++ API available |
marketstack | API for equities available. Does not support futures instruments. |
Medved Trader | Windows app with a streaming API to various data sources and brokers. See comment below about API beta access. |
NinjaTrader | Does not support futures options |
Norgate Data | Not a broker; supports futures data for $270/year |
Oanda | Forex only; API last updated in 2018 |
Optimus Futures | Broker with a large number of available platforms including some with API access |
Phillip Capital | Broker with a large number of available platforms including some with API access |
polygon.io | Expensive but looks slick; does not support futures instruments |
Quandl | API looks solid; $49/monthly for personal use, does not allow distributing or sharing data; not a broker |
Quantconnect | Does not expose raw data |
Quantopian | Does not expose raw data |
Quantower | Software that connects to multiple brokers and data feeds; API to their software via C# interface |
Saxo Markets | Broker with extensively documented API |
Stage 5 Trading | API available through Trading Technologies |
Straits Financial | Broker with several platforms available including some with APIs such as CQG, R |
Sweet Futures | Broker with a large number of available platforms including some with API access |
TastyWorks | There's an unofficial Python API |
TenQuant.io | Does not support futures instruments |
ThinkorSwim | Does not support futures instruments via the API |
Tiingo | Free account tier but does not support futures instruments |
TradePro | Broker with a number of platforms available; unclear if any are available with API access |
Tradier | Free developer API account for delayed data but does not support futures instruments |
TradeStation | Nice looking API docs and supports futures instruments; requires opening an account and a minimum balance of $100k and there’s no trial available |
TradeFutures4Less | Broker with a variety of platforms including CQG, Rithmic, TT, some with APIs |
TradingTechnologies | API looks robust; pricing starts at $700/month |
TradingView | Does not expose data API |
Tradovate Technologies | API exists, documentation unknown; need to talk to their account team |
Wedbush Futures | Broker with several platforms offered, a few of which have API access |
WEX | .NET/COM only; pricing not disclosed on website |
Xignite | Pricing not disclosed on website but they do support futures instruments |
Yahoo Finance API | Available through RapidAPI or via direct access; but it’s discontinued and unreliable |
Zaner | Broker with a variety of platforms including CQG, Rithmic, TT, some with APIs |
![]() | TLDR: China is actively fighting domestic capital outflows. They are incentivising keeping funds on-shore by pumping the equity markets. Buy large China stocks (BABA, JD). submitted by 1poundbookingfee to wallstreetbets [link] [comments] Inb4 pos or ban The Economics China has a fixed exchange rate regime. Blah blah RMB internationalization, blah blah offshore RMB (which is actually settled in US dollars). This places it within line C of the policy trilemma (which says, you can't sustainably have all 3). Since 2005 to about 2017, the government was moving towards free capital mobility because of large amounts of exports which fed the national forex reserves. You bet billions of RMB left China, which the government didn't really like at first because that reduced domestic investment and would contribute to a weaker RMB. Basically, China was trying to do all 3 which works for a short while... until your forex reserves run out. https://preview.redd.it/g0nwsssoe7f51.png?width=580&format=png&auto=webp&s=0e46b6b2cfa12b351b30ff2c5567c2f9992e99b2 The Current Problem The trade war has definitely been bad for China. I am going to try and skip politics, but basically foreign exchange reserves have been gapping down (official Chinese data is 100% fake). China is increasingly bellicose as well, which doesn't improve relations with trading partners who also buy with US dollars. You can't exchange for US dollars anymore. For private citizens, you can only exchange for education purposes or travel . For companies, you need verification of invoices through both SAFE (State Administration of Foreign Exchange) and the tax offices. This used to take 24hrs, but is now taking 2-3 weeks for amounts >$500k. China also has US dollar denominated bank accounts. But unfortunately, you can't take it in cash unless you have the reasons above. Chinese media is also branding holding US dollars as unpatriotic, so I'm afraid my $50k in digital money might be subject to confiscation. If not, it's just fake money (can't take cash or wire out). China has been brrrrrring to the pace of JPOW. Weapon of choice are muni and local bonds, which have been forced upon local banks. This creates a certain credit problem, but let's not worry about that until later. https://preview.redd.it/maul8aope7f51.png?width=1200&format=png&auto=webp&s=36dd4665517ec7303b51aa1416517c9e0ea50bef The Solution China's pretty smart. All those RMB quotes are fake. You can try to get US dollars, but that is almost impossible now. Anyone who wants to buy RMB, contact me and we'll trade at the current price. So looking at the impossible triangle, free capital mobility has become nonexistent. In order to keep exchange rate stability (to avoid a sudden rush towards the door) and keep printing, free capital mobility needs to be 100% sacrificed. How do you do that with a population that has seen the west and aspire to get out? You need to keep the money onshore. Thankfully, all Chinese are greedy and the equity markets are full of retailers that pump stocks up or down 10% per day. This is one of the reasons for the early July State Council report calling for everyone to buy stocks. Who's buying? Everyone. And if it drops, the national team takes over. This creates a powerful incentive to fill the foreign reserves again. Foreigners (funds) would want to get in on the action. They will exchange their dollars for RMB, get those 20% gains, but eventually find out trying to get that money back into USD is impossible. China has also been strengthening the RMB from 7.10 to 6.96 as of yesterday. Smart, because why would you want to sell an asset that's weakening? This is also a reason why China fears gold rallies - buying gold causes RMB to leave. Happily for the SAFE, some banks have stopped offering their paper gold products. China will pump its domestic markets. Unless you have a Chinese account, the closest thing you can get to are mega names like Alibaba, JD and Tencent. I would avoid touching too small companies because of LK coffee problems. Oh yeah the trade war? Well, pussies don't make money. |
1Forge is the only provider that delivers true FIX speed with the convenience of an API. Most forex data providers force you to compromise: you can either get really fast data through a FIX connection (aka a firehose) for thousands per month, or you can get slow data via a JSON API. NinjaTrader Live Data: Yes; Get Your Data: Get A Free Data Connection for Forex ; The forex data is also in real time and provides you to access for FX live real-time quotes for forex traders. This account data is delivered within 5 minutes of signing up and so far from what we have seen this will never expire. Download Forex . Free and safe download. Download the latest version of the top software, games, programs and apps in 2020. Download and copy the history forex files: Load the necessary data in Forex Strategy Builder (CSV) format. 100 000 bars is a good start. Copy and paste the downloaded forex data files in the new Data Source directory. Now the new data will be available in the Editor. If you’re looking for Free Forex Historical Data, you’re in the right place! Here, you’ll be able to find free forex historical data ready to be imported into your favorite application like MetaTrader, NinjaTrader, MetaStock or any other trading platform.. Since the data is delivered in .CSV format (comma separated values), you can use it in any almost any application that allows you to ...
[index] [3589] [588] [4509] [1152] [4444] [4134] [2027] [2525] [1845] [1273]
What's up! I'm Hannah and I'm learning how to trade the forex markets. Join me as I document my forex trading journey through film, sharing the ups and the d... how to get free forex live data for ninja chart made by : www.capitalsolution.org Capital Management Solution Auto Buy -Sell Signal for Forex ,Equity,Commodities,Futures ,Auto Trade Software ,Auto ... Hi Friends, You can open account by given links belows and there are many benefits you will get. 1- Free Meta Trader 4 Data feed for Laptop/Desktop/Mobile ph... FOREX EASY Free EA click this link https://www.exness.com/a/s2jm8h9b or https://fbs.com/cabinet/registration/trader/?ppu=487894&lang=en And send your Real No... IMPORTANT: I have updated the video with an important new feature that you can find here: https://www.youtube.com/watch?v=CPlx8nmuXgE&t=169s How to Build A F...