Download MetaTrader 5
To add comments, please log in or register
Do you want to become a well-known developer? Execute the orders of traders in the Freelance service!
MirTD
204
MirTD 2014.12.07 14:14 

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
204
MirTD 2014.12.08 05:11  
is this forum dead?are ther any expert listening?..pls point out any syntax/coding errors in above code..
MirTD
204
MirTD 2014.12.08 09:06  
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
7981
Keith Watford 2014.12.08 09:13  

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
204
MirTD 2014.12.08 09:38  

 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
7981
Keith Watford 2014.12.08 10:09  

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
5959
Carl Schreiber 2014.12.08 10:10  

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
204
MirTD 2014.12.08 10:49  
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