# Experts: psar bug 3

Moderator
192546

Opens and closes orders using parabolic SAR

Author: Tonny Obare

17095

1. This solves incompatibility with some brokers e.g. for forex.com set it to 1 while for alpari and finexo leave it at 10.
EA's should automatically adjust for 5 digit brokers not require manual changes. You don't adjust slippage.
```//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init(){
if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
} else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
// OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
```

2. You also assume there are no other EA's running (on other pairs, or other time frames.)
```    for(int pos = OrdersTotal() - 1; pos >= 0; pos--) if (
OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
&&  OrderMagicNumber()  == Magic.Number             // my magic number
&&  OrderSymbol()       == Symbol() ){              // and period and symbol
```
1026

Both the three brokers tested are 5 digit but psar bug2 would work on forex .com but couldnt open orders on alpari and finexo unless you multiply stops by 10. Thats why in psar bug 3 i introduced this feature.
16316

I am using Fxopen . This error came out

Error when order select 130

2010.07.16 19:13:51 pSAR bug 3 USDJPY,M1: Error when order select 130

16316

Thanks for sharing, good stuff!

1026

zalinarashid:

I am using Fxopen . This error came out

Error when order select 130

2010.07.16 19:13:51 pSAR bug 3 USDJPY,M1: Error when order select 130