Shooting Star strategy with multiple profit targets
Author: bundasse
Creation Date: 3/30/2009 7:22 AM
profile picture

bundasse

#1
Hi i'm not a programmer but if someone can help writing a script
here my strategy :

if there is a shooting star and the top of the shooting star is above the top of the top of [bar-1] and [bar-2] or above the top of [bar-1] and [bar-3] or above the top [bar-2] and [bar-3] = selllimit at the opening of the next bar (after the shooting star)

the stop is 3 ticks above the top of the shooting star

the taking profit level :
50% of the position = selling level - (2 times (stop - open position)) (to get a Risk reward of 2)
50% of the position = selling level - (4 times (stop - open position))

sorry for my english.... i'm french !
thx a lot
profile picture

Eugene

#2
QUOTE:
selllimit at the opening of the next bar (after the shooting star)

Is this a short side setup? Then what's the short entry limit price (e.g. the next bar's opening price?)
profile picture

bundasse

#3
hi Eugene,

yes this is a short side setup and the short entry limit price is the next bar's opening price.

thx.
profile picture

bundasse

#4
Hi Eugène,

is it possible to make my strategy with wealth-Lab or it's too difficult ?

Thomas
profile picture

Eugene

#5
Sure it's possible Thomas, but I could've easily forgot your request as the forum was getting pretty active yesterday. Here's one possible way to go about it, the other would be to employ SplitPosition:
CODE:
Please log in to see this code.
profile picture

bundasse

#6
thx a lot Eugène !
profile picture

Eugene

#7
Hmm wait, that won't be useful in Multi-Symbol Backtest mode - what went through my head? Let me approach it in a different way.
profile picture

Eugene

#8
Here you go, the amended version suitable for MSB:
CODE:
Please log in to see this code.
profile picture

bundasse

#9
Hi Eugene

i have this error :

error CS103@(15,4) : Le nom 'CandlePattern' n'existe pas dans le contexte actuel

that means : the name 'CandlePattern' doesn't exist in the current context

thx
Thomas
profile picture

Eugene

#10
You are trying to copy & paste a fragment of my code inside Execute() to your own strategy without including one of the required references.
profile picture

bundasse

#11
i'm working only on this first strategy... i copied your code... may be i made a mistake when i made the copy
profile picture

Eugene

#12
1. You should do much better with the second strategy as it's suitable to run in portfolio backtest mode while the 1st one is not OK.
2. If my clue above didn't help, then you need to include this forgotten line as well:
CODE:
Please log in to see this code.
profile picture

bundasse

#13
ok i can run the strategy now but that not give me what i want, how can i send you my printscreen ?

Thomas
profile picture

Eugene

#14
1. Upload your image to any image hosting server
2. Find out the direct link to the image
3. Use the IMG button to paste the URI between a pair of IMG tags:
[ IMG ]your location[ / IMG ] (without spaces)
profile picture

bundasse

#15
look



click up left to widen the picture
profile picture

bundasse

#16
profile picture

Eugene

#17
Yes, I see the problem - let me take a look and fix the bug.

It's only a minor effort on your part to right click a flickr picture, copy the direct URI and insert it into a pair of IMG tags:
QUOTE:
http://farm4.static.flickr.com/3664/3404424470_75bb1ac0e5_o.jpg

Please do that next time, thank you.
profile picture

Eugene

#18
Meanwhile a question: what if the market opens above the high of the ShootingStar bar (for example, 4 ticks above) - would you skip the trade?
profile picture

bundasse

#19
yes i skip the trade...
profile picture

Eugene

#20
Here we go again. The first two drafts were buggy like hell so they should be completely ignored.

Re: "No signal" on your Flickr picture. Please try this code and see if it works for you, as I said there were bugs. Frankly, it's not my part to identify the ShootingStar setup; every time you see it on the chart, it's a job of the WealthLab.Rules.Candlesticks library - including the fancy highlighting. If it still doesn't show up where it should, we might need to take a look at your data.

Re: "Why it cover here" / "Why it stop here". Fixed!

CODE:
Please log in to see this code.
profile picture

bundasse

#21
my strategy is working but i have a problem

sometimes, the market does not reach the target and after that i'm stopped... so i think i have to include a strategy of trailing stop

on my strategy...

where can i find a lot of different script of trailing stop...

in my case i would like to include this trailing stop :

if there is a new bottom compare the bottom of my shooting star, move the stop from 3 ticks above the top of the shooting star
to the top of the shooting star...

thx
Thomas
profile picture

Eugene

#22
That doesn't sound like a complete definition of trailing stop, rather a single adjustment of the level. Anyway, you'll find more on trailing stops in the QuickRef ("Trading" section), if you search for "trailing" in the "Open Strategy" dialog and of course in WL5 Wiki.
profile picture

bundasse

#23
and if i just want to adjust a level... as i said :

