[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] brain isn't firing what am i missing



PureBytes Links

Trading Reference Links

Hi I am kind of new to AMI and am trying to modify AFL "Lunar Phase". 
Instead of moons I am loading vertical bars (styleHistogram) and that 
has worked nicely, my problem is that I would like the bars to load 
Blue Green Red Orange and then repeat Blue Green ect. and what I am 
getting is ALL Orange bars or all Blue bars or endless loop Errors.

I thought that maybe it was storing the dates in an array and then 
plotting all of the dates at the same time so I tried [i]. I have 
tried putting "{" brace before each IF and all of the "}" closed 
braces at the end thinking that once it hits it would move on. I used 
to write a little in Paradox so I have a little knowledge.(and that's 
where I went wrong) Thanx 
Any ideas? or if you can point me in the right direction I would 
appreciate it.
Thanks
Kim
mytakeismine

_SECTION_BEGIN("moonlines");
// start of dummy code to get a demonstrable display 
Plot(Close, "Close", colorBlack, styleCandle); 

TZ=Param("Your local Time Zone? [-12 to +12hrs]",2, -12,12,1);

// Lunar cycle
LunarMonth=29.530589;
Offset=7.254621;

// Calendar }
leap=frac(Year( )/4)==0 AND frac(Year()/ 100)!=0 OR frac(Year()/ 400)
==0;
y=Year()*365+ int(Year( )/4)-int( Year()/100) +int(Year( )/400);


m=

IIf(Month()==2,31-leap,
IIf(Month()==3,59,
IIf(Month()==4,90,
IIf(Month()==5,120,
IIf(Month()==6,151,
IIf(Month()==7,181,
IIf(Month()==8,212,
IIf(Month()==9,243,
IIf(Month()==10,273,
IIf(Month()==11,304,
IIf(Month()==12,334, -leap)))))))))));
for( i = 1; i < 5; i++ ) 

if( i == 1)
{
mooncolor=colorBlue;
}
else
if ( i == 2)
{
mooncolor=colorGreen;
}
else

if ( i == 3)
{
mooncolor=colorRed;
}
else

if ( i == 4)
{
mooncolor=colorOrange;
}

CurrentDay=y+m+Day()-TZ/ 24-Offset;

// Full Moon }
FM=frac(CurrentDay/ LunarMonth) ;
FM=PeakBars( FM, 1, 1)==0;

FullMoon=FM==1;

Plot(FullMoon,"FullMoon",mooncolor,styleHistogram|styleThick| 
styleOwnScale ); 
 

_SECTION_END();


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 2/12/2007 1:23 PM