BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > TradeSim discussion
  New Posts New Posts RSS Feed: BarsSince entry
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

BarsSince entry

 Post Reply Post Reply
Author
Message Reverse Sort Order / View First Unread Post
pipsqueek View Drop Down
Regular
Regular
Avatar

Joined: 03 Jan 2005
Location: Australia
Posts: 34
Post Options Post Options   Quote pipsqueek Quote  Post ReplyReply Direct Link To This Post Topic: BarsSince entry
    Posted: 06 Jun 2005 at 1:34pm

This is GREAT.

Going by the fiddling I've done so far, the BarsSince(EntryTrigger) and EntryPrice is going to do what I want.

Many thanks, Peter

failing to plan is planning to fail.
Back to Top
pipsqueek View Drop Down
Regular
Regular
Avatar

Joined: 03 Jan 2005
Location: Australia
Posts: 34
Post Options Post Options   Quote pipsqueek Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jun 2005 at 10:39am

Thanks for that Peter,

I'll have a fiddle with EntryTrigger and EntryPrice and see how I go.

Your comments on their use are duly noted and much appreciated.

failing to plan is planning to fail.
Back to Top
Peter View Drop Down
BullCharts Staff
BullCharts Staff
Avatar

Joined: 09 Sep 2004
Location: Australia
Posts: 241
Post Options Post Options   Quote Peter Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jun 2005 at 10:26am
This can be (sort of) achieved with EntryTrigger. You need ver 2.5.3 to have access to EntryTrigger. Unfortunately the BullScript help doesn't include EntryTrigger. (my oops.. forgot to copy the file in at the time it was released)

First, a side note on the example you provided. "In" isn't part of tradesim or metastock. The reason "In" works in line two of your example, is because it's defned in line 1.

EntryTrigger returns true on days when your entry criteria evaluate to true. So you can use BarsSince(EntryTrigger). There is also an EntryPrice function, which returns your entry price on the last day that EntryTrigger trigger was true - and in your case, you may find this easier.

Note: EntryPrice and EntryTrigger can only be used when calculating ExitPrice and ExitTrigger. They're actually pseudo functions that get converted into other BullScript code. To understand them better, try using them, then use the "Generate Script" button on the advanced tab to see how they've been converted.

There is one important cavet.

EntryTrigger is true on days where your entry criteria are matched. But that isn't necessarily the same as the days you have entered. Eg, if your entry criteria are met, but you are already in a trade (and do not have pyramiding turned on) then EntryTrigger will return true even though a new position is not being opened.

Unfortunately this is something which we probably can't change because of the way TradeSim works, which in turn probably can't change because of the way Metastock works. But on the other hand, it would be a limitation of your Metastock example above as well. C'est la vie.

Remember: ver 2.5.3 only.

Back to Top
pipsqueek View Drop Down
Regular
Regular
Avatar

Joined: 03 Jan 2005
Location: Australia
Posts: 34
Post Options Post Options   Quote pipsqueek Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jun 2005 at 1:27pm

Hi Peter

How do I get Tradesim to calculate the number of bars since a trade entry was generated?

I've had a prowl around the compuvsion TS forum and notice that Jose Silva used this code for Metastock

In:=Fml("001 system buy signals");

BarsSince(In)

Bullchart's TS won't recognise the formula for "In", but probably has something similar that will work, I hope.

I want to be able to calculate the %price change over the first 5 bars since entry, and exit if this % fails to meet my expectations. This is NOT the same thing as the profit stop on the stops tab, which will certainly get me out if the %profit fails to materialise within 5 bars, but also gets me out as soon as the profit% is reached. Not at all what I want!

I think I could do this if I could count how many bars since a tradesim entry.

Any ideas, Peter?

 

 

 

failing to plan is planning to fail.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz