- ago
Is there the possibility to create a sell/cover stop order relative to n-times ATR of the execution price with building blocks?
What I've found is the possibility to do this relative to the actual price or "Price Compare to Entry bar" but without the possibility to use an indicator like the ATR.
0
992
Solved
17 Replies

Reply

Bookmark

Sort
Glitch8
 ( 11.27% )
- ago
#1
Use the "Sell at ATR Limit/Stop" Exit Block.
0
- ago
#2
I tried the "Sell at ATR Limit/Stop" and got some problems. It looks to me like the C# code generation for 2 stop orders is not complete. It looks like the initialization for the stop(1) (orange) is missing. Also the plotting of the second stop limit seems to be missing.
The second thing I wonder about is that the "Sell ATR Stop" is dependent on the current stock price (green colored). I think this should be set in relation to the execution price (instead of "idx" I would expect "foundPosition0.EntryBar".

The Building Block "Strategy" :


The c# code:
(line 70 of the error messages goes to line 60 because I have to remove some lines)
0
- ago
#3
QUOTE:
The second thing I wonder about is that the "Sell ATR Stop" is dependent on the current stock price (green colored). I think this should be set in relation to the execution price (instead of "idx" I would expect "foundPosition0.EntryBar".

If you prefer your stop to be set this way then of course you can open the C# code and tweak it as you expect.

QUOTE:
It looks like the initialization for the stop(1) (orange) is missing. Also the plotting of the second stop limit seems to be missing.

Good catch, thanks. The missing initialization explains why the Blocks Strategy is working while the C# version throws exceptions.
0
Cone8
 ( 4.92% )
- ago
#4
Fixed for Build 33.
Until then, you can remove all the code related to that "stops" TimeSeries variable. It's leftover code that should have been removed when PlotStopsAndLimits() was added.
0
Best Answer
- ago
#5
QUOTE:
If you prefer your stop to be set this way then of course you can open the C# code and tweak it as you expect.


Is it possible to set this kind of Entry-Bar related ATR based "Initial Stop" in Building Blocks? (I can't code) Sadly the default settings, as described above, calculates the Stop on the current bar and not the entry bar. Therefore it allows the Stop to move up ("trail"), which for my understanding, isn't how a "stupid" stop should work?!

Thanks and sorry in advance for this noob question :)
0
- ago
#6
It's possible to open the C# code of your strategy after you draft it and tweak as topic starter has suggested:
QUOTE:
I think this should be set in relation to the execution price (instead of "idx" I would expect "foundPosition0.EntryBar".


Just an example:
CODE:
//value = ATR.Series(bars,period)[idx] * 3.00; value = ATR.Series(bars,period)[foundPosition0.EntryBar] * 3.00;
0
- ago
#7
Thank you for the quick reply. But in that case it's not in the building block view anymore but in the coding editor. Can I switch it back to building block view with the tweaked stop signal?
0
- ago
#8
It's not possible to go back to Blocks after editing C# code. You edit a Strategy once you've finished with its Blocks.

Maybe we could expand the Block with the new option, let me see.
0
- ago
#9
Hmm, too bad but thank you anyway!

Is it maybe possible to add this feature as "Initial Stop" in the exit strategy block "Sell ATR Limit or Stop" in a future update? Would fit there pretty good ;)
1
Cone8
 ( 4.92% )
- ago
#10
If I read you right, the suggestion is to add a checkbox that keeps the stop or limit prices relative to the entry price, right? Sounds good to me - I think that's what Eugene must have in mind.
0
- ago
#11
Exactly! This would be a HUGE improvement! When you do position sizing based on volatility (ATR) you also want some kind of ATR based Initital Stop that does NOT move...not moving downwards is possible with the "Trailing Stop" version but not moving up is not possible right now, at least not with Building Blocks. But this behaviour kicks me out too early out of positions, I want some more "loose pants" if that makes sense :P

Here an example of the regular ATR Stop at the moment but as you see it moves up and down due to the calculation on the current stock price. a straight horizontal line (calculated on the entry price) is the goal :)

This is maybe not the perfect example for an "too early" exit but it shows the moving of Stops quite good ;)
0
- ago
#12
Cone got it right: I'm working on the new checkbox.
1
- ago
#13
Sneak peek preview of the new option in B33:

2
Glitch8
 ( 11.27% )
- ago
#14
Can we include some documentation? These options just on the surface aren't the most intuitive and it would be good to have a clear explanation.

We also need to adjust the description when the new check box option is enabled.
0
- ago
#15
Both done now.
2
- ago
#16
@Friedel4711
@michid2

This has been impemented but a question has arised.

I find the term "entry bar" used in the conversation's context multiple times but is this what you're really after? The entry bar is the bar (idx+1) when the trade was opened. Could it be though that you're looking to fix the ATR value at the signal bar (idx) i.e. the bar when WL has generated the Signal to enter "tomorrow"?
0
- ago
#17
I use "ATR At Entry Bar" mainly in combination with a STOP. Here it makes sense from my point of view to set the stop relative to the execution price ( == entry bar), depending on the volatility.
Therefore, I am satisfied with the implementation.
0

Reply

Bookmark

Sort