[R-SIG-Finance] Custom indicator for Quantstrat (Fractals by Bill Williams)

Joshua Ulrich josh.m.ulrich at gmail.com
Fri Jul 3 05:51:44 CEST 2015


Please don't cross-post: http://quant.stackexchange.com/q/18634/56

At minimum, tell people you're doing it so they don't possibly expend
their valuable effort trying to answer a question that was answered on
another forum they do not follow.


On Thu, Jul 2, 2015 at 10:03 PM, daneedwards1 <daneedwards1 at hotmail.com> wrote:
> Thanks both, you answered my question. I'll read your presentations again.
> Quantstrat works different to what I've used before, but I like it. Modular which is good
>
>
> Sent from Samsung MobileThanks both, you answered my question. I'll read your presentations again. again.
> Quantstrat works different to what I've used before, but I like it. Modular which is good
>
>
> Sent from Samsung Mobile
>
> -------- Original message --------
> From: "Brian G. Peterson" <brian at braverock.com>
> Date: 07/03/2015  11:39  (GMT+10:00)
> To: r-sig-finance at r-project.org
> Subject: Re: [R-SIG-Finance] Custom indicator for Quantstrat (Fractals by Bill Williams)
>
> On 07/02/2015 06:44 PM, Dane Edwards wrote:
>> Thanks Ilya, does the indicator function get called for every row (like esignal, ninjatrader)  in the xts when the apply strategy function is called? or is the indicator function called once?
>> i'm thinking now that the indicator column is calculated before applystrategy is ran, is this correct?
>
>
> This is covered in the documentation.
>
> You are certainly welcome to add a column or columns to your data before
> calling applyStrategy, but you don't need to do that.
>
> You indicator and signal functions are presumed to be path-independent.
>   They should return an xts time series object of the same length as the
> input data.
>
> It is most efficient to write vectorized indicators or signals, but you
> may write a loop if you like, it will just be slower.
>
> Regards,
>
> Brian
>
>>> From: Ikipnis at grahamcapital.com
>>> To: daneedwards1 at hotmail.com; r-sig-finance at r-project.org
>>> Subject: RE: [R-SIG-Finance] Custom indicator for Quantstrat (Fractals by Bill       Williams)
>>> Date: Thu, 2 Jul 2015 12:42:43 +0000
>>>
>>> Indicators are just functions like any other R function. EG the quantstrat demos use a lot of the TTR functions, but those TTR are functions are just R functions themselves.
>>>
>>> -----Original Message-----
>>> From: R-SIG-Finance [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Dane Edwards
>>> Sent: Thursday, July 02, 2015 8:25 AM
>>> To: r-sig-finance at r-project.org
>>> Subject: [R-SIG-Finance] Custom indicator for Quantstrat (Fractals by Bill Williams)
>>>
>>> Hi, how do i create a custom indicator for quantmod / quantstrat. I'm trying to create a Fractal indicator (Bill Williams), the indicator needs to look back 5 days to calculate if a fractal has happened.
>>> http://www.winnersedgetrading.com/how-to-trade-the-fractal-indicator/
>>> This is in MQL language
>>>   //----Fractals up      FractalFound=false;      dCurrent=High[i];      if(dCurrent>High[i+1] && dCurrent>High[i+2] && dCurrent>High[i-1] && dCurrent>High[i-2])        {         FractalFound=true;        }//i is the current day
>>>
>>> I'm not sure how the indicators work in quantstrat, in most backtesting software it loops through each day and calculates the indicator (for each day you then look back 5 days), does quanstrat do the same or do i need to write my own looping function in the indicator?
>>> Thanks!!
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list