DEMONSTRATION PURPOSES ONLY

free & uncensored discussion arena for TheRumpledOne

Moderator: moderators

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15561
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

DEMONSTRATION PURPOSES ONLY

Postby TheRumpledOne » Sat Sep 22, 2007 9:54 pm

DEMONSTRATION PURPOSES ONLY

Code: Select all

{ $Dyn_SR - Trade when previous Support/Resistance lines crossed }
   
{Attn: TradeStation
if this 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:
 
   iStartDate(1070101),  // if not intraday, date to start counting
   iPeriods(5),
   iQuantity(10);


inputs:

iGreed_PCT( 0 ),        {how much you want to make in a day - percentage of stock price}


 ShareOrPosition( 1 ), { pass in 1 for per share basis, 2 for position basis }

 ProfitTargetAmt( .06 ), { pass in 0 if you don't want a profit target } 
      
 StopLossAmt( 0 ), { pass in 0 if you don't want a stop loss }
    
 BreakevenFloorAmt( 0 ), { pass in 0 if you don't want a breakeven stop }
 DollarTrailingAmt( 0 ), { pass in 0 if you don't want a dollar trailing stop }
 PctTrailingFloorAmt( 0 ), { pass in 0 here and/or in next input if you don't want
  a percent trailing stop }
 PctTrailingPct( 0 ), { pass in 0 here and/or in previous input if you don't want
  a percent trailing stop; else pass in XX for XX percent }
 ExitOnClose( false ) ; { pass in true if you want to exit the position at the
  close of the day, else pass in false. CAUTION: We recommend that you set this to
  TRUE only for back-testing, if at all; in automated execution, the exit order
  will NOT be filled at the close of the day; instead, the order can be sent into
  the extended session as a limit order. }



variables:

xLastTouch("S") ,

xShortStop(0),
xShortEntry(0),

xLongStop(0),
xLongEntry(0),

xLowestLow(0),
xHighestHigh(0),
xRange(0),

xPosition(0),
   
oExtremeVal( 0 ),
oExtremeBar( 0 ) ;


variables:

xBars( 0 ),
xPeriods(05),
xOldPeriods(0),

   Dynamic_R( 0 ),
   Dynamic_S( 0 ),
   OldDynamic_R( 0 ),
   OldDynamic_S( 0 ),
   PrevDynamic_R( 0 ),
   PrevDynamic_S( 0 ) ;

{ INITIALIZE }

      
{ CALCULATIONS }
         

{save old values}
   
If Dynamic_R <> PrevDynamic_R
   then OldDynamic_R = PrevDynamic_R;
      
If Dynamic_S <> PrevDynamic_S
   then OldDynamic_S  = PrevDynamic_S ;
   
PrevDynamic_R = Dynamic_R ;
PrevDynamic_S = Dynamic_S ;

{ high / low for period }
   
xBars = xBars + 1;

oExtremeVal = Extremes( L, iPeriods, -1, Dynamic_S , oExtremeBar ) ; // lowest low

oExtremeVal = Extremes( H, iPeriods, 1, Dynamic_R , oExtremeBar ) ; // highest high

If Dynamic_R <> H
and Dynamic_R < PrevDynamic_R
   then if PrevDynamic_R <> 0
      then Dynamic_R = PrevDynamic_R;
   
If Dynamic_S <> L
and Dynamic_S > PrevDynamic_S       
   then if PrevDynamic_S <> 0
      then Dynamic_S = PrevDynamic_S;

if high = Dynamic_R
and low = Dynamic_S
then xLastTouch = " " 
else begin
   if low = Dynamic_S
      then xLastTouch = "S" ;
   if high = Dynamic_R
      then  xLastTouch = "R" ;
end ;


if MarketPosition = 0
THEN BEGIN
{
If close crosses above OldDynamic_S 
and xLastTouch = "S"
   then Buy ( "oDynSR LE") iQuantity shares  next bar at OldDynamic_S limit ;         // enter LONG
}
If close crosses above PrevDynamic_S
and xLastTouch = "S"
   then Buy ( "pDynSR LE") iQuantity shares  next bar at PrevDynamic_S limit ;         // enter LONG
{
If close crosses below OldDynamic_R
and xLastTouch = "R"
   then SellShort   ( "oDynSR SE") iQuantity shares  next bar at OldDynamic_R limit ;   // enter SHORT
}
If close crosses below PrevDynamic_R
and xLastTouch = "R"
   then SellShort   ( "pDynSR SE") iQuantity shares  next bar at PrevDynamic_R limit ;   // enter SHORT


END; // if MarketPosition = 0


if MarketPosition = 1
AND close < PrevDynamic_S
   then sell ( "pDynSR LX") iQuantity shares  next bar at MARKET ;


if MarketPosition = -1
AND close > PrevDynamic_R
   then buy to cover ( "pDynSR SX") iQuantity shares  next bar at MARKET ;


{*************************************************}
{              T A K E   P R O F I T              }
{*************************************************}

if ShareOrPosition = 1
   then  SetStopShare
   else  SetStopPosition ;
 

if ProfitTargetAmt  > 0 then
 SetProfitTarget( ProfitTargetAmt  ) ;

if StopLossAmt > 0 then
 SetStopLoss( StopLossAmt ) ;

if BreakevenFloorAmt > 0 then
 SetBreakeven( BreakevenFloorAmt ) ;

if DollarTrailingAmt > 0 then
  SetDollarTrailing( DollarTrailingAmt ) ;

if PctTrailingFloorAmt > 0 and PctTrailingPct > 0 then
 SetPercentTrailing( PctTrailingFloorAmt, PctTrailingPct ) ;

if ExitOnClose = true then
 SetExitOnClose ;


WARNING: DO NOT USE THIS CODE TO TRADE YOUR ACCOUNT

I wrote it to test an idea.
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 add www.kreslik.com to your ad blocker white list.
Thank you for your support.

4x=0
rank: 150+ posts
rank: 150+ posts
Posts: 410
Joined: Tue Oct 17, 2006 10:53 pm
Reputation: 1
Gender: Male

Postby 4x=0 » Sun Sep 23, 2007 11:28 pm

What idea are you testing? Who's idea is it?

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15561
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Mon Sep 24, 2007 1:00 am

My idea.
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.

4x=0
rank: 150+ posts
rank: 150+ posts
Posts: 410
Joined: Tue Oct 17, 2006 10:53 pm
Reputation: 1
Gender: Male

Postby 4x=0 » Mon Sep 24, 2007 8:06 pm

TRO, I plan to share your system in my investments class, the buy zone. I'm also going to show your picture and your name on the big screen, I hope that's ok. Let me know if there is something in particular you want to share or not share.

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15561
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Mon Sep 24, 2007 8:29 pm

You can share anything that is in the public domain.
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 add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “TheRumpledOne”