Great problem with ADX - can anybody help please

 

hello

I can not understand why my EA does not response on +DI and -DI crossing.

int start()
  {
   p0=iADX(NULL,0,dny,PRICE_OPEN,MODE_PLUSDI,0);
   p1=iADX(NULL,0,dny,PRICE_OPEN,MODE_PLUSDI,1);
   m0=iADX(NULL,0,dny,PRICE_OPEN,MODE_MINUSDI,0);
   m1=iADX(NULL,0,dny,PRICE_OPEN,MODE_MINUSDI,1);

   if(BarTime!=Time[0])
     {
      if((p0 > m0) && (p1 < m1))
        {
         Buy();
         BarTime=Time[0];
        }
      if((p0 < m0) && (p1 > m1))
        {
         Sell();
         BarTime=Time[0];
        }
     }
  }

(this is only part, but the most important) and after compile it says: 0 error(s), 0 warning(s). With other indicators (Stoch, MA) it worked on crosses...

where could be the problem? I have tried open, close, median... prices, but it had no effect. Sometimes, when it crosses, it buys or sells, but it is 1 of 10, 20 or more crosses...

PLEASE HELP ME

maarty

 

M

Are there any errors in the Log?

Also try

int start()
  {
   p0=iADX(NULL,0,dny,PRICE_OPEN,MODE_PLUSDI,0);
   p1=iADX(NULL,0,dny,PRICE_OPEN,MODE_PLUSDI,1);
   m0=iADX(NULL,0,dny,PRICE_OPEN,MODE_MINUSDI,0);
   m1=iADX(NULL,0,dny,PRICE_OPEN,MODE_MINUSDI,1);

   if(BarTime!=Time[0])
     {
      if((p0 > m0) && (p1 <= m1))
        {
         Buy();
         Print("Buy");
         BarTime=Time[0];
        }
      if((p0 < m0) && (p1 >= m1))
        {
         Sell();
         Print("Sell");
         BarTime=Time[0];
        }
     }
  }

The lines cross quite often and can be equal

Look for the Buy/Sell comments in the log

what is the value of dny?

Good Luck

-BB-

 

hi -BB-

there are no errors in log... there is nothing... it doesn't do anything :(

<= and >= I had tried...

dny is set to 6 - its extern for better access... isn't it too little? - i need it little :(

I have the comment() function which shows the values of +DI an -DI on screen, but even if the conditions are like in example, it doesn't work. (i've used steps in strategy tester)


can you mail me? I'll send you whole code if you have some better debugger... kopriva.martin.cz@volny.cz


THANK YOU

maarty
 

Free support is here :)

Post the code using the SRC button on the post toolbar

Keep trying

-BB-

 

I'm afraid that everything, what i can share, has been posted.

I'll keep trying...

Thanks for help.