after i adding the code in to my indicator
when compiling, it shown the message " '\end_of_program' - unbalanced left parenthesis ".
is it anything wrong there?
yes you have an error
if(ObjectFind(compass = W1_SELL); // 2 ((.................. and one ) // maybe adding one ) if(ObjectFind(compass = W1_SELL));
and more of those errors think also (compass = W1_SELL) has to be with ==
thanks, it is done, but now another problem.
it shown the message "'ObjectFind' - comparison expression expected"
what's wrong is it?
https://docs.mql4.com/basis/operations/relation
2 things wrong
I wrote also
and more of those errors think also (compass = W1_SELL) has to be with ==
and if you read the post of WHRoeder then it is
you have to look at the function ObjectFind https://docs.mql4.com/objects/ObjectFind
.
int ObjectFind( string name)like the example you could have done something as...
if(ObjectFind("line_object2")!=win_idx) return(0);
if(ObjectFind(compass) == W1_SELL) //do something
so compass has to be a string .... but ObjectFind(compass) is int so W1_SELL this way also
.....
thanks. And one last thing,
int signal () { int compass; double W1_SELL; double W1_BUY; double W1_NO; double D1_SELL; double D1_BUY; double D1_NO; double SMA_1 = iMA(NULL, PERIOD_W1, 1, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_2 = iMA(NULL, PERIOD_W1, 2, 0, MODE_SMA, PRICE_CLOSE, 0); double SMA_3 = iMA(NULL, PERIOD_W1, 3, 0, MODE_SMA, PRICE_CLOSE, 0); double SMA_4 = iMA(NULL, PERIOD_W1, 4, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_5 = iMA(NULL, PERIOD_D1, 5, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_6 = iMA(NULL, PERIOD_D1, 6, 0, MODE_SMA, PRICE_CLOSE, 0); double SMA_7 = iMA(NULL, PERIOD_D1, 7, 0, MODE_SMA, PRICE_CLOSE, 0); double SMA_8 = iMA(NULL, PERIOD_D1, 8, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_9 = iMA(NULL, PERIOD_H1, 9, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_10 = iMA(NULL, PERIOD_H1, 10, 0, MODE_SMA, PRICE_CLOSE, 0); double SMA_11 = iMA(NULL, PERIOD_H4, 11, 0, MODE_EMA, PRICE_CLOSE, 0); double SMA_12 = iMA(NULL, PERIOD_H4, 12, 0, MODE_SMA, PRICE_CLOSE, 0); if (SMA_1<SMA_4 && SMA_3<SMA_4) compass = W1_SELL ; if (SMA_1>SMA_4 && SMA_3>SMA_4) compass = W1_BUY ; if (SMA_1>SMA_4 && SMA_3<SMA_4) compass = W1_NO ; if (SMA_1<SMA_4 && SMA_3>SMA_4) compass = W1_NO ; if (SMA_5<SMA_8 && SMA_7<SMA_8) compass = D1_SELL ; if (SMA_5>SMA_8 && SMA_7>SMA_8) compass = D1_BUY ; if (SMA_5>SMA_8 && SMA_7<SMA_8) compass = D1_NO ; if (SMA_5<SMA_8 && SMA_7>SMA_8) compass = D1_NO ; ///-------------------------------------------------------------- if(ObjectFind(compass) == W1_SELL) { ObjectCreate("W1_SELL", OBJ_LABEL, 0, 0, 0); ObjectSetText("W1_SELL","W1 SELL COMPASS",10, "Arial", Sienna); ObjectSet("W1_SELL", OBJPROP_CORNER, 0); ObjectSet("W1_SELL", OBJPROP_XDISTANCE, 4); ObjectSet("W1_SELL", OBJPROP_YDISTANCE, 25); } if(ObjectFind(compass) == W1_BUY) { ObjectCreate("W1_BUY", OBJ_LABEL, 0, 0, 0); ObjectSetText("W1_BUY","W1 BUY COMPASS",10, "Arial", Sienna); ObjectSet("W1_BUY", OBJPROP_CORNER, 0); ObjectSet("W1_BUY", OBJPROP_XDISTANCE, 4); ObjectSet("W1_BUY", OBJPROP_YDISTANCE, 25); } if(ObjectFind(compass) == W1_NO) { ObjectCreate("W1_NO", OBJ_LABEL, 0, 0, 0); ObjectSetText("W1_NO","W1 NO COMPASS",10, "Arial", Sienna); ObjectSet("W1_NO", OBJPROP_CORNER, 0); ObjectSet("W1_NO", OBJPROP_XDISTANCE, 4); ObjectSet("W1_NO", OBJPROP_YDISTANCE, 25); } if(ObjectFind(compass) == D1_BUY) { ObjectCreate("D1_BUY", OBJ_LABEL, 0, 0, 0); ObjectSetText("D1_BUY","D1 BUY COMPASS",10, "Arial", Sienna); ObjectSet("D1_BUY", OBJPROP_CORNER, 0); ObjectSet("D1_BUY", OBJPROP_XDISTANCE, 4); ObjectSet("D1_BUY", OBJPROP_YDISTANCE, 45); } if(ObjectFind(compass) == D1_SELL) { ObjectCreate("D1_SELL", OBJ_LABEL, 0, 0, 0); ObjectSetText("D1_SELL","D1 SELL COMPASS",10, "Arial", Sienna); ObjectSet("D1_SELL", OBJPROP_CORNER, 0); ObjectSet("D1_SELL", OBJPROP_XDISTANCE, 4); ObjectSet("D1_SELL", OBJPROP_YDISTANCE, 45); } if(ObjectFind(compass) == D1_NO) { ObjectCreate("D1_NO", OBJ_LABEL, 0, 0, 0); ObjectSetText("D1_NO","D1 NO COMPASS",10, "Arial", Sienna); ObjectSet("D1_NO", OBJPROP_CORNER, 0); ObjectSet("D1_NO", OBJPROP_XDISTANCE, 4); ObjectSet("D1_NO", OBJPROP_YDISTANCE, 45); } return (0); }
it shown the message "Function "signal" is not referenced and will be removed from exp-file"
what wrong with that?
thanks. And one last thing,
it shown the message "Function "signal" is not referenced and will be removed from exp-file"
what wrong with that?
It means that you have coded a function "signal()" but you are not calling it anywhere, so it wont be a part of compiled file and wont be called while running the indicator. If you want to use this function, then you need to call it somewhere...
Just a quick question - why these object are not of same datatype.?? "compass, W1_SELL, W1_BUY, W1_NO, D1_SELL, D1_BUY, D1_NO" .

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
after i adding the code in to my indicator
when compiling, it shown the message " '\end_of_program' - unbalanced left parenthesis ".
is it anything wrong there?