Please help In color change and added search with many thanks

/*Developed by Tudor Marcelin - Art Invest*/

n=10; /*period*/

A=0;
M=0;
D=0;

for( i = 0; i < 10; i=i+1 ) 
{

A=IIf(Ref(Close, - i)>Ref(Close, - i-1), A+(Ref(Close, - i)/Ref(Close, - i-1))-1,A);

M=IIf(Ref(Close, - i)==Ref(Close, - i-1), M+1/n,M);

D=IIf(Ref(Close, - i)<Ref(Close, - i-1), D+(Ref(Close, - i-1)/Ref(Close, - i))-1,D);

} 
ASI=IIf (D+M/2==0, 100, 100-100/(1+(A+M/2)/(D+M/2)));


Plot(ASI,"ASI10",colorBlue,8); 

Plot(50,"",colorBlack,styleLine);
PlotGrid(70,colorWhite); 
PlotGrid(30,colorWhite); 
PlotGrid(0,colorWhite); 
PlotGrid(100,colorWhite); 

GraphXSpace = 3;

The color is green in height and red in the descent

@m3ele, as you appear to be "new" to the forum, here are a few links that will help you getting started:

How to ask a good question?
How do I debug my formula?

Additionally, you should spend some time searching.

As you search, you will find that the posts that get the most/best help are ones that show the original poster's work, and where they are having difficulty.

If you are also very new to AmiBroker/AFL, then you will have to spend lots of time learning.
Additionally, as you search and learn, you will see that CODE should be posted in the Code Tags (</>), so people wanting to help can quickly and easily grab a copy of your code to test.

Last but not least, RTM - Read the Manual. Make sure you understand the code you are using.

The helpful hint here is to look up the "Plot" command, and see if you can solve your color issue. If you can - Great. If not, pose a direct question relating to your code (posted in code blocks) and you will usually have someone willing to help you out.

3 Likes