Hello,

 

I am trying to write a rule for a moving average over values over the last minute using fusion.  In general I can’t seem to locate a detailed resource for authoring syntax for these types of rules or rules in general, but specifically, I tried to modify something from the fusion documentation for my purposes using the StockTicker fusion sample.  Here is the rule entry I aded to the broker.drl:

 

rule "Alert when moving average goes below 50"

when

    Number( doubleValue > 127 ) from accumulate(

        StockTick( symbol == "ORCL", $price: price ) over window:time( 1m ),

        average( $price ) )

then

    System.out.println("moving average has gone beyone moving average");

End

 

I basically want to be alerted any time the moving average for ORCL moves above 127 (or whatever criteria I set…I picked that based on the sample data the sample fusion project uses), but it doesn’t seem to be working. 

 

I guess if I could locate the definitave samples or guide for authoring these types of rules I could use that, but it’s very difficult to piece together how to author rules utilizing fusion features based on isolated snippets from the fusion guide.

 

Can anyone point me to some reasources for learning rule authoring, especially for taking advantage of the fusion features.

 

Thanks,


Chris