Hi, I want to draw 2 lines for 2 indicators in one window, but I could not do it. Here is my code, could anyone help me? thanks a lot!
Inserted Code
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
string short_name = "Typical price is running!";
IndicatorShortName(short_name);
SetIndexBuffer(0,ExtMapBuffer2);
//----
return(1);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
double x,plow,phigh,tprice;
Comment("Hi! I'm here on the main chart windows!");
//---- main calculation loop
while(pos>0)
{
x = (iOpen(NULL,NULL,pos) + iHigh(NULL,NULL,pos) + iLow(NULL,NULL,pos) + 2.0*iClose(NULL,NULL,pos))/5.0;
plow=2.0*x-iHigh(NULL,NULL,pos);
phigh=2.0*x-iLow(NULL,NULL,pos);
tprice=(plow+phigh)/2.0;
ExtMapBuffer1[pos-1]= tprice;
ExtMapBuffer2[pos-1]= plow;
pos--;
}
//----
return(0);
}