Derek Worswick
Mitglied seit 10 Jahre 9 Monate

(e) TradeStation 2000i: Automatische Trendlinien

Mit TradeStation2000i habe ich die Verbreitung Verhältnis-Anzeige benutzt, um ein zusammengesetztes Diagramm

des Goldwanzen Index zu zeichnen ($HUI) geteilt durch den Preis des Goldes ($Gold).

Ist zu zeichnen möglich, mit automatischem Trendlines auf dem oben genannten zusammengesetzten Diagramm?

(d.h. auf der Verbreitung Verhältnis-Anzeige).

Das Hoffen Sie kann helfen.

Bester Respekt,

Derek

___________________________________________________________________

TradeStation2000i – Automatic Trendlines on an Indicator.

Using TradeStation2000i I have used the Spread Ratio Indicator to draw a composite chart of the
Gold Bugs Index ($HUI) divided by the price of Gold ($Gold).

Is it possible to draw with Automatic Trendlines on the above composite chart?
(i.e. on the Spread Ratio Indicator).

Hoping you can help.

Best regards,

Derek

hektor
Mitglied seit 10 Jahre 9 Monate

Hi Derek,

you can find here a description how to use the trendlines automatic indicator on the CCI. Just use your ratio instead of the CCI.

https://http://www.tradestation.com/discussions/Topic.aspx?Topic_ID=20536

Derek Worswick
Mitglied seit 10 Jahre 9 Monate

Hi Hektor,

Thank you very much for the help on drawing Automatic Trendline on an Indicator.

The Website you quoted
http://www.tradestation.com/discussions/Topic.aspx?Topic_ID=20536

gives an ELD file $TRENDLINES AUTO 2.ELD
on the drawing of Automatic Trendlines.

Unfortunately my Easylanguage editor only allows me to import ELA and ELS files.
_______________________________________________________________________________

Is it possible to convert an ELD file to the ELA or ELS format?
________________________________________________________________________________

Thank you again.

Derek

TJRemington
Mitglied seit 10 Jahre 9 Monate

this is the code:

{
This indicator:
(1) INSERTS DnTL's/UpTL's connecting each new SwingHi/SwingLo with the next most
recent higher/lower SwingHi/SwingLo within the last 10 SwingHi's/SwingLo's;
(2) EXTENDS each new TL to the right and SETS it's color and alert type;
(3) TRUNCATES a DnTL/UpTL on the right when the next new DnTL/UpTL is drawn (if the
History input is set to "Yes"), or BarsPast bars after it has been breached,
whichever comes first.
(4) DELETES a DnTL/UpTL when the next new DnTL/UpTL is drawn, if the History input
is set to "No".

NOTE: This indicator may not work well with low-count tick bars, such as 10-tick bars,
etc., because the time resolution of the bars may not be high enough for each bar to
have a distinct time stamp.
}

inputs:
Price( cci(14) ),
SwHiStrength( 4 ),
SwLoStrength( 4 ),
BarsPast( 10 ),
History( "Yes" ),
DnTLColor( Green ),
UpTLColor( Red ),
AlertType( "IntraBar" ) ;

variables:
DnTLRef( -1 ),
DnTLEndBar( 0 ),
DnTLBreak( false ),
DnTLColorNum( DnTLColor ),

UpTLRef( -1 ),
UpTLEndBar( 0 ),
UpTLBreak( false ),
UpTLColorNum( UpTLColor ),

Index( 0 ),
BarNum( 0 ),
HistoryTF( false ),
AlertTypeCAPS( UpperStr( AlertType ) ) ;

arrays:
SwHiDate[10]( 0 ),
SwHiTime[10]( 0 ),
SwHiVal[10]( -1000000 ),
SwLoDate[10]( 0 ),
SwLoTime[10]( 0 ),
SwLoVal[10]( 1000000 ) ;

if CurrentBar = 1 then
HistoryTF = UpperStr( History ) = "YES" or UpperStr( History ) = "Y" ;
{ should also be able to do this via declaration above }

BarNum = BarNumber ;

if SwingHighBar( 1, Price, SwHiStrength, SwHiStrength + 1 ) = SwHiStrength then
{ ie, if just confirmed SwHi }
begin

{ push arrays back }
for Value1 = 9 downto 0
begin
SwHiDate[ Value1 + 1 ] = SwHiDate[Value1] ;
SwHiTime[ Value1 + 1 ] = SwHiTime[Value1] ;
SwHiVal[ Value1 + 1 ] = SwHiVal[Value1] ;
end ;

