[amibroker] Is it possible to add an indicator that includes a function more than 1 time?

 

Hello,

I am trying to add to a chart my own indicator a couple times as Overlay. To get a cleaner code I am including inside the indicator a function, but when i add it more than one time I get an error.

It can be reproduced including for example the indicator "Market Facilitation Index" two times as Overlay.



The Market facilitation index code is as follows:


function MarketFacilitationIndex()
{
  return ( High - Low )/Volume;
}

mfac = MarketFacilitationIndex();
rm = ROC( mfac, 1 );
rv = ROC( Volume, 1 );

Color = IIf( rm > 0 AND rv > 0, colorGreen,
         IIf( rm < 0 AND rv < 0, colorBlue,
         IIf( rm > 0 AND rv < 0, colorGrey40,
         IIf( rm < 0 AND rv > 0, colorRed, colorLightGrey ) ) ) );

Plot( mfac, _DEFAULT_NAME(), Color, ParamStyle("Style", styleHistogram | styleThick, maskHistogram ) );



So it would seem like the double definition of the function gives problems when added two times to the chart.


Is there any way to overcome this?


It doesn't matter if the Market Factilitation Index makes or not sense to have it two times. I could have to add a couple complex Moving averages whose definition need some complex functions.


Thanks in advance,


__._,_.___

Posted by: dpellon@gmail.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
**** 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/


.

__,_._,___


EmoticonEmoticon