I built a forex trading strategy recently for a friend, and wanted to share it / get some feedback on it, as most of the systems I build trade stocks and are more fundamental/macro based!
The system was inspired by this forexfactory post: https://www.forexfactory.com/showthread.php?t=343533
but I've made a few changes. The Filter:
I didn't like the proposed TMA slope indicator as the calculation and cutoff values seemed too arbitrary to me, so I take the 5 bar ROC of an EMA and smooth it. I divide this value by its standard deviation to scale it for higher timeframe analysis. I take the value of this adjustedSlope at the 4H, 1D, 1W timeframes, and sumproduct them with weights of 40%, 30%, 30% to give a little more strength to recent movements. I call this the overallSlope (for future reference).
I describe the the market regime under these rules:
(overallSlope > overallSlope and overallSlope > 0) = bullish
(overallSlope < overallSlope and overallSlope < 0) = bearish
(overallSlope > overallSlope and overallSlope < 0) = neutral
(overallSlope < overallSlope and overallSlope > 0) = neutral
Just like the system from ForexFactory, only long trades can be taken if its bullish, only short trades can be taken if its bearish, and either trade can be taken if its neutral. The Setup:
I believe this portion is identical to the original stated system. Take the 50 bar Triangular Moving Average on the 4H timeframe, where the UpperBand is TMA + (2.5 * H4ATR) and the LowerBand is TMA - (2.5 * H4ATR).
If the market regime is bullish/neutral and the price has traded below the Lower Band then we're setting up for a buy and vice versa with a bearish/neutral market regime and price trading above the Upper Band.
I'm considering switching this to Median Absolute Deviation Bands as I like using the modified Z Score but I'm unsure of applying it directly to a price series instead of indirectly through an indicator or factor, I assume the median isn't very effective due to the actual series drifting, where as its (more) static when applied to Earnings Yield or something. The Trigger:
For the trigger I'm on the 1H TimeFrame using the MACD histogram crossing 0, but the MACD is based on the Jurik Moving Average instead of the standard. A couple years ago when I first started getting into programming and playing forex, the JMA was something I stumbled on and wrote up and I really like it, it's very effective and smoothing a series, allowing the use of shorter lookback values without the MA being too "jittery". Exits:
On the losing side, at open a stop loss is placed at (2 * H4ATR) below(above) the low(high) if we're going Long(Short). I'm currently split between two exits on the profit side. Right now my current exit criteria for a hypothetical long position is a bearish MACD Histogram crossover while we are above the TMA (the "midline"). The other strategy I'm considering is half off at the midline and the other half off at the Upper Band, but I think this isn't great because it can reverse and hit the stop effectively nulling the trade. Risk Management:
For the risk management of the system I'm using position sizes standardized to risk 3% of the account on each trade by calculating how far away the stop is, and scaling the # of units until $risk = AccVal * .03. Additional Comments:
As of right now I only have it fully coded on TradingView and I've made sure to use open prices for everything to avoid? (not sure if this completely handles this issue, please let me know) lookahead bias and I'm in the process of translating my code into my backtesting system but a lot of what I've built is equity related so I have some work to do to get it running right for forex. In TradingView I have it plot the Entry, Stop, and two targets, and the background shifts based on if it's long/short/flat. https://imgur.com/a/A1UQi04
I look forward to any thoughts or comments y'all may have, thanks for reading!
Originally posted by Darkstar at Forex Factory.
Disclaimer: I did not write this. I found this post on ForexFactory written by a user called DarkStar, which I believe a lot of redditors will benefit from reading.
There has been much discussion of late regarding borker spreads and liquidity. Many assumptions are being made about why spreads are widened during news time that are built on an incomplete knowledge of the architecture of the forex market in general. The purpose of this article is to dissect the market and hopefully shed some light on the situation so that a more rational and productive discussion can be undertaken by the Forex Factory members.
We will begin with an explanation of the purpose of the Forex market and how it is utilized by its primary participants, expand into the structure and operation of the market, and conclude with the implications of this information for speculators. With that having been said, let us begin.
Unlike the various bond and equity markets, the Forex market is not generally utilized as an investment medium. While speculation has a critical role in its proper function, the lion’s share of Forex transactions are done as a function of international business.
The guy who buys a shiny new Eclipse more then likely will pay for it with US Dollars. Unfortunately Mitsubishi’s factory workers in Japan need to get their paychecks denominated in Yen, so at some point a conversion needs to be made. When one considers that companies like Exxon, Boeing, Sony, Dell, Honda, and thousands of other international businesses move nearly every dollar, real, yen, rubble, pound, and euro they make in a foreign country through the Forex market, it isn’t hard to understand how insignificant the speculative presence is; even in a $2tril per day market.
By and large, businesses don’t much care about the intricacies of exchange rates, they just want to make and sell their products. As a central repository of a company’s money, it was only natural that the banks would be the facilitators of these transactions. In the old days it was easy enough for a bank to call a foreign bank (or a foreign branch of ones own bank) and swap the stockpiles of currency each had accumulated from their many customers.
Just as any business would, the banks bought the foreign currency at one rate and marked it up before selling it to the customer. With that the foreign exchange spread was born. This was (and still is) a reasonable cost of doing business. Mitsubishi can pay its customers and the banks make a nice little profit for the hassle and risks associated with moving around the currency.
As a byproduct of transacting all this business, bank traders developed the ability to speculate on the future of currency rates. Utilizing a better understanding of the market, a bank could quote a business a spread on the current rate but hold off hedging until a better one came along. This process allowed the banks to expand their net income dramatically. The unfortunate consequence was that liquidity was redistributed in a way that made certain transactions impossible to complete.
It was for this reason and this reason alone that the market was eventually opened up to non-bank participants. The banks wanted more orders in the market so that a) they could profit from the less experienced participants, and b) the less experienced participants could provide a better liquidity distribution for execution of international business hedge orders. Initially only megacap hedge funds (such as Soros’s and others) were permitted, but it has since grown to include the retail brokerages and ECNs.
Now that we have established why the market exists, let’s take a look at how the transactions are facilitated:
The top tier of the Forex market is transacted on what is collectively known as the Interbank. Contrary to popular belief the Interbank is not an exchange; it is a collection of communication agreements between the world’s largest money center banks.
To understand the structure of the Interbank market, it may be easier to grasp by way of analogy. Consider that in an office (or maybe even someone’s home) there are multiple computers connected via a network cable. Each computer operates independently of the others until it needs a resource that another computer possesses. At that point it will contact the other computer and request access to the necessary resource. If the computer is working properly and its owner has given the requestor authorization to do so, the resource can be accessed and the initiating computers request can be fulfilled. By substituting computers for banks and resources for currency, you can easily grasp the relationships that exist on the Interbank.
Anyone who has ever tried to find resources on a computer network without a server can appreciate how difficult it can be to keep track of who has what resources. The same issue exists on the Interbank market with regard to prices and currency inventory. A bank in Singapore may only rarely transact business with a company that needs to exchange some Brazilian Real and it can be very difficult to establish what a proper exchange rate should be. It is for this purpose that EBS and Reuters (hereafter EBS) established their services.
Layered on top (in a manner of speaking) of the Interbank communication links, the EBS service enables banks to see how much and at what prices all the Interbank members are willing to transact. Pains should be taken to express that EBS is not a market or a market maker; it is an application used to see bids and offers from the various banks.
The second tier of the market exists essential within each bank. By calling your local Bank of America branch you can exchange any foreign currency you would like. More then likely they will just move some excess currency from one branch to another. Since this is a micro-exchange with a single counterparty, you are basically at their mercy as to what exchange rate they will quote you. Your choice is to accept their offer or shop a different bank. Everyone who trades the forex market should visit their bank at least once to get a few quotes. It would be very enlightening to see how lucrative these transactions really are.
Branching off of this second tier is the third tier retail market. When brokers like Oanda, F
orex.com, FXCM, etc. desire to establish a retail operation the first thing they need is a liquidity provider. Nine in ten of these brokers will sign an agreement with just one bank. This bank will agree to provide liquidity if and only if they can hedge it on EBS inclusive of their desired spread. Because the volume will be significantly higher a single bank patron will transact, the spreads will be much more competitive. By no means should it be expected these tier 3 providers will be quoted precisely what exists on the Interbank. Remember the bank is in the business of collecting spreads and no agreement is going to suspend that priority.
Retail forex is almost akin to running a casino. The majority of its participants have zero understanding how to trade effectively and as a result are consistent losers. The spread system combined with a standard probability distribution of returns gives the broker a built in house advantage of a few percentage points. As a result, they have all built internal order matching systems that play one loser off against a winner and collect the spread. On the occasions when disequilibrium exists within the internal order book, the broker hedges any exposure with their tier 2 liquidity provider.
As bad as this may sound, there are some significant advantages for speculators that deal with them. Because it is an internal order book, many features can be provided which are otherwise unavailable through other means. Non-standard contract sizes, high leverage on tiny account balances, and the ability to transact in a commission free environment are just a few of them…
An ECN operates similar to a Tier 2 bank, but still exists on the third tier. An ECN will generally establish agreements with several tier 2 banks for liquidity. However instead of matching orders internally, it will just pass through the quotes from the banks, as is, to be traded on. It’s sort of an EBS for little guys. There are many advantages to the model, but it is still not the Interbank. The banks are going to make their spread or their not go to waste their time. Depending on the bank this will take the form of price shading or widened spreads depending on market conditions. The ECN, for its trouble, collects a commission on each transaction.
Aside from the commission factor, there are some other disadvantages a speculator should consider before making the leap to an ECN. Most offer much lower leverage and only allow full lot transactions. During certain market conditions, the banks may also pull their liquidity leaving traders without an opportunity to enter or exit positions at their desired price.
It is convenient to believe that in a $2tril per day market there is always enough liquidity to do what needs to be done. Unfortunately belief does not negate the reality that for every buyer there MUST be a seller or no transaction can occur. When an order is too large to transact at the current price, the price moves to the point where open interest is abundant enough to cover it. Every time you see price move a single pip, it means that an order was executed that consumed (or otherwise removed) the open interest at the current price. There is no other way that prices can move.
As we covered earlier, each bank lists on EBS how much and at what price they are willing to transact a currency. It is important to note that no Interbank participant is under any obligation to make a transaction if they do not feel it is in their best interest. There are no “market makers” on the Interbank; only speculators and hedgers.
Looking at an ECN platform or Level II data on the stock market, one can get a feel for what the orders on EBS look like. The following is a sample representation:
You’ll notice that there is open interest (Level II Vol figures) of various sizes at different price points. Each one of those units represents existing limit orders and in this example, each unit is $1mil in currency.
Using this information, if a market sell order was placed for 38.4mil, the spread would instantly widen from 2.5 pips to 4.5 pips because there would no longer be any orders between 1.56300 and 1.56345. No broker, market maker, bank, or thief in the night widened the spread; it was the natural byproduct of the order that was placed. If no additional orders entered the market, the spread would remain this large forever. Fortunately, someone somewhere will deem a price point between those 2 figures an appropriate opportunity to do something and place an order. That order will either consume more interest or add to it, depending whether it is a market or limit order respectively.
What would have happened if someone placed a market sell order for 2mil just 1 millisecond after that 38.4 mil order hit? They would have been filled at 1.5630 Why were they “slipped”? Because there was no one to take the other side of the transaction at 1.56320 any longer. Again, nobody was out screwing the trader; it was the natural byproduct of the order flow.
A more interesting question is, what would happen if all the listed orders where suddenly canceled? The spread would widen to a point at which there were existing bids and offers. That may be 5,7,9, or even 100 pips; it is going to widen to whatever the difference between a bid and an offer are. Notice that nobody came in and “set” the spread, they just refused to transact at anything between it.
Nothing can be done to force orders into existence that don’t exist. Regardless what market is being examined or what broker is facilitating transactions, it is impossible to avoid spreads and slippage. They are a fact of life in the realm of trading.
Implications for speculators:
Trading has been characterized as a zero sum game, and rightly so. If trader A sells a security to trader B and the price goes up, trader A lost money that they otherwise could have made. If it goes down, Trader A made money from trader B’s mistake. Even in a huge market like the Forex, each transaction must have a buyer and a seller to make a trade and one of them is going to lose. In the general realm of trading, this is materially irrelevant to each participant. But there are certain situations where it becomes of significant importance. One of those situations is a news event.
Much has been made of late about how it is immoral, illegal, or downright evil for a broker, bank, or other liquidity provider to withdraw their order (increasing the spread) and slip orders (as though it was a conscious decision on their part to do so) more then normal during these events. These things occur for very specific reasons which have nothing to do with screwing anyone. Let us examine why:
Leading up to an economic report for example, certain traders will enter into positions expecting the news to go a certain way. As the event becomes immanent, the banks on the Interbank will remove their speculative orders for fear of taking unnecessary losses. Technical traders will pull their orders as well since it is common practice for them to avoid the news. Hedge funds and other macro traders are either already positioned or waiting until after the news hits to make decisions dependent on the result.
Knowing what we now know, where is the liquidity necessary to maintain a tight spread coming from?
Moving down the food chain to Tier 2; a bank will only provide liquidity to an ECN or retail broker if they can instantly hedge (plus their requisite spread) the positions on Interbank. If the Interbank spreads are widening due to lower liquidity, the bank is going to have to widen the spreads on the downstream players as well.
At tier 3 the ECN’s are simply passing the banks offers on, so spreads widen up to their customers. The retailers that guarantee spreads of 2 to 5 pips have just opened a gaping hole in their risk profile since they can no longer hedge their net exposure (ever wonder why they always seem to shut down or requote until its over?). The variable spread retailers in turn open up their spreads to match what is happening at the bank or they run into the same problems fixed spreads broker are dealing with.
Now think about this situation for a second. What is going to happen when a number misses expectations? How many traders going into the event with positions chose wrong and need to get out ASAP? How many hedge funds are going to instantly drop their macro orders? How many retail traders’ straddle orders just executed? How many of them were waiting to hear a miss and executed market orders?
With the technical traders on the sidelines, who is going to be stupid enough to take the other side of all these orders?
The answer is no one. Between 1 and 5 seconds after the news hits it is a purely a 1 way market. That big long pin bar that occurs is a grand total of 2 prices; the one before the news hit and the one after. The 10, 20, or 30 pips between them is called a gap.
Is it any wonder that slippage is in evidence at this time?
Each tier of the Forex market has its own inherent advantages and disadvantages. Depending on your priorities you have to make a choice between what restrictions you can live with and those you cant. Unfortunately, you can’t always get what you want.
By focusing on slippage and spreads, which are the natural byproduct of order flow, one is not only pursuing a futile ideal, they are passing up an enormous opportunity to capitalize on true inefficiencies. News events are one of the few times where a large number of players are positioned inappropriately and it is fairly easy to profit from their foolishness. If a trader truly wants to make the leap to the next level of profitability they should be spending their time figuring out how identify these positions and trading with the goal of capturing the price movement they inevitably will cause.
Nobody is going to make the argument that a broker is a trader’s best friend, but they still provide a valuable service and should be compensated for their efforts. By accepting a broker for what it is and learning how to work within the limitations of the relationship, traders have access to a world of opportunity that they otherwise could never dream of capturing. Let us all remember that simple truth.
When I pass the lot size to the send pending function it does something "funky" to it so the order is not accepted. I have been working on isolating the problem and have found that if I input NormalizedDouble(.38,2) into the send pending function it converts it to 38 contracts on my demo account which is set a standard. Your risk will be the same in every trade, but the position size may be different because stop loss distances may vary. Remember that a 1,000-unit lot (micro) is worth $0.1 per pip movement, a 10,000-unit lot (mini) is worth $1, and a 100,000-unit lot (standard) is worth $10 per pip movement. This applies to all pairs where the USD is listed ... A standard lot is 100,000 units. Your risk is broken down into two parts—trade risk and account risk. Here's how all these elements fit together to give you the ideal position size, no matter what the market conditions are, what the trade setup is, or which strategy you're using. Set Your Account Risk Limit Per Trade . Photographer is my life. / Getty Images. This is the most important ... i want to find calculator that can calculate position size based on percentage of risk. it would be better if in excel .xls or free software. Something like i select the pair, % of risk,mini/micro/standard account type, leverage, and stop in pips, then it will calculate the lot size. Something like this:-i dl it from this forum also, Lot size doesn't really make sense in that situation because if company x is looking for one million units of gas, the trading company can sell it to them for a small markup without moving the market a single tick. They just call up the company and the company says "we've got a deal", boom! Trade done, now just get the product there and try and get better prices for acquiring the product. But ... The Position Size Calculator will calculate the required position size based on your currency pair, risk level (either in terms of percentage or money) and the stop loss in pips. Standard Lot: A standard lot is the equivalent to 100,000 units of the base currency in a forex trade. A standard lot is similar to trade size. It is one of the three commonly known lot sizes; the ...
Learn about my Trading Software that changed the game for me https://thealcovefx.com/ Join our Facebook Group: https://www.facebook.com/groups/18312320604660... Standard: $100,000 contract size 1.00 position size Learn more about forex trading: ... Forex for Beginners, What is Leverage, Lot, Currency Pair - Duration: 22:24. Janna FX 36,819 views. 22:24 ... Forex Trade With Us http://bit.ly/2EYIbgI Email: [email protected] Brokers I use https://bit.ly/35kgYkc P.S MY INSTAGRAM IS GONE NOW SO IF SOMEBODY W... This video will explain in detail THE SIMPLE WAY to convert Lot Sizes, how Risk vs. Reward works, and also how to count Pips. These are the fundamentals of t... CONTACT: EMAIL 👉[email protected] MENTORSHIP 👉 www.trendtrading.academy INSTAGRAM: JayTakeProfits 👉 https://www.instagram.com/jaytakeprofits/ (... Everything you need to know about lotsize, leverage and margin. If you want to learn more, download my free trading system plus much more, visit: https://www... Welcome to video #5 of Forex Trading for Beginners - what is a Forex lot size. This is a free (step by step) trading course that teaches you the essentials o...