quantstrat parameter prefer = 'Open" question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

quantstrat parameter prefer = 'Open" question

Andre_Mikulec
Hello,

I am using quantstrat.

I have noticed that the prefer argument is acceptable to be sent in many functions.

I would like make a 'decision to buy' based on yesterday's Closing price.
I would like to *actually buy* this morning at today's Opening price.

In https://github.com/braverock/quantstrat
based on what I have seen, and debugged/traced through
in the demos and sandbox directories' *.R files
the case seems that ( in for example demo/faber.R )

1.
I *would not* send the parameter "prefer = 'Open'"
to add.rule.
So my add.rule would look like add.rule(. . . sigCrossover . . .)

2.
I *would* send the parameter "prefer = 'Open'"
to applyStrategy
So my applyStrategy would look like applyStrategy(. . . , prefer = 'Open', . . .)

Are 1. and 2. true?
If not true, what would I need to do?
What function calls with "prefer = 'Open'" would be needed?

Thanks,
Andre Mikulec
[hidden email]



        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.
Reply | Threaded
Open this post in threaded view
|

Re: quantstrat parameter prefer = 'Open" question

Ilya Kipnis
They go in your rules, not in the applyStrategy call, to my knowledge.

On Mon, Jan 29, 2018 at 2:30 PM, Andre Mikulec <[hidden email]>
wrote:

> Hello,
>
> I am using quantstrat.
>
> I have noticed that the prefer argument is acceptable to be sent in many
> functions.
>
> I would like make a 'decision to buy' based on yesterday's Closing price.
> I would like to *actually buy* this morning at today's Opening price.
>
> In https://github.com/braverock/quantstrat
> based on what I have seen, and debugged/traced through
> in the demos and sandbox directories' *.R files
> the case seems that ( in for example demo/faber.R )
>
> 1.
> I *would not* send the parameter "prefer = 'Open'"
> to add.rule.
> So my add.rule would look like add.rule(. . . sigCrossover . . .)
>
> 2.
> I *would* send the parameter "prefer = 'Open'"
> to applyStrategy
> So my applyStrategy would look like applyStrategy(. . . , prefer = 'Open',
> . . .)
>
> Are 1. and 2. true?
> If not true, what would I need to do?
> What function calls with "prefer = 'Open'" would be needed?
>
> Thanks,
> Andre Mikulec
> [hidden email]
>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- 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 go.
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.
Reply | Threaded
Open this post in threaded view
|

Re: quantstrat parameter prefer = 'Open" question

Andre_Mikulec

Here "prefer = 'Open' is  shown
https://github.com/braverock/quantstrat/blob/b32907739c1aca80cb9a49de79a980e1b9922bc5/demo/rocema.R

  # * using prefer='Open' on next bar
  applyStrategy(s, p, parameters=list(nEMA=.ema,nROC=.roc,nTREND=.trend), verbose = FALSE, prefer='Open')


Here "prefer = High/Low" are shown
https://timtrice.github.io/backtesting-strategies/stop-loss.html#add-rules-1

  add.rule(. . ., prefer = "High", . . .)


Thanks,
Andre Mikulec
[hidden email]


________________________________
From: Ilya Kipnis <[hidden email]>
Sent: Monday, January 29, 2018 2:45 PM
To: Andre Mikulec
Cc: [hidden email]
Subject: Re: [R-SIG-Finance] quantstrat parameter prefer = 'Open" question

They go in your rules, not in the applyStrategy call, to my knowledge.

On Mon, Jan 29, 2018 at 2:30 PM, Andre Mikulec <[hidden email]<mailto:[hidden email]>> wrote:
Hello,

I am using quantstrat.

I have noticed that the prefer argument is acceptable to be sent in many functions.

I would like make a 'decision to buy' based on yesterday's Closing price.
I would like to *actually buy* this morning at today's Opening price.

In https://github.com/braverock/quantstrat
based on what I have seen, and debugged/traced through
in the demos and sandbox directories' *.R files
the case seems that ( in for example demo/faber.R )

1.
I *would not* send the parameter "prefer = 'Open'"
to add.rule.
So my add.rule would look like add.rule(. . . sigCrossover . . .)

2.
I *would* send the parameter "prefer = 'Open'"
to applyStrategy
So my applyStrategy would look like applyStrategy(. . . , prefer = 'Open', . . .)

Are 1. and 2. true?
If not true, what would I need to do?
What function calls with "prefer = 'Open'" would be needed?

Thanks,
Andre Mikulec
[hidden email]



        [[alternative HTML version deleted]]

_______________________________________________
[hidden email]<mailto:[hidden email]> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.
Reply | Threaded
Open this post in threaded view
|

Re: quantstrat parameter prefer = 'Open" question

Andre_Mikulec
In reply to this post by Ilya Kipnis

Here "prefer = 'Open' is  shown
https://github.com/braverock/quantstrat/blob/b32907739c1aca80cb9a49de79a980e1b9922bc5/demo/rocema.R

  # * using prefer='Open' on next bar
  applyStrategy(s, p, parameters=list(nEMA=.ema,nROC=.roc,nTREND=.trend), verbose = FALSE, prefer='Open')

Here "prefer = High/Low" are shown
https://timtrice.github.io/backtesting-strategies/stop-loss.html#add-rules-1

  add.rule(. . ., prefer = "High", . . .)


Thanks,
Andre Mikulec
[hidden email]


________________________________
From: Ilya Kipnis <[hidden email]>
Sent: Monday, January 29, 2018 2:45 PM
To: Andre Mikulec
Cc: [hidden email]
Subject: Re: [R-SIG-Finance] quantstrat parameter prefer = 'Open" question

They go in your rules, not in the applyStrategy call, to my knowledge.

On Mon, Jan 29, 2018 at 2:30 PM, Andre Mikulec <[hidden email]<mailto:[hidden email]>> wrote:
Hello,

I am using quantstrat.

I have noticed that the prefer argument is acceptable to be sent in many functions.

I would like make a 'decision to buy' based on yesterday's Closing price.
I would like to *actually buy* this morning at today's Opening price.

In https://github.com/braverock/quantstrat
based on what I have seen, and debugged/traced through
in the demos and sandbox directories' *.R files
the case seems that ( in for example demo/faber.R )

1.
I *would not* send the parameter "prefer = 'Open'"
to add.rule.
So my add.rule would look like add.rule(. . . sigCrossover . . .)

2.
I *would* send the parameter "prefer = 'Open'"
to applyStrategy
So my applyStrategy would look like applyStrategy(. . . , prefer = 'Open', . . .)

Are 1. and 2. true?
If not true, what would I need to do?
What function calls with "prefer = 'Open'" would be needed?

Thanks,
Andre Mikulec
[hidden email]



        [[alternative HTML version deleted]]

_______________________________________________
[hidden email]<mailto:[hidden email]> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- 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 go.