Red and White - page 2

 

Hmmm.........Whats teh solution then. I simple want to show red/white arrows and signal return against the following coditions

if(MD2>0&&MD2<=MD3&&MD1>MD2){return(1);}//V Signal above zero
//Check Shorts
if(MD2<0&&MD2>MD3&&MD1<MD2){return(-1);}//V' Signal below zero

 

useing pos parameter in you function DailySignal(int pos)

i think like so:

int DailySignal(int pos)
{
double MD1,MD2,MD3,MS1,MS2,MS3;
MD1=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_MAIN,1+pos);
MD2=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_MAIN,2+pos);
MD3=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_MAIN,3+pos);
MS1=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1+pos);
MS2=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,2+pos);
MS3=iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,3+pos);
//Check Longs
if(MD1<0&&MD2<MS2&&MD1>MS1){return(1);}//Signal Crossing Below Zero
if(MD2<0&&MD2<=MD3&&MD1>MD2){return(1);}//V Signal below zero
if(MD2>0&&(MD2<=MD3&&MD1>MD2)){return(1);}//V Signal above zero
//Check Shorts
if(MD1>0&&MD2>MS2&&MD1<MS1){return(-1);}
if(MD2>0&&MD2>MD3&&MD1<MD2){return(-1);}//v' Signal above zero
if(MD2<0&&(MD2>=MD3&&MD1<MD2)){return(-1);}
return(0);
}

I come from china,so my english is poor

 

Hi there.

I don't know whether you resloved the problem, but I think there's only one thing you need to change in your code for it to work:

Instead of:

ObjectCreate(DownName, OBJ_ARROW, 0, Time[0], Open[0]+20*Point); //draw an up arrow
you should write:

ObjectCreate(DownName, OBJ_ARROW, 0, Time[i], Open[i]+20*Point); //draw an up arrow

That is, you have to use [i] and not [0]. It should work, and there's no problem with using this variable.

The following code works perfectly well:

string name, name2;

int init(){
ObjectsDeleteAll();
return(0);
}
int start(){

for(int i=10;i>1;i--){
name = "Up"+i;
ObjectCreate(name, OBJ_ARROW, 0, Time[i], High[i]+20*Point); //draw an up arrow
ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
ObjectSet(name, OBJPROP_COLOR,Lime);

name2 = "Dn"+i;
ObjectCreate(name2,OBJ_ARROW, 0, Time[i], Low[i]-20*Point); //draw a dn arrow
ObjectSet(name2, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(name2, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);
ObjectSet(name2, OBJPROP_COLOR,Red);

}
return(0);
}

Hope I helped a bit.

Good luck!

Reason: