Fibonacci Trading
Author: Bandit292
Creation Date: 8/13/2008 10:57 AM
profile picture

Bandit292

#1
Does anyone have some good sample code for automating a Fibonacci retracement trading scheme? Specifically, is there a good method for automatically grabbing the appropriate high and low values for a specified time period and then building Fibonacci retracement lines off these values?

Once established, a trading scheme can be built around the Fibonacci lines, but establishing appropriate high and low points to build these lines seems like the hard part. If you leave the establishment of the appropriate High & Low points to the user, the staregy would not lend itself to trading a data set but might be more user friendly for running a strategy against a single security. Perhaps the best option would be automating the establishment of appropriate high & low values but also allow user input to override and change these automatic values for a specific security.

I'm at a loss for how to start this process. Any sample code utilizing Fibonacci retacement lines would be a great help.

Thanks ...
profile picture

Eugene

#2
Fibonacci lines aren't a hot number on this board but if you're looking for any sample code, this one is still something (see message by Cone @ 4/27/2008 9:44 AM).
profile picture

Bandit292

#3
Thanks ... that will get me started and keep me busy for a while.
profile picture

Bandit292

#4
Eugene,

I'm new to C#, so the syntax used here is new to me:

CODE:
Please log in to see this code.


I see it in a code snip from one of my reference books, but can find no description for how/why it is used. I assume it is a way to change the double variable tBar[bar] to an integer. Are other variable type changes accomplished in a similar manner? I have seen the use of:
variable.ValueInt
... but when I attempt to replace the code snip above with:
tBar[bar],ValueInt
... I get an error.

Thanks ...
profile picture

Eugene

#5
QUOTE:
I assume it is a way to change the double variable tBar[bar] to an integer.


That's right. In this particular case, TroughBar.Series contain values of type double while the bar loop operates with integers. Therefore the need to convert, or cast, this double value into a value of type integer.

(Not sure why won't TroughBar give out an integer output though as it would eliminate this extra cast.)

Other type of variable type changes depend on their context.
profile picture

Bandit292

#6
OK -- I assume we can do other data type changes using similar notation which I will uncover as I progress in my reading.

Another quick question. I am modifying the code link you gave me to help with my programming, but am running into errors I can't track. How can I step through the code in the WealthLab Editor tab to help find my error -- or must I run the code with C# Express for error detection by stepping the code?
profile picture

Eugene

#7
Wealth-Lab Editor doesn't contain an integrated debugger. For something more sophisticated than printing to Debug window, you'll need to recline on full-featured debugger like the one in C# Express.

Required reading:
1. Ask Glitch: How can I debug my trading strategies in Wealth-Lab Pro 5?, and then this for C# Express:
2. Debugging a Strategy with Visual Studio Express or SharpDevelop
profile picture

Bandit292

#8
Wow -- what a mess! Maybe it just looks more difficult in print than it really is. No time to try it out now. I'll have to give it a go tomorrow.

Is an integrated debugger planned for future updates to WL5?
profile picture

Eugene

#9
QUOTE:
Wow -- what a mess! Maybe it just looks more difficult in print than it really is.

In your particular case, blame it on Microsoft who phased the attach-to-process capability and Guid creation out of Visual Studio Express version. That's why the need for a workaround in my article, for the regular VS it's not required. When you step through the process once or twice, it will not look that difficult.

QUOTE:
Is an integrated debugger planned for future updates to WL5?
No.
profile picture

EMan99

#10
Bandit any luck on this?
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).