if there is a new bottom compare the bottom of my shooting star, move the stop from 3 ticks above the top of the shooting star
to the top of the shooting star... and that's it... don't move it after.

profile picture

Eugene

#24
Then you would need to adjust the RiskStopLevel accordingly.
profile picture

bundasse

#25
where can i find RiskStopLevel ? on the QuickRef ("Trading" section) ? and where can i find the QuickRef ("Trading" section) ?
profile picture

Cone

#26
Put the cursor on a WealthScript function in the Editor and hit F1. Otherwise hit F11 to launch the QuickRef and use the Search to find a keyword.
profile picture

bundasse

#27
ok i read the QuickRef and i made my trailing... but where is my fault ?
here my trailing stop wanted = when the market reach a RR of 3 the moving average become the stop (i mean when the market cross to the upside the moving average, the system cover the short)

here my script :

CODE:
Please log in to see this code.


watch the result :



profile picture

Cone

#28
First,
CODE:
Please log in to see this code.


QUOTE:
It should trailing me stop this candle..
I'm sure it's correct for your conditioning, but you didn't tell us what ssPrice is. In other words, removing the "if" condition would for sure cause the stop to execute where you indicated, but the condition is preventing that signal from executing at that time.
profile picture

Eugene

#29
1) ssPrice is always 0 at the time you call it. It's declared on the bar before entry is made.
2) Don't use bar+0 aka bar: it's peeking. Bars, Loops, and Bar + 1

If my understanding is correct (untested):
CODE:
Please log in to see this code.
profile picture

bundasse

#30
Hi Cone, ssprice is the top of my candle give me the signal to sell... that give me a stop 3 ticks above my candle...

i tried to remove the 'if' and it doesn't work...
Eugene i'm sorry but i make my system with only one position for the moment... sorry

here my code... only my trailing stop doesn't work :

CODE:
Please log in to see this code.
profile picture

bundasse

#31
what's wrong on my trailing stop script ?

watch the result

profile picture

Cone

#32
Remove this line from your code -
CODE:
Please log in to see this code.

That's the problem.
profile picture

bundasse

#33
yeah but when i remove this line, the condition to use the moving average as the trailing stop only after reaching the RR2 is removed...
profile picture

bundasse

#34
or a RR of 3
profile picture

Cone

#35
But it's the problem! I've already said this, but the Trailing Stop function can only work if it's executed and that condition is not allowing it to execute.

Why? Because it's returning "false" where you think the stop should exit the trade.

Why is it returning false? All the values of the variables in that condition are pretty clear except for stop. If you find out what stop is, then you'll know what the problem is. This is your code... time to troubleshoot it.
profile picture

bundasse

#36
when you said that the stop is not clear, this is only on this script line :

CODE:
Please log in to see this code.


and how can i define the condition 'if you reach a RR of 3, watch the moving average as the trailing stop'
profile picture

Eugene

#37
Use my latest code for example:
CODE:
Please log in to see this code.
profile picture

bundasse

#38
i will try but i don't understand where you define 'limit3hit'
profile picture

Eugene

#39
At the time of entry. See the same strategy code, below.
profile picture

bundasse

#40
and should i start my script with the trailing stop and finish it with the condition of entry level ?

like you did on the script above the 4/14/2009 4:54 PM ?
profile picture

Eugene

#41
CODE:
Please log in to see this code.
profile picture

bundasse

#42
Hi engene, that almost work... the only thing is that it trailing me stop at the moving average only when the bar-1 is below the limit of the RR3... i would like that the system use the trailing stop when the market hit the rr3... even if the market cross the moving average two, three etc bar after... i tried to remove the bar+1 in this line :
CODE:
Please log in to see this code.
but it doesn't work

it's maybe clearest with the picture...


profile picture

bundasse

#43
PS : thx to integrate the color... that's really fantastic !
profile picture

Eugene

#44
QUOTE:
i would like that the system use the trailing stop when the market hit the rr3... even if the market cross the moving average two, three etc bar after...

This is what I suppose this code is exactly doing: once the RR3 level is hit, it trails the stop at the SMA level on that bar and will exit when this level is breached.

QUOTE:
i tried to remove the bar+1 in this line :

This will lead you nowhere. If you understand the purpose of bar+1 in that line, how could you remove that mandatory parameter?
profile picture

bundasse

#45
but it doesn't work, because in the first case (on the picture) i'm not stop on the moving average even if the market hit the RR3 limit... how can i replace bar+1 by all the bar after hiting the rr3 ?
profile picture

Eugene

#46
You should not replace bar+1 with anything. Read this KB article again to understand why:
Bars, Loops, and Bar + 1
QUOTE:
i'm not stop on the moving average even if the market hit the RR3 limit

I seem to have implemented that twist:
CODE:
Please log in to see this code.

Here's the 5-minute Eurex Bund data for 01/Apr/2009, as you see the Strategy will now cover on a CrossOver even if the price is above the RR3 limit:
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).