
Originally Posted by
funyoo
The error 130 is generated when the SL or the TP is too short (min 15 for the SL, min 10 for the TP)
If you use this line of code between calculating your SL and using its value in the OrderSnd() function.
For long positions:
Code:
if ( SL > ( Bid - MarketInfo(Symbol(),MODE_STOPLEVEL)*Point )) {SL = Bid - MarketInfo(Symbol(),MODE_STOPLEVEL)*Point ;}
For short positions:
Code:
if ( SL < (Ask + MarketInfo(Symbol(),MODE_STOPLEVEL)*Point) ) {SL = Ask + MarketInfo(Symbol(),MODE_STOPLEVEL)*Point ;}

Originally Posted by
funyoo
The error 130 is generated when the lots is under the minimum lots size allowed by the broker. If you are on Alpari UK, you have to multiply the SL, TP and TS by 10.
These lines of code should be used to ensure that the lots are not less than the minimum size allowed by your broker:
Code:
double Lot=0;
double MinLotSize=0;
MinLotSize = MarketInfo(Symbol(),MODE_MINLOT);
........ calculate your lot size here ..........
if(Lot < MinLotSize)
{
Lot = MinLotSize;
You should also do the same for MaxLotSize.