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

Re: [amibroker] (unknown)



PureBytes Links

Trading Reference Links

Sc

How about this code as an example of color bars:

/* The first set of lines are to set up the color coding for
the price bars */

outsidebar = outside();
insidebar = H <= Ref(H,-1) and L >= Ref(L,-1);
upbar = H > ref(H,-1) and L >= ref(L, -1);
downbar = L < ref(L,-1) and H <= ref(H,-1);
barcolor=iif(outsidebar, 1, iif(downbar, 4, iif(upbar,5, 6) ) );

graph1=C;
graph1style=64;
graph1barcolor=barcolor;

example chart:  see attached

Steve


At 09:11 PM 9/9/2001 +0000, you wrote:
Hi,

Bar color is a Joke !?

if buy is binary "0" or "1", when buy is 1 , I just
want to color the 
bar.
all the bar have the same color

/* Colourized price bars drawn here */
graph0 = close;
graph0style = 128;
barcolor = IIF( buy, 4, 0 );
graph0barcolor = ValueWhen( barcolor != 0, barcolor );


Sc



/*Gann HiLo3*/

pds=3;
Hl=IIf(CLOSE>Ref(Ma(H,pds),-1),
/*then*/ 1,
/*else*/ IIf(CLOSE<Ref(Ma(L,pds),-1),
/*then*/ -1,
/*else*/ 0));
Hv=ValueWhen(HL != 0,HL,1);
Hilo3=IIf(Hv=-1,
/*then*/Ma(H,pds),
/*else*/Ma(L,pds));


/*Gann HiLo20*/

pds=20;
Hl=IIf(CLOSE>Ref(Ma(H,pds),-1),
/*then*/ 1,
/*else*/ IIf(CLOSE<Ref(Ma(L,pds),-1),
/*then*/ -1,
/*else*/ 0));
Hv=ValueWhen(HL != 0,HL,1);
Hilo20=IIf(Hv=-1,
/*then*/Ma(H,pds),
/*else*/Ma(L,pds));



/*Gann HiLo50*/

pds=50;
Hl=IIf(CLOSE>Ref(Ma(H,pds),-1),
/*then*/ 1,
/*else*/ IIf(CLOSE<Ref(Ma(L,pds),-1),
/*then*/ -1,
/*else*/ 0));
Hv=ValueWhen(HL != 0,HL,1);
Hilo50=IIf(Hv=-1,
/*then*/Ma(H,pds),
/*else*/Ma(L,pds));




Trend=Hilo20>Hilo50;
Retrace=c<hilo3 and  H< Ref(H,-1)
AND L< Ref(L,-1);
Entry= Trend AND retrace ;
Buy=Ref(Entry,-1) AND H>(Ref(H,-1)*1.0025);
Buy=buy==1 and ref(buy,-1)==0;

/*stoploss*/

Red=cross(hilo3,c);
StopLoss1= valuewhen(buy , 
LLV(L,peakbars(red,1,1)+1));
StopLoss2= valuewhen(buy , 
LLV(L,peakbars(red,1,2)+1));
Stoploss=max(stoploss1,stoploss2) *0.99;

Entryprice=iif(Buy,close,0);
Risk= IIf(Entryprice!=0,(entryprice-stoploss)
/stoploss,0)*100;

Buy=Buy!=0 and risk!=0 and Risk<12;
graph1=Buy;

/* Colourized price bars drawn here */



Yahoo! Groups
Sponsor


Your use of Yahoo! Groups is subject to the
Yahoo! Terms of
Service. 
Attachment:
colorbar example image.gif

Attachment: Description: "Description: GIF image"