This momentum strategy exits once any one of a set of technical objectives
have been met. All of these exits are SellatMarket.
I would like to install an additional defensive exit condition which is to create a stop-at-entry-price after a trigger point gain has been achieved
(for example, if the price gains 2% from entry-price then establish a stop at entry-price). I have used the trailing-stop function for this before; however this would be a SellatStop exit.
I do not know how to script two sets of exits - one SellatLimit, the other Sellat TrailingStop - to work together
Help or direction would be v useful
CODE:
Please log in to see this code.
Size:
Color:
Note that it's incorrect to start the main loop at bar #16: even Bollinger Bands period is 20 bars, and the RSI is an 'unstable' indicator. Therefore the trading loop here starts at three times RSI lookback period:
CODE:
Please log in to see this code.
Size:
Color:
V helpful (and elegant)
Thank you
Size:
Color:
Eugene
Looking at this in action it seems that NetProfitAsOfBarPercent uses
an observation at the close of a bar to trigger the Breakeven Stop.
I have searched in Wiki and in Advanced Searches (two entries) to find how it
may be possible for the function to use bar-highs instead - that is to use the
MFE for the position(so, for example, if NetProfitAsOfBarPercent occurred at the High for a bar
but not at its close, this would trigger the b/e stop)
The compiler does not like my (simple) attempts eg to go
NetProfitAsOfBarPercent(Close[bar]). What would be the right way to go about this?
Size:
Color:
Change p.NetProfitAsOfBarPercent(bar) to p.MFEAsOfBarPercent(bar).
Size:
Color: