NexusFi: Find Your Edge


Home Menu

 





Trendline Alert in RadarScreen


Discussion in TradeStation

Updated
    1. trending_up 2,245 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 1 attachments




 
Search this Thread

Trendline Alert in RadarScreen

  #1 (permalink)
tradefx
Green Bay
 
Posts: 1 since Jul 2018
Thanks Given: 0
Thanks Received: 0

Hello,
I have spent a ton of time on this and I can’t figure out why this code does not produce alerts in Radarscreen. If you would be so kind and help me modify this code to produce alerts when the trendline is broken in radarscreen I would greatly appreciate it.
Thank you for your help.

Below is the code...
-------------------------------------------------------

inputs:
SwHiStrength( 4 ),
SwLoStrength( 4 ),
BarsPast( 10 ),
History( "Yes" ),
DnTLColor( Red ),
UpTLColor( Cyan ),
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" ;

BarNum = BarNumber ;

if SwingHighBar( 1, High, SwHiStrength, SwHiStrength + 1 ) = SwHiStrength then

begin

for Value1 = 9 downto 0
begin
SwHiDate[ Value1 + 1 ] = SwHiDate[Value1] ;
SwHiTime[ Value1 + 1 ] = SwHiTime[Value1] ;
SwHiVal[ Value1 + 1 ] = SwHiVal[Value1] ;
end ;

SwHiDate[0] = Date[SwHiStrength] ;
SwHiTime[0] = Time[SwHiStrength] ;
SwHiVal[0] = High[SwHiStrength] ;

for Value2 = 1 to 10
begin
if SwHiVal[Value2] > SwHiVal[0] then
begin
Index = Value2 ;
Value2 = 11 ;
end ;
end ;

if Value2 = 12 then
begin
if DnTLRef >= 0 then
begin
if HistoryTF and DnTLBreak = false then

begin
TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
TL_SetExtRight( DnTLRef, true ) ;
end
else if HistoryTF = false then

TL_Delete( DnTLRef ) ;
end ;

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, Low, SwLoStrength, SwLoStrength + 1 ) = SwLoStrength then

begin

for Value1 = 9 downto 0
begin
SwLoDate[Value1+1] = SwLoDate[Value1] ;
SwLoTime[Value1+1] = SwLoTime[Value1] ;
SwLoVal[Value1+1] = SwLoVal[Value1] ;
end ;

SwLoDate[0] = Date[SwLoStrength] ;
SwLoTime[0] = Time[SwLoStrength] ;
SwLoVal[0] = Low[SwLoStrength] ;

for Value2 = 1 to 10
begin
if SwLoVal[Value2] < SwLoVal[0] then
begin
Index = Value2 ;
Value2 = 11 ;
end ;
end ;

if Value2 = 12 then
begin
if UpTLRef >= 0 then
begin
if HistoryTF and UpTLBreak = false then

begin
TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
TL_SetExtRight( UpTLRef, true ) ;
end
else if HistoryTF = false then

TL_Delete( UpTLRef ) ;
end ;

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 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 ;

If UpTLBreak = true then
Plot1( UpTLBreak , "Up" ) ;

If DnTLBreak = true then
Plot2( DnTLBreak , "Down" ) ;

Attached Files
Elite Membership required to download: TSHELPTRENDLINE.ELD
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Hi tradefx,

trendlines are not available in Radarscreen, but you could write code to compute the values that your trendlines would have on each bar and check for alerts. After all you can compute the slope of each trend line out of the start and end point and with that can compute the value on each bar.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
maggtrading
quintana roo, méxico
 
Posts: 84 since Mar 2013
Thanks Given: 222
Thanks Received: 40


regards, i'm in a very similar situation. i'm trying to create an indicator that would draw something similar to a gann fan automatically on a chart, with minimal need for user input.



from the information i have read, i have come to think that the only method to create trend lines from easylanguage is with the tl_new command by setting starting and end points (i understand that neither angles nor gann angles exist in el).


i'm stuck with two things, first, i would like my indicator to use the point where another indicator i have last made a >=.5% move as the starting point for the trend lines. i understand that i would need to identify 3 values from that specific point to be able to use it as a coordinate: date, time and price but i have no idea how to get easylanguage to gather these values.


second, i would also like to set alerts if price broke above or below the trend lines that my indicator would create. ¿how could i use the points on my trends and the slope to project the values going forward? ¿is ts capable of performing trigonometric calculations as required?



very well, thanks in advance, regards.

Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

maggtrading,

you can use legacy Easylanguage or OOEL drawing objects to create trend lines in Tradestation.

You would need a way to access the values of your other indicator and the easiest way might be to include the computations in the indicator that draws the trend lines.

Since you know the start and end point of your trend line you can compute the slope and with that can compute every point in the future within your code.

Regards,

ABCTG


maggtrading View Post
regards, i'm in a very similar situation. i'm trying to create an indicator that would draw something similar to a gann fan automatically on a chart, with minimal need for user input.



from the information i have read, i have come to think that the only method to create trend lines from easylanguage is with the tl_new command by setting starting and end points (i understand that neither angles nor gann angles exist in el).


i'm stuck with two things, first, i would like my indicator to use the point where another indicator i have last made a >=.5% move as the starting point for the trend lines. i understand that i would need to identify 3 values from that specific point to be able to use it as a coordinate: date, time and price but i have no idea how to get easylanguage to gather these values.


second, i would also like to set alerts if price broke above or below the trend lines that my indicator would create. ¿how could i use the points on my trends and the slope to project the values going forward? ¿is ts capable of performing trigonometric calculations as required?



very well, thanks in advance, regards.


Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on October 10, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts