Pyramiding a Short Reversion Strategy
Author: topcat77
Creation Date: 9/2/2010 2:58 PM
profile picture

topcat77

#1
I used the WIKI Pyramiding example, WealthScript Techniques (Eugene, 05/09), to amend the Reversion strategy below to enable it to add to its Short position at each 5% increment to the last transacted price for a max of 4 entries. (The strategy enters a Short position when the DSIndex CrossesOver a level and covers when it reverts back under a lower level).

The compiler is ok with the code (a small victory) but it only allows the command "ShortAtStop" (?)in what I think is the pyramiding instruction ;
CODE:
Please log in to see this code.


. . . . .and the strategy does not add to its initial positions at all ( ie it transacts exactly as if there was no pyramiding )

Please could you look over my attempt to code this in and help me fix it

Thank You

CODE:
Please log in to see this code.



profile picture

topcat77

#2

I downloaded PosSizer (which looks like a great box of tricks) to see whether that would enable the
"averaging-up" feature of the strategy (although pyramiding there describes size-pyramiding ).
The pyramiding function in PosSizer asks for Initial entry signal; a banal question - how/where can one insert a Position SignalName
in the script above ? I have tried specifying "FIRST" as a Signal name like:

QUOTE:
if( ShortAtMarket(bar+1,(cnt+1).ToString()) !=null, "FIRST")

but this doesn't compile


Alternately how can the AutoComplete function be accessed ?
Thanks in advance for help with this and my earlier post
profile picture

Eugene

#3
The Autocomplete function is a helper in the PosSizer's GUI interface; it has no use in strategies.

Your code isn't compiling because the syntax is wrong. Don't modify the code, instead type in your initial signal in the PosSizer's field. Since your "cnt" variable is zero-based, you need to enter 0 in the PosSizer's "initial entry signal".
profile picture

topcat77

#4
With 0 as the "initial entry signal" I still get all 1197 trades in a 8yr backtest dropped if I use the PosSizer. If I use
RP mode I get no pyramiding but all 1197 initial trades .

two questions:

1)could the strategy script be made workable to allow multiple-entries, each at a set increment (say5%) above the last entry,
without the PosSizer ? If so, what can I do to the Script to effect this ? (to be accurate the strategy wants to average-up rather
than pyramid)

2) what else can I try to get the PosSizer to work so that the strategy can increase position size as well?

Thanks
profile picture

topcat77

#5
Eugene

I might be making a meal of this, so

simplifying my problem:

I would like to get the script to:

1) SELL SHORT on a CrossOver of an Index (the DSIndex in my example)
Add to that short each time that the price closes x% (say 5%) higher than the last entry, for a max of 3 additional entries,
until the Exit condition is satisfied. Period.
(most of this is v simple, but the add routine is the issue that's been foxing me)

2 If, in addition, I can PosSize this Strategy for pyramiding volume that would be fantastic

but just getting 1) done would be great

Thank You

Dinsa
profile picture

Cone

#6
The first thing I notice is that canPyramid will always be false by the time it reaches the "if( canPyramid )" statement. That's a show stopper right there.

Hint: What's the purpose of the "else" block right above the "if( canPyramid )" statement?
profile picture

topcat77

#7
Brilliant - it should have stared me in the face. Thanks v m

(Still can't get the PosSizing to work but I'll battle that tomorrow. Hints welcome though)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).