Simple indicator

 

Good day.


I'm rather new with MT4, but have been an programmer 4 a while.

I just want to know how to I put and up/down arrow where the "IF" are true.


Eg... if x=y.. then put and up/down arrow at that point.


I can put arrow in the "past" before the expert start running, but I would like to put one after the expert has started.

For now I would be happy If I can put an arrow on every bar. Or just some inicator. Even lines or and smily face. Arrows would be nice.


Any help would be very appreciated.


Tnx

 

I can put arrow in the "past" before the expert start running, but I would like to put one after the expert has started.

Same method is used. Show your code.

 
phy:

Same method is used. Show your code.

Good day. Here is the code. I really appreciate your time to have a look at this.


int start()
{
//----
double PriceClose, PriceClosePrev, BandTop1;
double BandBot1, BandTop2, BandBot2;
double BandTop1Prev, BandBot1Prev, BandTop2Prev;
double BandBot2Prev, MACD, MACDPrev,arrowCount;
int cnt, ticket, total;
string say, say2,name,name2;
double say3;
BandTop1=iBands(NULL,0,26,1,0,PRICE_CLOSE,MODE_UPPER,0);
BandTop2=iBands(NULL,0,26,2,0,PRICE_CLOSE,MODE_UPPER,0); //This is the top
BandBot1=iBands(NULL,0,26,1,0,PRICE_CLOSE,MODE_LOWER,0);
BandBot2=iBands(NULL,0,26,2,0,PRICE_CLOSE,MODE_LOWER,0); // This should be the bottom


say3=BandTop2-BandBot2;

say=BandBot2;
say2=BandTop2;
say2=BandTop2-BandBot2;





for(int i=200;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);

}


i=0;

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);


ObjectCreate("signal",OBJ_LABEL,0,0,0,0,0);
ObjectSet("signal",OBJPROP_XDISTANCE,0);
ObjectSet("signal",OBJPROP_YDISTANCE,50);
ObjectSetText("signal",i,14,"Tahoma",Gold);



//----
return(0);
}

 

Your object naming naming logic is broken.

 
phy:

Your object naming naming logic is broken.

Good day.


I'm sorry I must not be as smart as I think I am. I've chop and changed most of the code and made an huge mess!. Would it be possible to show me the code / function. eg. PUTARROW;

then in the function would be function Putarrow { The code };


Thanks would really help. If I have code that works I can then take it from there. All I need is the Rosetta stone.


Thanks again for your help.

 
int start()
{
//----
double PriceClose, PriceClosePrev, BandTop1;
double BandBot1, BandTop2, BandBot2;
double BandTop1Prev, BandBot1Prev, BandTop2Prev;
double BandBot2Prev, MACD, MACDPrev,arrowCount;
int cnt, ticket, total;
string say, say2,name,name2;
double say3;
BandTop1=iBands(NULL,0,26,1,0,PRICE_CLOSE,MODE_UPPER,0);
BandTop2=iBands(NULL,0,26,2,0,PRICE_CLOSE,MODE_UPPER,0); //This is the top 
BandBot1=iBands(NULL,0,26,1,0,PRICE_CLOSE,MODE_LOWER,0);
BandBot2=iBands(NULL,0,26,2,0,PRICE_CLOSE,MODE_LOWER,0); // This should be the bottom
say3=BandTop2-BandBot2;
say=BandBot2;
say2=BandTop2;
say2=BandTop2-BandBot2;

for(int i=200;i>=0;i--){
   name = "Up"+i;
   if(ObjectFind(name) != -1) ObjectDelete(name);
   name2 = "Dn"+i;
   if(ObjectFind(name2) != -1) ObjectDelete(name2);
}
for(int i=200;i>=0;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);
}


 
phy:

Hello. Thanks for the Rosetta stone. I sat a while, but figured out how it works and have written my first semi successful robot.

Thanks again. :)

Reason: