I know this is not TS forum, but I am not getting any help there. I figured why not goto the people that really know how to code stuff anyway. If this is not appropriate then I apologize in advance.
I am mearly trying to enter on a certain date and then place a trailing stop for some backtesting. I was using...
Condition1 = Date = 9/23/2005 ;
if Condition1 then
Buy ( "Entry Name" ) next bar at market;
BUt I was corrected that the Date needed to be Date = 1050923. So, that worked. Now the problem is, I cannot get another date to work like that. I would assume 1050729 would put me in on 07/29/2005, that is not the case. I am also using Percent Stop LX (.2) for a 20% trailing stop. That does not seem to be working. I am looking at the symbol CAT on 9/23/2005 with a 20% trailing stop and it doesn't take me out. I would gladly welcome any and all help that is given to me. Thank you in advance for all your help!
Matt
Very basic...but I am stuck
Moderator: moderators
- Blue Rhino
- rank: <50 posts
- Posts: 16
- Joined: Wed May 09, 2007 1:04 pm
- Reputation: 0
- Location: Atlanta
- Gender:
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: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
- Blue Rhino
- rank: <50 posts
- Posts: 16
- Joined: Wed May 09, 2007 1:04 pm
- Reputation: 0
- Location: Atlanta
- Gender:
TheRumpledOne wrote:Give this a try.
input:
iDate( 1050923);
if date = iDate
then Buy ( "Entry Name" ) next bar at market;
Now you change the input date without recoding the strategy.
Thank you TRO. For some reason it works with that date but no other. Any reason why? I change it from 1050923 to 1050729 and nothing or even 1050924.
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
- Blue Rhino
- rank: <50 posts
- Posts: 16
- Joined: Wed May 09, 2007 1:04 pm
- Reputation: 0
- Location: Atlanta
- Gender:
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: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
Worked for me:
Are you sure you have the chart data you need?
Are you sure you have the chart data you need?
Code: Select all
[Intrabarordergeneration=true]
input: iDate(1050923);
input:
ShareOrPosition( 1 ), { pass in 1 for per share basis, 2 for position basis }
ProfitTargetAmt( 0 ), { 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( 20 ), { 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. }
{*************************************************}
{ C A L C U L A T I O N S }
{*************************************************}
if Date=idate then
Buy ( "Entry Name" ) 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 ;
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.
- Blue Rhino
- rank: <50 posts
- Posts: 16
- Joined: Wed May 09, 2007 1:04 pm
- Reputation: 0
- Location: Atlanta
- Gender:
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
I don't think you can run strategies on daily charts, you'll have to ask TS that question.
Trailing Stops DON'T WORK, IMHO. At least, they don't do what you think they do.
Better to exit, when conditions indicate a reversal.
Trailing Stops DON'T WORK, IMHO. At least, they don't do what you think they do.
Better to exit, when conditions indicate a reversal.
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.
- Blue Rhino
- rank: <50 posts
- Posts: 16
- Joined: Wed May 09, 2007 1:04 pm
- Reputation: 0
- Location: Atlanta
- Gender:
TheRumpledOne wrote:I don't think you can run strategies on daily charts, you'll have to ask TS that question.
Trailing Stops DON'T WORK, IMHO. At least, they don't do what you think they do.
Better to exit, when conditions indicate a reversal.
I agree, I am just doing some backtesting on some stocks for study though. I thought if I used Percent Trailing (.2) it would trail a 20% stop, that doesn't seem to be happening. Thank you so much for all of your help!
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.