Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Time based Exit Question Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
strategy123
Posted : Wednesday, August 19, 2009 12:13:04 PM
Registered User
Joined: 12/15/2008
Posts: 17

Is it possible to include a sell rule in the backscanner that would execute if the stock has not made at least 10% gain at the end of 10 days  ?   In other words, a "lack of progress" sell rule..   thx

Bruce_L
Posted : Wednesday, August 19, 2009 12:36:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Trade Rules (Rules that are calculated using the Price or Date of the Entry) in StockFinder are currently limited to the built in Trade Rules. I do not know of a way to create a Rule of the type proposed without replicating the entire BackScan within the Rule so the Rule can know if it is in a Trade or not and when and at what Price the Trade was Entered.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jas0501
Posted : Wednesday, August 19, 2009 4:21:35 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

Assumming the enterCondition logic is not overly complicated you can produce an exit rule with something like this:

static InTrade as boolean
static TradeDays as integer
static EnterPrice as single

if isfirstbar then
  inTrade = false
  tradeDays = -1
end if

if inTrade = False then
   if  
enterCondition
= True then
       inTrade = True
       tradeDays = 0
      '
      ' assume enter next day open
      '
      enterPrice = price.open(-1)
    end if
else
  tradeDays += 1
   if tradeDays >= 10 andalso _
   price.close < EnterPrice * 1.10 then
      '
      ' time to exit based on lack of progress
      '
      pass
      inTrade = False
      tradeDays = -1

   end if
  '
  ' the very trick part is that you need to mimic the alternate exits as well 
  ' to ensue that the correct entries are taken
  '
  if otherExitConditions then
    inTrade = false
   TradeDays = -1
  end if
end if

The backscan would just look for pass to exit. You need to provide the logic for the enterCondition.  The same logic used to triger the Entry, assuming buy next day open.

However....

Since there are multiple exits the otherExitConditions need to be expressed as well. Otherwise the code could  tracj a new entry while a trade is already open. Not good.

Depending on the complexity of the  
enterCondition and otherExitConditions logic the above approach may be a practical technique.

Not always practical though.


Better would be realcode exits with access to trade information like:
 - days in trade
 - entry price
- user specified entry values

Maybe someday....
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.