I have been trying to implement what Brian has suggested for a simple long
only macd based strategy. Given that I am new to quantstrat, this may be quite
an elementary question, but here goes.
1. I have a simple long only MACD based system that gives me entry and exit
signals on T.2. On the basis os a long signal I trigger a market order to buy
on T+1, at the open.3. Based on this execution, I need to set a hard stop on
the position entered in #2, that is x% below the execution price of 2, with the
comparison being done at the close of each day, and if the signal triggers on
some day D, the order is executed as a market sell order on the next day D+1.My
signal essentially says "Check to see if the closing price on any day is less
than the execution prices of the last opening trade minus a threshold and if it
is, trigger a signal".4. This clearly needs, at any point, the value of the
execution price of the market order in #2, the timestamp of #2 5.Finally the
rule that triggers the market sell order described in #3 would need to know the
existing position size as well.
I am not quite sure how to extract these state variables to include in the
signal and in the rule. Any help on this would be appreciated.
Thanks in advance.
On Tuesday, February 13, 2018, 12:42:07 PM GMT+5:30, Sanjay Mansabdar
I am not sure how to reply to digest messages in the thread, so apologies in
advance for errors
@Brian, I think there is no error with the implementation as it stands of stop
limit orders. However IMHO stop loss logic is not necessarily the same thing as
stop limit orders and perhaps needs to be thought of separately. I will try and
follow the route you have suggested.
[[alternative HTML version deleted]]
R-SIG-Finance@r-project.org mailing list
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should