{ read in parameters of new SwHi into 0-elements of arrays }
SwHiDate[0] = Date[SwHiStrength] ;
SwHiTime[0] = Time[SwHiStrength] ;
SwHiVal[0] = Price[SwHiStrength] ;

{ find and save the index of the next-most-recent higher SwHi if it exists }
for Value2 = 1 to 10
begin
if SwHiVal[Value2] > SwHiVal[0] then
begin
Index = Value2 ;
Value2 = 11 ; { short circuit the looping with 11 instead of 10; the 11
will become 12 in the final pass }
end ;
end ;

if Value2 = 12 then { ie, if next-most-recent higher SwHi exists }
begin
if DnTLRef >= 0 then { ie, if previous DnTL exists }
begin
if HistoryTF and DnTLBreak = false then
{ if history reqd and most recent DnTL not already truncated
elsewhere, truncate it now }
begin
TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
TL_SetExtRight( DnTLRef, false ) ;
end
else if HistoryTF = false then
{ if history not reqd, delete most recent DnTL }
TL_Delete( DnTLRef ) ;
end ;
{ draw new DnTL, reset break flag, save endbar, set extents/color/alert }
DnTLRef = TL_New( SwHiDate[Index], SwHiTime[Index], SwHiVal[Index],
SwHiDate[0], SwHiTime[0], SwHiVal[0] ) ;
if DnTLBreak = true then
DnTLBreak = false ;
DnTLEndBar = BarNum - SwHiStrength ;
TL_SetExtLeft( DnTLRef, false ) ;
TL_SetExtRight( DnTLRef, true ) ;
if DnTLColorNum <> 99 then
TL_SetColor( DnTLRef, DnTLColorNum ) ;
if AlertTypeCAPS = "ONCLOSE" then
TL_SetAlert( DnTLRef, 2 )
else if AlertTypeCAPS = "INTRABAR" then
TL_SetAlert( DnTLRef, 1 )
else
TL_SetAlert( DnTLRef, 0 ) ;
end ;
end ;

if SwingLowBar( 1, Price, SwLoStrength, SwLoStrength + 1 ) = SwLoStrength then
{ ie, if just confirmed SwLo }
begin

{ push arrays back }
for Value1 = 9 downto 0
begin
SwLoDate[Value1+1] = SwLoDate[Value1] ;
SwLoTime[Value1+1] = SwLoTime[Value1] ;
SwLoVal[Value1+1] = SwLoVal[Value1] ;
end ;

{ read in parameters of new SwLo into 0-elements of arrays }
SwLoDate[0] = Date[SwLoStrength] ;
SwLoTime[0] = Time[SwLoStrength] ;
SwLoVal[0] = Price[SwLoStrength] ;

{ find and save the index of the next-most-recent lower SwLo if it exists }
for Value2 = 1 to 10
begin
if SwLoVal[Value2] < SwLoVal[0] then
begin
Index = Value2 ;
Value2 = 11 ;{ short circuit the looping with 11 instead of 10; the 11
will become 12 in the final pass }
end ;
end ;

if Value2 = 12 then { ie, if next-most-recent lower SwLo exists }
begin
if UpTLRef >= 0 then { ie, if previous UpTL exists }
begin
if HistoryTF and UpTLBreak = false then
{ if history reqd and most recent UpTL not already truncated
elsewhere, truncate it now }
begin
TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
TL_SetExtRight( UpTLRef, false ) ;
end
else if HistoryTF = false then
{ if history not reqd, delete most recent UpTL }
TL_Delete( UpTLRef ) ;
end ;
{ draw new UpTL, reset break flag, save endbar, set extents/color/alert }
UpTLRef = TL_New( SwLoDate[Index], SwLoTime[Index], SwLoVal[Index],
SwLoDate[0], SwLoTime[0], SwLoVal[0] ) ;
if UpTLBreak = true then
UpTLBreak = false ;
UpTLEndBar = BarNum - SwLoStrength ;
TL_SetExtLeft( UpTLRef, false ) ;
TL_SetExtRight( UpTLRef, true ) ;
if UpTLColorNum <> 99 then
TL_SetColor( UpTLRef, UpTLColorNum ) ;
if AlertTypeCAPS = "ONCLOSE" then
TL_SetAlert( UpTLRef, 2 )
else if AlertTypeCAPS = "INTRABAR" then
TL_SetAlert( UpTLRef, 1 )
else
TL_SetAlert( UpTLRef, 0 ) ;
end ;
end ;

