newbie programming questions |
Post Reply |
Author | |
zorro
Newbie Joined: 17 Apr 2005 Posts: 17 |
Post Options
Quote Reply
Topic: newbie programming questions Posted: 21 Sep 2005 at 8:37pm |
for #3, the relative performance indicator does something like this
|
|
ukipeter
Newbie Joined: 14 Sep 2005 Location: Australia Posts: 5 |
Post Options Quote Reply Posted: 20 Sep 2005 at 9:18am |
Thanks for that - now it all makes sense. |
|
just starting!
|
|
zorro
Newbie Joined: 17 Apr 2005 Posts: 17 |
Post Options Quote Reply 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). |
|
ukipeter
Newbie Joined: 14 Sep 2005 Location: Australia Posts: 5 |
Post Options Quote Reply 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!
|
|
Post Reply |
Forum Jump | Forum Permissions 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 |