Unfortunately I had already tried that but it doesn't work if market regimes are more than 2 (for instance bull low vol, bull high vol, bear high vol and bear low vol).
Thanks for your suggestion anyway, Paolo --- In [email protected], "Steve Dugas" <sjdu...@...> wrote: > > Hi - Try this way > > Buy = IIF( C > MA( C, 200 ), BullBuyCond, BearBuyCond ); > Similar for sell, short, cover. > > > ----- Original Message ----- > From: "Paolo" <pcavat...@...> > To: <[email protected]> > Sent: Thursday, June 24, 2010 2:07 PM > Subject: [amibroker] buy/sell rules for different market regimes > > > > I'm missing how to code a very simple idea...basically I need to have > > different buy/sell rules according to different market regimes (for > > instance Bull and Bear markets). > > > > I tried somethink like the below code but it doesn't work since if/else > > statements require array subscript and therefore for cycle which I'd like > > to avoid. > > > > if ( C > MA(C, 200) ) //Bull Market > > { > > Buy = ...myBullBuyCond; > > Sell = ...myBullSellCond; > > Short = ...myBullShortCond; > > Cover = ...myBullCoverCond; > > } > > else //Bear Market > > { > > Buy = ...myBearBuyCond; > > Sell = ...myBearSellCond; > > Short = ...myBearShortCond; > > Cover = ...myBearCoverCond; > > } > > > > > > Any hints is appreciated, > > > > Paolo > > > > > > > > ------------------------------------ > > > > **** IMPORTANT PLEASE READ **** > > This group is for the discussion between users only. > > This is *NOT* technical support channel. > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > http://www.amibroker.com/feedback/ > > (submissions sent via other channels won't be considered) > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > Yahoo! Groups Links > > > > > > > > >
