Need advice reguarding 5 digit broker

 

Hi!

I've been writing and testing my EA on 4 digit broker (insta),and everything worked perfectly,today I've opened pepperstone demo account and it places pending orders too far ...

Now, I am a little stuck because I have a function that "adjusts" my ea to any broker(any number of digits), but for some reason it doesnt work here.

Here are a few pieces of code that I suspect are responsible for causing this and I am almost sure its a logical error but please give me at least a hint what i did wrong if you please..

*Here is the ticksize adjustment function which is in init():

int init()
  {
//----
      double ticksize = MarketInfo(Symbol(),MODE_TICKSIZE);
        if (ticksize == 0.00001 || ticksize == 0.001)
           pips = ticksize*10;
           else pips = ticksize;
//----
   return(0);
  }


*Here is the buy condition(same for sell);

OrderSend(Symbol(),OP_SELLSTOP,LotSize,Bid-BrStopLevel,Slippage,ssl,0,NULL,MagicNumber,0,Red);


*Here is the function that gets the broker's current stop level:

double StopLevelThisPair()
{
   double StopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL);
   return(StopLevel);
}

*And here is how I calculate a BrStopLevel var(it runs in start()):

BrStopLevel = ((StopLevelThisPair()*pips)+(BrSLAddon*pips));

*BrSLAddon is an externally declared var which adds a buffer to the stop level value(just in case).

Now as you can see the pending order should be placed more than 6(if stop level is 2,stop level buffer is 1, and slippage is 3) pips from my signal which is a close of candle 1 back (Close[1]).But for some reason on pepperstone (5 digits) it places the order aroud 21 pips from signal.


Please advice,any help would be highly appreciated.
 
if (ticksize == 0.00001 || ticksize == 0.001)
  1. Don't hard code numbers. That fails on Metals. Ticksize=0.25 point=0.01
  2. RTFM MODE_TICKSIZE returns a value in points (1 or 10,) not a double.
  3. You must adjust TP, SL, AND slippageProblems with a calculation - MQL4 forum
 
Ok,thanks for the reply,but i still cant find whats wrong..Please advice
 
Add print statements and find out why. I already told you what was wrong
 

Ok, so I will understand, from this article> http://daytrading.about.com/od/daytradingbasics/qt/PointsTicks.htm

Point is the number on the left side of the decimal point.. but you say in mql4 its not? And whats "Ticksize=0.25 suppoze to mean?



 
t0mbfunk:

Ok, so I will understand, from this article> http://daytrading.about.com/od/daytradingbasics/qt/PointsTicks.htm

Point is the number on the left side of the decimal point.. but you say in mql4 its not? And whats "Ticksize=0.25 suppoze to mean?

Not every symbol has a tick size of either 0.00001 or 0.001 what would your code do when it encounters a symbol wwitha ticksize of 0.25 ?
 

Ok,i got it now.

Thanks guys.

Reason: