TRO TRAILING STOP
Too funny, I just realized today that TradeStation doesn't have a trailing stop INDICATOR. There's the Stops & Targets strategy for auto trading but I don't think there's an indicator. So I wrote one TRO TRAILING STOP to alert you when your stop is hit.
White "+" is the entry price.
Yellow "+" is the stop price.
ELD attached.
TRO TRAILING STOP
Moderator: moderators
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15558
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3035
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
TRO TRAILING STOP
- Attachments
-
- TRO_TRAILINGSTOP.ELD
- (9.97 KiB) Downloaded 640 times
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!
Please do NOT PM me with trading or coding questions, post them in a thread.
Please do NOT PM me with trading or coding questions, post them in a thread.
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15558
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3035
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15558
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3035
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
Code: Select all
{ _TRO_TrailingStop }
{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}
{Programmer: Avery T. Horton, Jr. aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }
{ ? Copyright 2007 Avery T. Horton, Jr.}
Inputs:
iDecimals(4),
iStartDate( 1070815),
iStartTime( 1705),
iTradeLong(false),
iEntryColor(white),
iStopColor(yellow),
iPrice( 1.9874),
iTrailing( .0007);
variables:
xStartDate( iStartDate ),
xStartTime( iStartTime ),
xPrice( iPrice ),
xTrail(0),
xMinPL(0),
xPeriods(60),
xInterval(0),
sFirstPass(true),
xInd(0),
tInd(""),
tAlert("");
variables:
FG1(iStopColor),
BG1(black),
fg2(iEntryColor),
bg2(black),
fg3(white),
bg3(black),
fg4(white),
bg4(black);
{commentary variables}
variables:
xcomm(0),
oComm1( "" ),
oComm2( "" ),
oComm3( "" ),
oComm4( "" ),
oComm5( "" ),
oComm6( "" ),
oComm7( "" ),
oComm8( "" ),
oComm9( "" ),
oComm10( "" );
variables:
xELDateToString(" "),
xDate(0),
xTime(0),
xOpen(0),
xClose(0),
xHigh(0),
xLow(0);
{ INITIALIZE }
tInd = "";
tAlert = "";
{ PROCESSING }
If Date = xStartDate
and Time = xStartTime
then begin
if iTradeLong
then xTrail = xPrice - iTrailing
else xTrail = xPrice + iTrailing ;
end;
If Date > xStartDate
or ( Date = xStartDate and Time >= xStartTime )
then begin
if iTradeLong
then begin
value9 = High - iTrailing ;
If value9 > xTrail
then xTrail = value9 ;
if close <= xTrail
then tAlert = "Long Stop Hit";
end;
if iTradeLong = false
then begin
value9 = Low + iTrailing ;
If value9 < xTrail
then xTrail = value9 ;
if close >= xTrail
then tAlert = "Short Stop Hit";
end;
{ Alert }
if tAlert <> ""
and tAlert <> tAlert[1]
then Alert( tAlert ) ;
{ PLOT }
Plot1( xTrail , "Stop Price", fg1 ) ;
SetPlotBGColor( 1, bg1);
Plot2( xPrice , "Entry Price", fg2 ) ;
SetPlotBGColor( 2, bg2);
end ;
xComm = _fCommentary(oComm1, oComm2, oComm3, oComm4, oComm5, oComm6, oComm7, oComm8, oComm9, oComm10);
CommentaryCl(oComm1 );
CommentaryCl(oComm2 );
CommentaryCl(oComm3 );
CommentaryCl(oComm4 );
CommentaryCl(oComm5 );
CommentaryCl(oComm6 );
CommentaryCl(oComm7 );
CommentaryCl(oComm8 );
CommentaryCl(oComm9 );
CommentaryCl(oComm10 );
CommentaryCl( " " );
CommentaryCl( "xPrice: ", NumToStr( xPrice , iDecimals) );
CommentaryCl( "xTrail: ", NumToStr( xTrail , iDecimals) );
xELDateToString = ELDateToString(xStartDate);
CommentaryCl( "xStartDate: ", xELDateToString );
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!
Please do NOT PM me with trading or coding questions, post them in a thread.
Please do NOT PM me with trading or coding questions, post them in a thread.
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
-
- rank: 150+ posts
- Posts: 152
- Joined: Sat Jul 29, 2006 9:16 pm
- Reputation: 0
- Location: Geneva, FL
- Gender:
Re: TS /Esig Code
rebkwez wrote:Avery,
Would you be able to post the TS code so I can convert it to eSignal?
Thanks,
Elliot
Elliot,
please post the .efs when you're done.
Thanks,
Kirk
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.