#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red extern bool Alerts = TRUE; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { return (0); } int deinit() { return (0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- if( Alerts==TRUE) { if ( Close[4]>Open[4] && Close[3]>Open[3]&& Close[2]>Open[2]&& Close[1]<Open[2] ) { string SELLSIGNAL="SELLSIGNAL"+(string)Time[1]; if(ObjectFind(0,SELLSIGNAL)!=0) { ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],Low[1]-(Period()*Point*2)); ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5); ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,242); ObjectSet(SELLSIGNAL, OBJPROP_COLOR,Red); ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP); } else if ( Close[4]<Open[4] && Close[3]<Open[3]&& Close[2]<Open[2]&& Close[1]>Open[2]) { string BUYSIGNAL="BUYSIGNAL"+(string)Time[1]; if(ObjectFind(0,BUYSIGNAL)!=0) { ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,Time[1],High[1]+(Period()*Point*2)); ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue); ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,241); ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10); ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM); } } } } //---- return(0); }
int start() { //---- if( Alerts==TRUE) { if ( Close[4]>Open[4] && Close[3]>Open[3]&& Close[2]>Open[2]&& Close[1]<Open[2] ) { string SELLSIGNAL="SELLSIGNAL"+(string)Time[1]; if(ObjectFind(0,SELLSIGNAL)!=0) { ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],Low[1]-(Period()*Point*2)); ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5); ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,242); ObjectSet(SELLSIGNAL, OBJPROP_COLOR,Red); ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP); } else if ( Close[4]<Open[4] && Close[3]<Open[3]&& Close[2]<Open[2]&& Close[1]>Open[2]) { string BUYSIGNAL="BUYSIGNAL"+(string)Time[1]; if(ObjectFind(0,BUYSIGNAL)!=0) { ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,Time[1],High[1]+(Period()*Point*2)); ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue); ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,241); ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10); ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM); } } } } //---- return(0); }Check the positioning of your curly braces
have adjusted it but the problem still persist. and i want it to be print / draw arrow like attached image below #property indicator_chart_window #property indicator_color1 Green #property indicator_color2 Red extern bool Alerts=TRUE; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { return (0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //---- if(Alerts==TRUE) { if(Close[4]>Open[4] && Close[3]>Open[3] && Close[2]>Open[2] && Close[1]<Open[2]) { Alert ("INDICATOR: ",Symbol()+" "+Period()+": Sell Alert @ "+DoubleToStr(Bid,Digits)); string SELLSIGNAL="SELLSIGNAL"+(string)Time[1]; if(ObjectFind(0,SELLSIGNAL)!=0) { ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],High[1]); ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5); ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,242); ObjectSet(SELLSIGNAL,OBJPROP_COLOR,Red); ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP); } if(Close[3]<Open[3] && Close[2]<Open[2] && Close[1]>Open[2]) { Alert ("INDICATOR: ",Symbol()+" "+Period()+": Buy Alert @ "+DoubleToStr(Ask,Digits)); string BUYSIGNAL="BUYSIGNAL"+(string)Time[1]; if(ObjectFind(0,BUYSIGNAL)!=0) { ObjectCreate(BUYSIGNAL,OBJ_ARROW_BUY,0,Time[1],Low[1]); ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,5); ObjectSet(BUYSIGNAL,OBJPROP_ARROWCODE,241); ObjectSet(BUYSIGNAL,OBJPROP_COLOR,Green); ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM); } } } } //---- return(prev_calculated); } //+------------------------------------------------------------------+
IMAGE HERE
k, can u please give me a CORRECTION .
younghadiz:
k, can u please give me a CORRECTION .
k, can u please give me a CORRECTION .
I could just correct your bracing, but next time you will make the same mistake again and again.
It is a better learning experience for you to work through the logic of your code yourself and find out where the braces should be.
could you please indicate where i made mistake please , because i couldnt find it.thanks a lot.
younghadiz:
could you please indicate where i made mistake please , because i couldnt find it.thanks a lot.
could you please indicate where i made mistake please , because i couldnt find it.thanks a lot.
Go back 5 or so posts and you will see that I indicated the braces controlled by
if ( Close[4]>Open[4] && Close[3]>Open[3]&& Close[2]>Open[2]&& Close[1]<Open[2] )
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
have tried to print the arrows but all to no avail .
please help out .
these are codes belo.
#property indicator_chart_window#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
extern bool Alerts = TRUE;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
return (0);
}
int deinit() {
return (0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if( Alerts==TRUE)
{
if ( Close[4]>Open[4] && Close[3]>Open[3]&& Close[2]>Open[2]&& Close[1]<Open[2] )
{
string SELLSIGNAL="SELLSIGNAL"+(string)Time[1];
if(ObjectFind(0,SELLSIGNAL)!=0)
{
ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,Time[1],Low[1]-(Period()*Point*2));
ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5);
ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,242);
ObjectSet(SELLSIGNAL, OBJPROP_COLOR,Red);
ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP);
}
else if ( Close[4]<Open[4] && Close[3]<Open[3]&& Close[2]<Open[2]&& Close[1]>Open[2])
{
string BUYSIGNAL="BUYSIGNAL"+(string)Time[1];
if(ObjectFind(0,BUYSIGNAL)!=0)
{
ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,Time[1],High[1]+(Period()*Point*2));
ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue);
ObjectSet(SELLSIGNAL, OBJPROP_ARROWCODE,241);
ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10);
ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
}
}
}
}
//----
return(0);
}