This is a trading item or a component that was created using QuantShare by one of our members.
This item can be downloaded and used by QuantShare Trading Software.
Trading items are of different types. There are data downloaders, trading indicators, trading systems, watchlists, composites/indices...
You can use this item and hundreds of others for free by downloading QuantShare.
Top Reasons Why You Should Use QuantShare:
Works with US and international markets (stock, forex, options, futures, ETF...)
Offers you the tools that will help you become a profitable trader
Allows you to implement any trading ideas
Exchange items and ideas with other QuantShare users
Our support team is very responsive and will answer any of your questions
We will implement any features you suggest
Very low price and much more features than the majority of other trading software
This function calculates the Fibonacci retracement 61.8% level, also referred to as 'the golden mean' or 'the golden ratio'. It uses simple vector-based functions to do this. The function accepts one parameter which is the lookback period to use to define the highest and lowest close prices.
Fibonacci retracement is a very popular tool used by many traders. It is based on the key numbers identified by mathematician Leonardo Fibonacci to calculate the Fibonacci ratios. These ratios levels are then used to identify critical points that could cause an asset's price to reverse.
As I said earlier, the calculation is rather simple. First of all we need to determine the difference between the highest and lowest close prices for the defined lookback period. We store this data into a variable whose name is (dif). The second step is to try to determine which of the highest or lowest close price occurred first; this is done using the (BarsSince) formula. Depending on the last result, we calculate the 61.8% level. In case the highest close price happened before the lowest close price, the variable 'dif' (calculated previously) is multiplied by 0.618. In the other case, the same variable 'dif' is multiplied by (1 - 0.618). We finally add the lowest close price value to the 61.8% level value and plot the resulting time-series.
We can create a bar chart that displays the difference between the current price and the 61.8% Fibonacci level by subtracting this level to the close price.
In order to create a time-series that plots other Fibonacci ratio levels like the 23.6% ratio or the 38.2% ratio, you just need to change the "level" variable. For the 23.6% level, just replace the value (0.618) by (0.236). You can also easily tweak the code and offer the possibility to define the Fibonacci ratio level by adding another parameter to this function.
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.