Floor Fibs Indicator - Fibonacci

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

Floor Fibs Indicator - Fibonacci

Berichtdoor JPR » do 30 okt 2003, 20:10

Automatic Fibonacci Levels





Inputs: FibColor( Yellow ), FibStyle( Tool_Dotted );

Variables: Count( 0 ), Top( 0 ), TopBar( 0 ), Bottom( 0 ), BottomBar( 0 ), RefBar( 0 );

Arrays: FibLevel[ 2, 33 ]( 0 ),
LineIDs[ 33 ]( 0 ),
TextIDs[ 33 ]( 0 );

If Date = CurrentDate Then
Begin
Bottom = ( HighD( 1 ) + LowD( 1 ) + CloseD( 1 ) ) / 3;
Top = 2 * Bottom - LowD( 1 );
TopBar = 1;
BottomBar = 1;
RefBar = 1;
End;

If Top <> Top[1] OR Bottom <> Bottom[1] Then
Begin
Condition1 = FibLevels( Top, Bottom, FibLevel );
If LineIDs[1] <> 0 Then
Begin
For Count = 0 to 33
Begin
Value1 = TL_Delete( LineIDs[ Count ] );
Value1 = Text_Delete( TextIDs[ Count ] );
LineIDs[ Count ] = 0;
TextIDs[ Count ] = 0;
End;
End
Else
Begin
For Count = 0 to 33
Begin
LineIDs[ Count ] = TL_New( Date[ RefBar ], Time[ RefBar ], FibLevel[ 2, Count ], Date, Time, FibLevel[ 2, Count ] );
TL_SetExtLeft( LineIDs[ Count ], false );
TL_SetExtRight( LineIDs[ Count ], true );
? ?TL_SetColor( LineIDs[ Count ], FibColor );
TL_SetStyle( LineIDs[ Count ], FibStyle );

TextIDs[ Count ] = Text_New( Date, Time, FibLevel[ 2, Count ], NumToStr( FibLevel[ 1, Count ] * 100, 1 ) + "%" );
Text_SetStyle( TextIDs[ Count ], 1, 0 );
Text_SetColor( TextIDs[ Count ], FibColor );
End;
End;
Plot1[TopBar]( Top, "Top" );
Plot2[BottomBar]( Bottom, "Bottom" );
End
Else
Begin
NoPlot( 1 );
NoPlot( 2 );
End;




(Edited by JPR at 9:01 pm op 30,okt. 2003)
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 20:12

First period Fibs indicator

Inputs: FibColor( Yellow ), FibStyle( Tool_Dotted );

Variables: Count( 0 ), Top( 0 ), TopBar( 0 ), Bottom( 0 ), BottomBar( 0 ), RefBar( 0 );

Arrays: FibLevel[ 2, 33 ]( 0 ),
LineIDs[ 33 ]( 0 ),
TextIDs[ 33 ]( 0 );

If Date = CurrentDate Then
Begin
Bottom = ( HighD( 1 ) + LowD( 1 ) + CloseD( 1 ) ) / 3;
Top = 2 * Bottom - LowD( 1 );
TopBar = 1;
BottomBar = 1;
RefBar = 1;
End;

If Top <> Top[1] OR Bottom <> Bottom[1] Then
Begin
Condition1 = FibLevels( Top, Bottom, FibLevel );
If LineIDs[1] <> 0 Then
Begin
For Count = 0 to 33
Begin
Value1 = TL_Delete( LineIDs[ Count ] );
Value1 = Text_Delete( TextIDs[ Count ] );
LineIDs[ Count ] = 0;
TextIDs[ Count ] = 0;
End;
End
Else
Begin
For Count = 0 to 33
Begin
LineIDs[ Count ] = TL_New( Date[ RefBar ], Time[ RefBar ], FibLevel[ 2, Count ], Date, Time, FibLevel[ 2, Count ] );
TL_SetExtLeft( LineIDs[ Count ], false );
TL_SetExtRight( LineIDs[ Count ], true );
? ?TL_SetColor( LineIDs[ Count ], FibColor );
TL_SetStyle( LineIDs[ Count ], FibStyle );

TextIDs[ Count ] = Text_New( Date, Time, FibLevel[ 2, Count ], NumToStr( FibLevel[ 1, Count ] * 100, 1 ) + "%" );
Text_SetStyle( TextIDs[ Count ], 1, 0 );
Text_SetColor( TextIDs[ Count ], FibColor );
End;
End;
Plot1[TopBar]( Top, "Top" );
Plot2[BottomBar]( Bottom, "Bottom" );
End
Else
Begin
NoPlot( 1 );
NoPlot( 2 );
End;



