BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: newbie programming questions
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

newbie programming questions

 Post Reply Post Reply
Author
Message Reverse Sort Order / View First Unread Post
zorro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 Apr 2005
Posts: 17
Post Options Post Options   Quote zorro Quote  Post ReplyReply Direct Link To This Post Topic: newbie programming questions
    Posted: 21 Sep 2005 at 8:37pm
for #3, the relative performance indicator does something like this
Back to Top
ukipeter View Drop Down
Newbie
Newbie
Avatar

Joined: 14 Sep 2005
Location: Australia
Posts: 5
Post Options Post Options   Quote ukipeter Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 2005 at 9:18am

Thanks for that - now it all makes sense.

just starting!
Back to Top
zorro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 Apr 2005
Posts: 17
Post Options Post Options   Quote zorro Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2005 at 10:49pm
prev just returns the same result as the previous bar.
eg:
inMarket :=
if (entry, true,
if (takeprofit or stopped, false, prev));

in this case, 'inMarket' is set to true whenever 'entry' is true (entering the market). it is set to false if either takeprofit or stopped is true (exiting the market). and if none of the three signals are true then the result is unchanged from the previous (if you're in, you stay in; if you're out, you stay out).

Back to Top
ukipeter View Drop Down
Newbie
Newbie
Avatar

Joined: 14 Sep 2005
Location: Australia
Posts: 5
Post Options Post Options   Quote ukipeter Quote  Post ReplyReply Direct Link To This Post Posted: 15 Sep 2005 at 8:11am
I'm just starting with BullScript.  I've been looking through some of the scripts trying to understand how things work.
 
1) prev statement.   I am a bit puzzled how the prev statement works.
 
I have copied some code from the JB Volatility Stop Loss. 
 
I can work most of it out, but I am lost as to what the prev does in the following lines.  Any clues?
 
 
[citation="'Share Traders Handbook', Jim Berg;
'A Winning Combination for Traders', Jim Berg, Leverage July 2004 Issue 32 p15-17
www.leveragemag.com.au"]
[target=Price; author=Berg, Jim; category=Stop Loss|Volatility]
 
In this inMarket statement, what does the 'prev' do in the second if statement?
 
inMarket :=
if (entry, true,
if (takeprofit or stopped, false, prev));
 
jbmode := if (C>r1, 1, if (C<r2, -1, prev) );
 
 
2) From the MACD Tradesim example

{Generated BullScript for "TradeSim Sample Scan" scan}
 
{Condition: return all securities }
filter := true;
filter;
 

{-- Trading System : "Sample MACD System" --}
_var1 := formula("MACD", 12, 26, 9);
_var2 := formula("MACD[2]", 12, 26, 9);
EntryTrigger := (cross(_var1, _var2));
EntryPrice := Open;
ExitTrigger := (cross(_var2, _var1));
ExitPrice := Open;
InitialStop := Low-2*ATR(10);
 
[visible=no]
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.EnableDelayOfEntryByOneBar");
ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml("TradeSim.EnablePriceFilter");
ExtFml("TradeSim.SetVolumeInfoType",LOWEST);
 
[name="Sample MACD System Trades"; dp=0; visible=yes]
ExtFml("TradeSim.RecordTrades",
 "TradeSim Sample Scan",
 LONG,
 EntryTrigger,
 EntryPrice,
 InitialStop,
 ExitTrigger,
 ExitPrice,
 START);
 
What would you put if you wanted to exit if the opening price went a fixed percentage above your entry price (e.g. 5%)?
 
3) I am looking at comparing the prices with the price at a particular date, so, before that date the indicate would plot 0, after that date, it would plot the ratio of the bar to the bar at a particular date.  For example, I would like to plot
 
Close/ Close("25/03/05")
 
How could I do this?
 
Peter Bloomfield
 
 
 
just starting!
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