inavlid price

 

I get an invalid price error when the target inhere is set as 0.00000

ANy ideas why?


A zero target should just be sent without a TP?


int ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,NULL,SenkouStop,Target,DoubleToStr(Period(),0),255,0,CLR_NONE);
 
NormalizeDouble(Target, Digits)
 
antslag:
NormalizeDouble(Target, Digits)

yep, already had that in the code:

     if (Point==0.00001){
        Target = NormalizeDouble(Bid - (0.3*iATR(Symbol(),PERIOD_D1,14,0)),5);
      }
     if (Point==0.001){
      Target = NormalizeDouble(Bid - (0.3*iATR(Symbol(),PERIOD_D1,14,0)),3);
      }
 

Try implementing Slippage (instead of NULL).

Also try implementing a RefreshRates() call immediately prior to your OrderSend().


CB

 

When I do this it works. Strange huh?


   if (Target==0) {
      int ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,NULL,SenkouStop,0,DoubleToStr(Period(),0),255,0,CLR_NONE);
   }
   else {
      ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,NULL,SenkouStop,Target,DoubleToStr(Period(),0),255,0,CLR_NONE);
   }
 

Try normalizng Target to the correct number of digits. NormalizeDouble(Target,Digits)

And also take on board the 2 points I made above before they trip you up too.

Additionally - declare the ticket variable up-front, outside of that conditional statement.


CB

Reason: