- can anyone add alert to this please
- Invalid stops error.
- Some Problem with Control development.
I suspect you just have to modify your DrawAdxColumn function as follows:
void DrawAdxColumn(string symbolName,int x,int y,string text,int fontSize=8,string fontName="Calibri") { int digits=(int)MarketInfo(symbolName,MODE_DIGITS); double close1=iClose(symbolName,PERIOD_D1,1); double open1=iOpen(symbolName,PERIOD_D1,1); // New line added. double current2=NormalizeDouble(MarketInfo(symbolName,MODE_ASK),digits); double PercChange =((current2 - close1)/ MathAbs(open1-close1))*100; // Change to high1-low1 if that's what you're after. string tooltip=symbolName+"\n.: "+GetPeriodStr(AdxTimeframe)+" ADX ("+IntegerToString(AdxPeriod)+"):.\nCurrent("+DoubleToStr(close1, current2)+")"; DrawLabel("adx_"+symbolName,x,y,DoubleToStr(GetAdxStr(close1, current2,PercChange ),2),fontSize,fontName,GetAdxColor(close1, current2),tooltip); // Added DoubleToStr with 2 digits. }
thanks for replying i got percentage but it has more digits see the pic. need to reduce no of digits
and i tried modifier then more errors appear
thanks for replying i got percentage but it has more digits see the pic. need to reduce no of digits
and i tried modifier then more errors appear
This is what i see... much lesser digits already.
Do check the comments i've left in my suggested changes - will help you make the changes (especially the formula of PercChange).
This is what i see... much lesser digits already.
Do check the comments i've left in my suggested changes - will help you make the changes (especially the formula of PercChange).
bro try this one , i thought if median price is rising or decreasing then
then there is trend and tried this but utter flop
//+------------------------------------------------------------------+ //| ProjectName | //| Copyright 2012, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, Carlos Oliveira" #property link "https://www.forextradingtools.eu/products/indicators/forex-scanner-furce=mt4terminal" #property version "1.00" #property strict #property indicator_chart_window static datetime TimeStamp; string INDI_NAME="MPSCN-"; input int TimerInterval=60; //Update interval (secs) input int FontSize=10; //Font Size input string FontName="Calibri"; //Font Name input string Group0; //--------------------------------------------------- input ENUM_APPLIED_PRICE AdxAppliedPrice=PRICE_CLOSE; //ADX Applied Price input ENUM_TIMEFRAMES AdxTimeframe=PERIOD_M15; //ADX Timeframe input int AdxPeriod=20; //ADX Period int GUIXOffset = 20; int GUIYOffset = 10; int GUIHeaderXOffset = 20; int GUIHeaderYOffset = 0; int GUIColOffset=100; int ListXOffset = 10; int ListYOffset = 10; int ListXMultiplier = 15; int ListYMultiplier = 10; int ColumnHeight=44; int ColumnOffset=250; datetime TimeMissing; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping ChartColorSet(CHART_COLOR_BACKGROUND,clrBlack); ChartColorSet(CHART_COLOR_FOREGROUND,clrWhite); ChartColorSet(CHART_COLOR_GRID,clrNONE); ChartColorSet(CHART_COLOR_VOLUME,clrNONE); ChartColorSet(CHART_COLOR_CHART_UP,clrNONE); ChartColorSet(CHART_COLOR_CHART_DOWN,clrNONE); ChartColorSet(CHART_COLOR_CHART_LINE,clrNONE); ChartColorSet(CHART_COLOR_CANDLE_BULL,clrNONE); ChartColorSet(CHART_COLOR_CANDLE_BEAR,clrNONE); ChartColorSet(CHART_COLOR_BID,clrNONE); ChartColorSet(CHART_COLOR_ASK,clrNONE); ChartColorSet(CHART_COLOR_LAST,clrNONE); ChartColorSet(CHART_COLOR_STOP_LEVEL,clrNONE); ChartModeSet(CHART_LINE); EventSetTimer(1); DrawHeader(); DrawScanner(); return(INIT_SUCCEEDED); } //+-------------------------------------------------------------------------------------------+ int deinit() { ObjectsDeleteAll(ChartID(),INDI_NAME); return(0); } //+------------------------------------------------------------------+ //| 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[]) { //DrawMissingTime(); //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ void OnTimer() { DrawScanner(); } //+------------------------------------------------------------------+ double getRange(string symbol,int period) { int DataPeriod=PERIOD_D1; int DataBar=iBarShift(symbol,DataPeriod,Time[0]); double range = iHigh(symbol, period, DataBar) - iLow(symbol, period, DataBar); double point = MarketInfo(symbol, MODE_POINT); if(point > 0) return (NormalizeDouble(range / point, 0)); return 1; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------// void DrawLabel(string name,int x,int y,string label,int size=9,string font="Arial",color clr=DimGray,string tooltip="") { name=INDI_NAME+":"+name; ObjectDelete(name); ObjectCreate(name,OBJ_LABEL,0,0,0); ObjectSetText(name,label,size,font,clr); ObjectSet(name,OBJPROP_CORNER,0); ObjectSet(name,OBJPROP_XDISTANCE,x); ObjectSet(name,OBJPROP_YDISTANCE,y); ObjectSetString(0,name,OBJPROP_TOOLTIP,tooltip); //--- justify text //ObjectSet(name, OBJPROP_ANCHOR, 0); //ObjectSetString(0, name, OBJPROP_TOOLTIP, tooltip); //ObjectSet(name, OBJPROP_SELECTABLE, 0); //--- } //+------------------------------------------------------------------+ //| The function sets chart background color. | //+------------------------------------------------------------------+ bool ChartColorSet(int prop_id,const color clr,const long chart_ID=0) { //--- reset the error value ResetLastError(); //--- set the chart background color if(!ChartSetInteger(chart_ID,prop_id,clr)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); return(false); } //--- successful execution return(true); } //+------------------------------------------------------------------+ //| Set chart display type (candlesticks, bars or | //| line). | //+------------------------------------------------------------------+ bool ChartModeSet(const long value,const long chart_ID=0) { //--- reset the error value ResetLastError(); //--- set property value if(!ChartSetInteger(chart_ID,CHART_MODE,value)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); return(false); } //--- successful execution return(true); } //+------------------------------------------------------------------+ void DrawScanner() { Print("=============>DrawScanner"); for(int x=0; x<SymbolsTotal(true); x++) { DrawSymbol(SymbolName(x,true),x); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DrawSymbol(string symbolName,int symbolIdx) { int yMult = fmod(symbolIdx, ColumnHeight); int xMult = symbolIdx/ColumnHeight; int x= GUIXOffset+ListXOffset + ListXMultiplier; int y= GUIYOffset+ListYOffset + ListYMultiplier * yMult; DrawSymbolColumn(symbolName,x + ColumnOffset*xMult,y,symbolName,FontSize,FontName); DrawAdxColumn(symbolName,x+=GUIColOffset + ColumnOffset*xMult,y,symbolName,FontSize,FontName); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double getPoint(string symbol) { return MarketInfo(symbol,MODE_POINT); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double getModifier(string symbol) { int digits=(int)MarketInfo(symbol,MODE_DIGITS); double modifier=1; if(digits==3 || digits==5) modifier=4.0; return modifier; } //| | //+------------------------------------------------------------------+ void DrawAdxColumn(string symbolName,int x,int y,string text,int fontSize=8,string fontName="Calibri") { int digits=(int)MarketInfo(symbolName,MODE_DIGITS); double close1=iClose(symbolName,AdxTimeframe,0); double close2=iClose(symbolName,AdxTimeframe,1); double close3=iClose(symbolName,AdxTimeframe,2); double open1=iOpen(symbolName,AdxTimeframe,0); double open2=iOpen(symbolName,AdxTimeframe,1); double open3=iOpen(symbolName,AdxTimeframe,2); double median1=((close1+open1)/2); double median2=((close2+open2)/2); double median3=((close3+open3)/2); string tooltip=symbolName+"\n.: "+GetPeriodStr(AdxTimeframe)+" ADX ("+IntegerToString(AdxPeriod)+"):.\nCurrent("+DoubleToStr(median2,median1)+")"; DrawLabel("adx_"+symbolName,x,y,GetAdxStr(median3,median2,median1 ),fontSize,fontName,GetAdxColor(median3,median2,median1),tooltip); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ string GetAdxStr(double median1,double median2,double median3 ) { if( median3<median2<median1) return "UPTREND"; if(median3>median2>median1) return "DOWNTREND"; return "NOTREND"; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ color GetAdxColor(double median1,double median2,double median3 ) { if( median3<median2<median1) return clrGreenYellow; if( median3<median2<median1) return clrRed; return clrWhite; } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DrawSymbolColumn(string symbolName,int x,int y,string text,int fontSize=8,string fontName="Calibri") { DrawLabel("lbl_"+symbolName,x,y,text,fontSize,fontName,clrWhite,symbolName); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DrawHeader() { string objName="Header"; int x = GUIXOffset+GUIHeaderXOffset; int y = GUIYOffset+GUIHeaderYOffset; DrawLabel(objName+"name",x,y,"Name",FontSize,FontName,clrWhite,"Name"); { DrawLabel(objName+",adx",x+=GUIColOffset,y,"ADX ("+GetPeriodStr(AdxTimeframe)+")",FontSize,FontName,clrWhite,"ADX"); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ string GetPeriodStr(int period) { string TMz=""; switch(period) { case 1: TMz = "M1"; break; case 2: TMz = "M2"; break; case 3: TMz = "M3"; break; case 4: TMz = "M4"; break; case 5: TMz = "M5"; break; case 6: TMz = "M6"; break; case 7: TMz = "M7"; break; case 8: TMz = "M8"; break; case 9: TMz = "M9"; break; case 10: TMz = "M10"; break; case 11: TMz = "M11"; break; case 12: TMz = "M12"; break; case 13: TMz = "M13"; break; case 14: TMz = "M14"; break; case 15: TMz = "M15"; break; case 20: TMz = "M20"; break; case 25: TMz = "M25"; break; case 30: TMz = "M30"; break; case 40: TMz = "M40"; break; case 45: TMz = "M45"; break; case 50: TMz = "M50"; break; case 60: TMz = "H1"; break; case 120: TMz = "H2"; break; case 180: TMz = "H3"; break; case 240: TMz = "H4"; break; case 300: TMz = "H5"; break; case 360: TMz = "H6"; break; case 420: TMz = "H7"; break; case 480: TMz = "H8"; break; case 540: TMz = "H9"; break; case 600: TMz = "H10"; break; case 660: TMz = "H11"; break; case 720: TMz = "H12"; break; case 1440: TMz = "D1"; break; case 10080: TMz = "W1"; break; case 43200: TMz = "M1"; break; } return TMz; } //+------------------------------------------------------------------+
bro try this one , i thought if median price is rising or decreasing then
then there is trend and tried this but utter flop
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use