{ if most recent DnTL/UpTL exists AND has not yet been truncated here AND was drawn
at least BarsPast ago AND was breached BarsPast bars ago THEN truncate it here and
set break flag }

if DnTLRef >= 0
and DnTLBreak = false
and BarNum > DnTLEndBar + SwHiStrength + BarsPast
and ( Close > TL_GetValue( DnTLRef, Date, Time ) )[BarsPast]
then
begin
TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
TL_SetExtRight( DnTLRef, false ) ;
DnTLBreak = true ;
end ;

if UpTLRef >= 0
and UpTLBreak = false
and BarNum > UpTLEndBar + SwLoStrength + BarsPast
and ( Close < TL_GetValue( UpTLRef, Date, Time ) )[BarsPast]
then
begin
TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
TL_SetExtRight( UpTLRef, false ) ;
UpTLBreak = true ;
end ;
Plot1(price,"Indic");

{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. **
** TradeStation reserves the right to modify or overwrite this analysis technique
with each release. ** }

Derek Worswick
Mitglied seit 10 Jahre 9 Monate

Hi Mr Remington,

Many thanks of your very quick reply to my question on converting ELD files to ELA or ELS format.

Is there a TradeStation conversion programme?

Best regards,

Derek

TJRemington
Mitglied seit 10 Jahre 9 Monate

Hi there

no I just opened it with TS 8.0 :-)
I think there's no way to open ELD-files with TS 2000i, but am not sure.

Cheers Till

Derek Worswick
Mitglied seit 10 Jahre 9 Monate

Hi again Mr Remington,

I pasted the code for Automatic Trendlines into the Easylanguage editor and it was verified as “excellent”.

But when I ran the code in TradeStation I got the following error: -
____________________________________________________________________
“FLOATING POINT NUMERICAL OVERLOAD”
____________________________________________________________________

Can you suggest what the error is?

Best regards,

Derek

metatrader
Mitglied seit 10 Jahre 9 Monate

@Derek,

here's a working version for Tradestation 2000 with a default setting History on.