(Edited by JPR at 8:14 pm op 30,okt. 2003)
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 20:17

Pivot Fibs Indicator

Inputs: PivotStrength( 2 ), Instance( 1 ), LookBack( 50 ), Offset( 0 ), FibColor( Yellow ), FibStyle( Tool_Dotted );

Variables: Count( 0 ), Top( 0 ), TopBar( 0 ), Bottom( 0 ), BottomBar( 0 ), RefBar( 0 );

Arrays: FibLevel[ 2, 33 ]( 0 ),
LineIDs[ 33 ]( 0 ),
TextIDs[ 33 ]( 0 );

If Date = CurrentDate Then
Begin
Top = SwingHigh( Instance, High, PivotStrength, LookBack )[ Offset ];
Bottom = SwingLow( Instance, Low, PivotStrength, LookBack )[ Offset ];
TopBar = SwingHighBar( Instance, High, PivotStrength, LookBack )[ Offset ] + Offset;
BottomBar = SwingLowBar( Instance, Low, PivotStrength, LookBack )[ Offset ] + Offset;
End;

RefBar = Maxlist( TopBar, BottomBar );
Condition1 = FibLevels( Top, Bottom, FibLevel );


If ( Top <> Top[1] OR Bottom <> Bottom[1] ) Then
Begin
If LineIDs[1] <> 0 Then
Begin
For Count = 0 to 33
Begin
Value1 = TL_Delete( LineIDs[ Count ] );
Value1 = Text_Delete( TextIDs[ Count ] );
LineIDs[ Count ] = 0;
TextIDs[ Count ] = 0;
End;
End
Else
Begin
For Count = 0 to 33
Begin
LineIDs[ Count ] = TL_New( Date[ RefBar ], Time[ RefBar ], FibLevel[ 2, Count ], Date, Time, FibLevel[ 2, Count ] );
TL_SetExtLeft( LineIDs[ Count ], false );
TL_SetExtRight( LineIDs[ Count ], true );
? ?TL_SetColor( LineIDs[ Count ], FibColor );
TL_SetStyle( LineIDs[ Count ], FibStyle );

TextIDs[ Count ] = Text_New( Date, Time, FibLevel[ 2, Count ], NumToStr( FibLevel[ 1, Count ] * 100, 1 ) + "%" );
Text_SetStyle( TextIDs[ Count ], 1, 0 );
Text_SetColor( TextIDs[ Count ], FibColor );
End;
End;
Plot1[TopBar]( Top, "Top" );
Plot2[BottomBar]( Bottom, "Bottom" );
End
Else
Begin
NoPlot( 1 );
NoPlot( 2 );
End;

For those who want to;

If you start with $Pivot Fibs Indicator code as a template, you can relatively easily modify the setting of Top, Bottom, TopBar and BottomBar variables to be anything you like (within reason). Once you modify those variables, the rest should take care of itself and you will have a new set of fib lines.

Also, If you wish to expand the list of available fib lines, you will need to add lines to the FibLevels function where those values are statically assigned, as well as adjusting the size of the arrays in all the indicators and the length of the for loops in all the code to adjust for the longer list of fib levels. Tedious but not difficult.
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 20:21

Fibs levels Fuction

Inputs:Top( numericsimple ),
Bottom( numericsimple ),
FibArray[ n, m ]( numericarrayref ); {FibArray must be 24 minimum}

Variables:Count( 0 ),
Ref( 0 );

If Top > Bottom Then
Ref = Bottom
Else
Ref = Top;

If FibArray[1, 1] = 0 Then
Begin
FibArray[ 1, 0 ] = 0;
FibArray[ 2, 0 ] = 0;
FibArray[ 1, 32 ] = -4.236;
FibArray[ 1, 33 ] = -3.618;
FibArray[ 1, 1 ] = -3.236;
FibArray[ 1, 2 ] = -2.618;
FibArray[ 1, 3 ] = -2.236;
FibArray[ 1, 4 ] = -1.618;
FibArray[ 1, 5 ] = -1;
FibArray[ 1, 6 ] = -.841;
FibArray[ 1, 7 ] = -.786;
FibArray[ 1, 8 ] = -.764;
FibArray[ 1, 9 ] = -.707;
FibArray[ 1, 10 ] = -.66666;
FibArray[ 1, 11 ] = -.618;
FibArray[ 1, 12 ] = -.5;
FibArray[ 1, 13 ] = -.382;
FibArray[ 1, 14 ] = -.236;
FibArray[ 1, 15 ] = .236;
FibArray[ 1, 16 ] = .382;
FibArray[ 1, 17 ] = .5;
FibArray[ 1, 18 ] = .618;
FibArray[ 1, 19 ] = .66666;
FibArray[ 1, 20 ] = .707;
FibArray[ 1, 21 ] = .764;
FibArray[ 1, 22 ] = .786;
FibArray[ 1, 23 ] = .841;
FibArray[ 1, 24 ] = 1;
FibArray[ 1, 25 ] = 1.236;
FibArray[ 1, 26 ] = 1.618;
FibArray[ 1, 27 ] = 2;
FibArray[ 1, 28 ] = 2.618;
FibArray[ 1, 29 ] = 3.236;
FibArray[ 1, 30 ] = 3.618;
FibArray[ 1, 31 ] = 4.236;
End;

