TradeForexFx:
provide a background color for each pair (button) according to the relevant condition.
you want to colourise all button ?
If a pair meets the direction requirement based on the cross, that pair will be colored accordingly. Pairs with no direction according to the MA cross will remain the initial color.
direction requirement ?
void createButton(string name, string caption, int xpos, int ypos) { int window = WindowFind(UniqueID); ObjectCreate(name,OBJ_BUTTON,window,0,0); ObjectSet(name,OBJPROP_CORNER ,CORNER_LEFT_UPPER); ObjectSet(name,OBJPROP_XDISTANCE,xpos); ObjectSet(name,OBJPROP_YDISTANCE,ypos); ObjectSet(name,OBJPROP_XSIZE,XSize); ObjectSet(name,OBJPROP_YSIZE,YSize); ObjectSetText(name,caption,FSize,"Arial",Tncolor); ObjectSet(name,OBJPROP_FONTSIZE,FSize); ObjectSet(name,OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet(name,OBJPROP_COLOR,Tncolor); ObjectSet(name,OBJPROP_BGCOLOR,fastAboveSlowMa(caption)); ObjectSet(name,OBJPROP_BACK,Transparent); ObjectSet(name,OBJPROP_BORDER_COLOR,Dcolor); ObjectSet(name,OBJPROP_STATE,false); ObjectSet(name,OBJPROP_HIDDEN,true); } color fastAboveSlowMa(string c_Symbol){ double fy=iMA(c_Symbol,0,10,0,MODE_SMA,PRICE_MEDIAN,0); double sy=iMA(c_Symbol,0,20,0,MODE_SMA,PRICE_MEDIAN,0); if(fy>sy){return(clrBlue); }else return(clrRed); }
There was a exe file posted by you (Samuel), along with a photo. Also the relevant source code, which was more elaborate.
I had responded with the fact that the indicator was not working properly along with a jpg file. Dont see any more of these posts, wonder what is going on.
Anyways, will appreciate if the indicator is posted in a complete working form. I want it to be monitoring all the forex pairs simultaneously, with signals coming in the form of red/blue colors.
Thanks
There was a exe file posted by you (Samuel), along with a photo. Also the relevant source code, which was more elaborate.
I had responded with the fact that the indicator was not working properly along with a jpg file. Dont see any more of these posts, wonder what is going on.
Anyways, will appreciate if the indicator is posted in a complete working form. I want it to be monitoring all the forex pairs simultaneously, with signals coming in the form of red/blue colors.
Thanks
It is not allowed to attach just compiled codes as these could contain something undesirable.
The other codes and images have been removed because they contain advertising material.
Your image has been removed for the same reason.
//+------------------------------------------------------------------+ #property copyright"Akinbowale-Samuel" #property indicator_separate_window #property indicator_buffers 0 #property strict extern string Symbols="AUDCAD;AUDCHF;AUDJPY;AUDNZD;AUDUSD;CADCHF;CADJPY;CHFJPY;EURAUD;EURCAD;EURCHF;EURGBP;EURJPY;EURNZD;EURUSD;GBPAUD;GBPCAD;GBPCHF;GBPJPY;GBPNZD;GBPUSD;NZDCHF;NZDJPY;NZDUSD;USDCAD;USDCHF;USDJPY"; extern string UniqueID = "SSig"; extern int ButtonsInARow = 14; extern int XShift = 5; extern int YShift = 0; extern int XSize = 75; extern int YSize = 20; extern int FSize = 10; extern color Bcolor = clrGainsboro; extern color Dcolor = clrDarkGray; extern color Tncolor = clrBlack; extern color Sncolor = clrRed; extern bool Transparent = false; extern color PairBuyColor = clrGreen; extern color PairSellColor = clrRed; extern int FastMa_1 = 5; extern int SlowMa_1 = 10; extern int MaMethod = MODE_EMA; extern int MaPrice = PRICE_CLOSE; string aSymbols[]; int OnInit() { IndicatorShortName(UniqueID); Symbols=StringTrimLeft(StringTrimRight(Symbols)); if(StringSubstr(Symbols,StringLen(Symbols)-1,1)!=";") Symbols=StringConcatenate(Symbols,";"); int s=0,i=StringFind(Symbols,";",s); string current; while(i>0) { current=StringSubstr(Symbols,s,i-s); ArrayResize(aSymbols,ArraySize(aSymbols)+1); aSymbols[ArraySize(aSymbols)-1]=current; s = i + 1; i = StringFind(Symbols,";",s); } int xpos=0,ypos=0,maxx=0,maxy=0; for(i=0; i<ArraySize(aSymbols); i++) { if(i>0 && MathMod(i,ButtonsInARow)==0) { xpos=0; ypos+=YSize+1; } createButton(UniqueID+":symbol:"+string(i),aSymbols[i],XShift+xpos,YShift+ypos); xpos+=XSize+1; } setSymbolButtonColor(); return(0); } void OnDeinit(const int reason) { switch(reason) { case REASON_CHARTCHANGE : case REASON_RECOMPILE : case REASON_CLOSE : break; default : { string lookFor = UniqueID+":"; int lookForLength = StringLen(lookFor); for (int i=ObjectsTotal()-1; i>=0; i--) { string objectName = ObjectName(i); if (StringSubstr(objectName,0,lookForLength) == lookFor) ObjectDelete(objectName); } } } } void createButton(string name, string caption, int xpos, int ypos) { int window = WindowFind(UniqueID); ObjectCreate(name,OBJ_BUTTON,window,0,0); ObjectSet(name,OBJPROP_CORNER ,CORNER_LEFT_UPPER); ObjectSet(name,OBJPROP_XDISTANCE,xpos); ObjectSet(name,OBJPROP_YDISTANCE,ypos); ObjectSet(name,OBJPROP_XSIZE,XSize); ObjectSet(name,OBJPROP_YSIZE,YSize); ObjectSetText(name,caption,FSize,"Arial",Tncolor); ObjectSet(name,OBJPROP_FONTSIZE,FSize); ObjectSet(name,OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSet(name,OBJPROP_COLOR,Tncolor); ObjectSet(name,OBJPROP_BGCOLOR,fastAboveSlowMa(caption)); ObjectSet(name,OBJPROP_BACK,Transparent); ObjectSet(name,OBJPROP_BORDER_COLOR,Dcolor); ObjectSet(name,OBJPROP_STATE,false); ObjectSet(name,OBJPROP_HIDDEN,true); } color fastAboveSlowMa(string c_Symbol){ double fy=iMA(c_Symbol,0,10,0,MODE_SMA,PRICE_MEDIAN,0); double sy=iMA(c_Symbol,0,20,0,MODE_SMA,PRICE_MEDIAN,0); if(fy>sy){return(clrBlue); }else return(clrRed); } void setSymbolButtonColor() { string lookFor = UniqueID+":symbol:"; int lookForLength = StringLen(lookFor); for (int i=ObjectsTotal()-1; i>=0; i--) { string objectName = ObjectName(i); if (StringSubstr(objectName,0,lookForLength) == lookFor) { string symbol = ObjectGetString(0,objectName,OBJPROP_TEXT); if (symbol != _Symbol) ObjectSet(objectName,OBJPROP_COLOR,Tncolor); else ObjectSet(objectName,OBJPROP_COLOR,Sncolor); } } } void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) { if (id==CHARTEVENT_OBJECT_CLICK && ObjectGet(sparam,OBJPROP_TYPE)==OBJ_BUTTON) { if (StringFind(sparam,UniqueID+":symbol:",0)==0) ChartSetSymbolPeriod(0,ObjectGetString(0,sparam,OBJPROP_TEXT),_Period); if (StringFind(sparam,UniqueID+":back:" ,0)==0) ObjectSet(sparam,OBJPROP_STATE,false); } } int start() { setSymbolButtonSignalColor(); return(0); } void setSymbolButtonSignalColor() { } //+------------------------------------------------------------------+
This is the code with the advertising removed.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
I have this indicator which works well for changing chart symbols.
I want to use the indicator for monitoring various pairs by a change of colors of the relevant button.
I want to introduce a code which will cycle through the list of pairs and provide a background color for each pair (button) according to the relevant condition.
In the uploaded indicator, I have the following code:
int start() {
setSymbolButtonSignalColor(); // to set button background color based on signal
return(0);
void setSymbolButtonSignalColor() will therefore have the relevant code. Again the uploaded indicator contains non working code (based on MA cross).
Appreciate if someone could have a look at the indicator and code the relevant section to get background colors for the various pairs (button) in the list according to the MA cross.
Thanks in advance.