by sunshine » Wed Aug 31, 2011 3:08 am
The function core.crossesOver should be called in the Update function. So how it will work depends on how the Update function is called.
If you use core.crossesOver in the Update function in your indicator/strategy, then the cross condition will be checked every time when a new bid or ask price appears. Note that you must call cci:update before calling core.crossesOver.
1) in case the strategy uses the ExtSubscribe function of helper.lua to subscribe to tick history, then it will be checked every time when a new tick is received.
2) in case the strategy uses the ExtSubscribe function of helper.lua to subscribe to bar history, then it will be checked every time when a first tick after the most recently closed candle is received.
So, if you check the condition on each tick, then you'll get a signal at once after crossing.
If you check the condition once per hour, you'll get a signal after the period is completed in case there is crossing in this period.
I hope this will help.