For Count = 0 to 33
Begin
FibArray[ 2, Count ] ?= Rounded( FibArray[ 1, Count ] * AbsValue( Top - Bottom ) ) + Ref;
End;

If FibArray[ 2, 33 ] <> 0 Then
FibLevels = True
Else
FibLevels = False;





Rounded Function

Inputs: Amount( numericsimple );

Rounded = Round( Amount / tick, 0 ) * tick;


Tick Function

Tick = minmove / pricescale;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 20:26

Fibonacci strategie

Er is vast wel iemand die van al dit moois wat leuks kan maken ?:biggrin:





{ Fibonacci Long/Short Entry Strategy
Written by: TradeStation Securities, adapted by HamFon
Contact:ncrowle@sprintmail.com
Date:07/27/2002, original 07/27/2002
Revision:1.00
Status:Gnu Public License - this indicator may be used or shared freely with
no fee, as long as this original header comment is included.
Purpose:Generates a Buy or Sell Short order based on conditions of 2 EMA values
Source:TradeStationWorld.com
}

{ Generates a Buy signal when:
1) ?Current bar closes higher than previous bar's close (right direction of trend from prev)
2) ?Current bar closes higher than open (right direction of trend confirmation)
3) ?The FastAverage is rising
4) ?The FastAverage is crossing over the MedAverage
5) ?The MedAverage is rising
Reverse everything for Sell Short signal.
}

inputs: Price(Close), XAvgLen(15), HiLoLen(50),
Retrace(.382), SetUpLen(24);
vars: XAvg(0), HiHi(0), HiHiBar(0), LoLo(0),
LoLoBar(0), Retracement(0), BuySetup(0), SellSetup(0);

{Calculation of the necessary values, and assignment to variables}
XAvg = XAverage(Price, XAvgLen);
HiHi = Highest(High, HiLoLen);
LoLo = Lowest(Low, HiLoLen);
HiHiBar = HighestBar(High, HiLoLen);
LoLoBar = LowestBar(Low, HiLoLen);
Retracement = (HiHi - LoLo) * Retrace;

{Conditions for a Buy or Sell Setup}
if Close <= HiHi - Retracement AND HiHiBar < LoLoBar then
BuySetup = 0;
if Close >= LoLo + Retracement AND HiHiBar > LoLoBar then
SellSetup = 0;

{Accumulates to count the number of bars in the setups}
BuySetup = BuySetup + 1;
SellSetup = SellSetup + 1;

{Buy Criteria Evaluation}
if BuySetup <= SetUpLen then begin
if SwingLow(1, XAvg, 1, 2) <> -1 OR Close > XAvg then begin
Buy ("Fib LE") next bar at market;
BuySetup = SetUpLen;
end;
end;

{Sell Criteria Evaluation}
if SellSetup <= SetUpLen then begin
if SwingHigh(1, XAvg, 1, 2) <> -1 OR Close < XAvg then begin
Sell Short ("Fib SE") next bar at market;
SellSetup = SetUpLen;
end;
end;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor GMe » do 30 okt 2003, 21:30

Daar heb je vast ook de ELS file van, dan hoef ik niet te knippen en te plakken :)
GMe
 
Berichten: 145
Geregistreerd op: zo 07 okt 2001, 16:16

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 21:37

zie mailbox .......ELD
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

Floor Fibs Indicator

Berichtdoor GMe » do 30 okt 2003, 21:44

ELD wat is dat voor format?
GMe
 
Berichten: 145
Geregistreerd op: zo 07 okt 2001, 16:16

Floor Fibs Indicator

Berichtdoor JPR » do 30 okt 2003, 22:22

In Tradestation 7 els -------------> eld
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39


Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 23 gasten

cron