Click here to Login





                                                   Optimizable Fibonacci function

  0

0
SystemTrade
2012-07-02 10:06:11


I am working on a Fibonacci trading system which I plan to upload soon. Maybe you are interested in an optimizable function that I am going to include (see code below).

This function
a) provides exact Fibonacci retracement and extension levels
b) allows optimization regarding different Fibonacci levels, for instance:
Optimize("fibo_index", 0, 7, 1);
var = fibonacci(fibo_index);
will result in var = {0, 21.4, 23.6, 38.2, 50, 61.8, 76.4, 78.6}

Please note:
You can modify elements of the fibo array. As elements will be ordered, they might not be in the original sequence.
Elements of the fibo array are Zero-based.
fibonacci(-1) returns the number of elements in the fibo array.

Any suggestions? Just let me know.


// ----------------------------------- C# - fibonacci function ------------------------------------------
// Define a numeric parameter i for this function, which is the index, currently from 0 to 17, where 0 = 0%, 8 = 10 % and 17 = 423,6%
// Set function to return a numeric array
double phi = (1 + Math.Sqrt(5)) / 2; // http://en.wikipedia.org/wiki/Golden_ratio
double[] fibo = {
0, // 0 %
1 - 1 / Math.Sqrt(phi), // 21.4%
2 * phi - 3, // 23.6%
2 - phi, // 38.2%
0.5, // 50 %
phi - 1, // 61.8%
4 - 2 * phi, // 76.4%
1 / Math.Sqrt(phi), // 78.6%
1, // 100 %
2 * phi - 2, // 123.6%
Math.Sqrt(phi), // 127.2%
3 - phi, // 138.2%
1.5, // 150 %
phi, // 161.8%
5 - 2 * phi, // 176.4%
2, // 200 %
1 + phi, // 261.8%
2 * phi + 1, // 423.6%
};

Array.Sort(fibo);
i[0] = Math.Floor(i[0]);

if (i[0] == -1) result = fibo.Length;
if (i[0] >= 0) result = 100 * fibo[(int)i[0]];



Dan Perez
2012-07-03 03:52:54

  0

I also follow fibonacci trading level so I am willing to be a beta tester and can provide feedback on the tradning systems.


SystemTrade
2012-07-03 08:56:17

  0

Thanks Dan!

I am presently working on a Money Management Script that will be necessary for the fibonacci trading system and will allow stop and profit target setting at absolute price levels.
If for instance you want to enter a position at 76.4 and want to place your stop loss at 61.8 and set your profit target at 100, then you can of course define a profit stop as (100-76.4 = 23.6) and a stop loss as (76.4-61.8 = 14.6). But they will not be fix as per standard. If you enter at 75 (e.g. due to an opening gap), your stop loss will be at 60.4 and profit stop at 98.6. The dilemma being, that on the signal date you don't know the final entry price, and on the entry date you don't know your original price limit.
But ... there will be a solution posted soon.

If you are interested you may have a look at the generic trading system template http://www.quantshare.com/item-1115-generic-trading-system-template which will form the basis of the fibonacci trading system.

Also the swing point function http://www.quantshare.com/item-1121-swing-point-function-sp will play a big role in identifying the fibonacci turning points. I consider this one as the core of the system. So if you want, have a look at this code meanwhile and let me know about any questions or suggestions.



QuantShare
2012-07-06 17:11:15

  0

Few months ago, I have create a basic Fibonacci retracement indicator which tells you whether a stock is near a retracement level or not.
The levels are calculated based on the previous N-bar high and low.
Fibonacci Trading with the Retracement Levels/Ratios

Using the money management script is the only way to get the exact stop and profit levels.





Fibonacci Trading with the Retracement Levels/Ratios (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

SystemTrade
2012-07-10 13:13:33

  0

I think the main difference between http://www.quantshare.com/item-597-fibonacci-trading-with-the-retracement-levels-ratios and http://www.quantshare.com/item-1121-swing-point-function-sp is that the first one has a fixed period length whereas the latter has a minimum (dynamic) period length to identify highs/lows.

Today I have uploaded an MM script "Stop Mgmt" that includes the ability to use exact stop levels. Please try it and let me know about any questions, issues, suggestions ...



QuantShare
2012-07-10 14:39:02

  0

Here is the link: Stop Mgmt v 1.1




Stop Mgmt v 1.1 (by SystemTrade, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

SystemTrade
2012-07-13 12:54:33

  0

I have uploaded the Fibonacci Trading System today.
Enjoy and let me know about any questions, remarks, suggestions ...
I would also appreciate if you would report about the results of your optimizations (performance, markets, optimized parameters, ...)

Optimizable Fibonacci Long and Short Trading System





Optimizable Fibonacci Long and Short Trading System (by SystemTrade, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

MikeMM
2012-07-23 12:41:26

  0

Great trading system. I am sure its performance can be highly improved by tweaking and adding additional buy, sell or short rules.

I will start working on it in few weeks. Thanks again.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Optimizable Fibonacci Long and Short Trading System
Fibonacci Function
Fibonacci retracement: Golden ratio
Choose function
Fibonacci Trading with the Retracement Levels/Ratios

How-to Lessons
How to automatically draw Fibonacci Retracement for each new stoc...
How to use the Fibonacci retracement drawing tool
How to plot two different time frames in the same chart
How to set order type of a trading system programmatically
How to display the bar index of a stock on a chart

Related Forum Threads
Percent Rank Function Needed
Interpretation of " DRAWDOWNEQ" function
TimeframeApply function
newbie looking for function help
sp() function

Blog Posts
The 'inside period' function
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
Backtesting Your Trading Systems: Symbol Segmentation









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



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.