{*******************************************************************
Description : This Indicator plots TrendLines-Automatic
Provided By : Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: RHStren(4), RLStren(4), History("Yes"), RHColor("Red"), RLColor("Blue"), AlrtType("IntraBar");;
Variables: RHTLRef(-1), RHTLRef2(-1), RHSet(-1), RHSet2(-1), RHArrayVal(0), RHColorVar(0), RLColorVar(0), BarsPast(0);
Variables: RLTLRef(-1), RLTLRef2(-1), RLSet(-1), RLSet2(-1),RLArrayVal(0), RHTLBrk(False), RLTLBrk(False);
Arrays: RHDate[10](0), RHTime[10](0), RHVal[10](0);
Arrays: RLDate[10](99999), RLTime[10](99999), RLVal[10](99999);

If currentbar=1 Then Begin
BarsPast = 10;
RHColorVar = StrColortoNum(RHColor);
RLColorVar = StrColortoNum(RLColor);
End;

If SwingHighBar(1, High, RHStren, RHStren+1)=RHStren Then Begin
For Value1 = 9 DownTo 0 Begin
RHDate[Value1+1] = RHDate[Value1];
RHTime[Value1+1] = RHTime[Value1];
RHVal[Value1+1] = RHVal[Value1];
End;
RHDate[0] = Date[RHStren];
RHTime[0] = Time[RHStren];
RHVal[0] = High[RHStren];

For Value22 = 1 To 10 Begin
If RHVal[Value22] > RHVal[0] Then Begin
RHArrayVal = Value22;
Value22 = 11;
End;
End;

If Value22 <> 11 Then Begin
If RHSet >= 0 Then Begin
If UpperStr(History) = "YES" or UpperStr(History) = "Y" Then Begin
If RHTLBrk = False Then
RHTLRef2 = TL_SetEnd(RHTLRef, Date,Time, TL_GetValue(RHTLRef, Date, Time));
RHSet2 = TL_SetExtRight(RHTLRef, False);
End
Else
TL_Delete(RHTLRef);
End;
RHTLBrk = False;
RHTLRef = TL_New(RHDate[RHArrayVal], RHTime[RHArrayVal], RHVal[RHArrayVal], RHDate[0], RHTime[0], RHVal[0]);
{Error checking To make sure TL was drawn}
If RHTLRef >= 0 Then Begin
RHSet = TL_SetExtRight(RHTLRef, True);
If RHColorVar <> 99 Then
Value14 = TL_SetColor(RHTLRef, RHColorVar);
End;
If False Then
Plot1[RHStren](High[RHStren], "RH ");
End;
End;

If SwingLowBar(1, Low, RLStren, RLStren+1) = RLStren Then Begin
For Value1 = 9 DownTo 0 Begin
RLDate[Value1+1] = RLDate[Value1];
RLTime[Value1+1] = RLTime[Value1];
RLVal[Value1+1] = RLVal[Value1];
End;
RLDate[0] = Date[RLStren];
RLTime[0] = Time[RLStren];
RLVal[0] = Low[RLStren];

For Value22 = 1 To 10 Begin
If RLVal[Value22] < RLVal[0] Then Begin
RLArrayVal = Value22;
Value22 = 11;
End;
End;
If Value22 <> 11 Then Begin
If RLSet >= 0 Then Begin
If (UpperStr(History) = "YES" or UpperStr(History) = "Y") Then Begin
If RLTLBrk = False Then
RLTLRef2 = TL_SetEnd(RLTLRef, Date, Time, TL_GetValue(RLTLRef, Date, Time));
RLSet2 = TL_SetExtRight(RLTLRef, False);
End
Else
TL_Delete(RLTLRef);
End;
RLTLBrk = False;
RLTLRef = TL_New(RLDate[RLArrayVal], RLTime[RLArrayVal], RLVal[RLArrayVal], RLDate[0], RLTime[0], RLVal[0]);
{Error checking To make sure TL was drawn}
If RLTLRef >= 0 Then Begin
RLSet = TL_SetExtRight(RLTLRef, True);
If RLColorVar <> 99 Then
Value14 = TL_SetColor(RLTLRef, RLColorVar);
End;
If False Then
Plot2[RLStren](Low[RLStren],"RL ");
End;
End;

If RHSet[BarsPast] >= 0 AND Close[BarsPast] Crosses Over TL_GetValue(RHTLRef, Date[BarsPast], Time[BarsPast]) Then Begin
RHTLRef2 = TL_SetEnd(RHTLRef, Date, Time, TL_GetValue(RHTLRef, Date, Time));
RHTLBrk = True;
End;

If RLSet[BarsPast] >= 0 AND Close[BarsPast] Crosses Below TL_GetValue(RLTLRef, Date[BarsPast], Time[BarsPast]) Then Begin
RLTLRef2 = TL_SetEnd(RLTLRef, Date, Time, TL_GetValue(RLTLRef, Date, Time));
RLTLBrk = True;
End;

If CheckAlert Then Begin
If RHSet >= 0 AND UpperStr(AlrtType) = "ONCLOSE" Then
TL_SetAlert(RHTLRef, 2)
Else
If RHSet >= 0 AND UpperStr(AlrtType) = "INTRABAR" Then
TL_SetAlert(RHTLRef, 1)
Else
If RHSet >= 0 Then
TL_SetAlert(RHTLRef, 0);

If RLSet >= 0 AND UpperStr(AlrtType) = "ONCLOSE" Then
TL_SetAlert(RLTLRef, 2)
Else
If RLSet >= 0 AND UpperStr(AlrtType) = "INTRABAR" Then
TL_SetAlert(RLTLRef, 1)
Else
If RLSet >= 0 Then
TL_SetAlert(RLTLRef, 0);
End;

Derek Worswick
Mitglied seit 10 Jahre 9 Monate

Dear MetaTrader,

Many thanks of your help on Automatic Trendlines for TS.

The code works perfectly well on Prices and Indices.

Is it possible to apply these Automatic Trendlines,

to indicators such as the Price Oscillator(5,34)

Or the Spread Ratio Indicator of the Gold Bugs Index(^HUI)
divided by the price of Gold(^XAU=X).

Best regards,

Derek

Rückrufservice
Beschreiben Sie bitte Ihr Anliegen, damit wir uns auf den Rückruf vorbereiten können.
Ja, ich habe die Datenschutzerklärung zur Kenntnis genommen und willige ein, dass die von mir angegebenen Daten inklusive der Kontaktdaten zwecks Bearbeitung der Anfrage und für den Fall von Anschlussfragen elektronisch erhoben und gespeichert werden. Meine Daten werden dabei nur streng zweckgebunden zur Bearbeitung meiner Anfrage genutzt und nicht ohne Einwilligung weitergegeben. Diese Einwilligung kann jederzeit mit Wirkung für die Zukunft widerrufen werden.

Jetzt registrieren

Jetzt registrieren und ZMP Live+ 14 Tage kostenlos testen!
  • Dauerhaft kostenfrei
  • Keine Zahlungsinformationen erforderlich