Download MetaTrader 5

How to display custom indicator values of various timeframe in a panel/separate window?

To add comments, please log in or register
MirTD
220
MirTD  

real headach here

Built in indicator like stochastic can be displayed like below

for(x=0;x<6;x++)
    {
      if((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)) >  
         (iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)))
        ObjectSetText("tI"+x+"0"," BUY",9,"Arial Bold",Lime);
      else if             
        ((iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_SIGNAL,0)) >
        (iStochastic(NULL,TF[x],PercentK,PercentD,Slowing,MODE_SMA,0,MODE_MAIN,0)))
        ObjectSetText("tI"+x+"0","SELL",9,"Arial Bold",Red);         
      else
        ObjectSetText("tI"+x+"0","WAIT",9,"Arial Bold",Khaki); 
    } 
when I apply the same way for icustom like this it is not displayed.

for(x=0;x<6;x++)
    {
      if(iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,1)>iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)
       && iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)<=iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,3)) 
        ObjectSetText("dI"+x+"0",CharToStr(sBuy),fontSize,"Wingdings",Lime);
      else if(iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,1)<iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)
       && iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)>=iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,3)) 
         
        ObjectSetText("dI"+x+"0",CharToStr(sSell),fontSize,"Wingdings",Red);         
      else
        ObjectSetText("dI"+x+"0",CharToStr(sWait),10,"Wingdings",Khaki); 
    }
ps TF[x] is a timeframe array.
what is wrong about this display for custim indicator???been trying for a long long time but without success.any idea is welcome please


  :D

MirTD
220
MirTD  
is this forum dead?are ther any expert listening?..pls point out any syntax/coding errors in above code..
MirTD
220
MirTD  
for(x=0;x<6;x++)
    {
      if(iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,1)>iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)
       && iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)<=iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,3)) 
        ObjectSetText("dI"+x+"0",CharToStr(sBuy),fontSize,"Wingdings",Lime);
      else if(iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,1)<iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)
       && iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,2)>=iCustom(NULL,TF[x],"Trend1",Periods,Method,Price,2,3)) 
         
        ObjectSetText("dI"+x+"0",CharToStr(sSell),fontSize,"Wingdings",Red);         
      else
        ObjectSetText("dI"+x+"0",CharToStr(sWait),10,"Wingdings",Khaki); 
    }
is it not possible to access iCustom values like above and display Buy signal or Sell signal??
hhhhhelp pls
Keith Watford
Moderator
10378
Keith Watford  

What are the uchar values of sBuy, sSell and sWait?

Does the object (label?)  "dI"+x+"0" exist?

Test your iCustom call with a print to check that you are calling correctly with the correct parameters. 

MirTD
220
MirTD  

 values  as below

 int     sBuy                  = 233;
 int     sSell                 = 234;
 int     sWait                 = 54;

yes the object exist as below

for (x=0;x<6;x++)
      for (y=0;y<4;y++)
      {
        ObjectCreate("dI"+x+y,OBJ_LABEL,WindowFind("Trend1"),0,0);
          ObjectSetText("dI"+x+y," ",10,"Wingdings",Goldenrod);
          ObjectSet("dI"+x+y,OBJPROP_CORNER,0);
          ObjectSet("dI"+x+y,OBJPROP_XDISTANCE,x*scaleX+(offsetX+80)); // scaleX == 120, offsetX == 200
          ObjectSet("dI"+x+y,OBJPROP_YDISTANCE,y*scaleY+offsetY);
      }
any suggestion pls?
Keith Watford
Moderator
10378
Keith Watford  

You are creating an object named "dI"+x+y

You are setting the text for an object named "dI"+x+"0" 

Test your iCustom call with a print to check that you are calling correctly with the correct parameters.  

Carl Schreiber
6975
Carl Schreiber  

Hi, I once found an MA (iMa_Check.mq4) which displayed MA-differences.

I modified it to display this difference of a different time-frame.

You may take it and modify it acc. to your needs...

Files:
MirTD
220
MirTD  
You are creating an object named "dI"+x+y

You are setting the text for an object named "dI"+x+"0" 

Test your iCustom call with a print to check that you are calling correctly with the correct parameters.  


Many Thnx Gumrai...I got it now...its a relief!
To add comments, please log in or register