|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Please help Invalid stops Error 130
Hi
I am getting the error message invalid stops err 130 i.e. I print out my values and they are as follows 2006.06.29 13:15:05 AUDUSD,H1: OrderDetails: SellPrice : 0.731 ,CurrentBid : 0.731 ,stoploss : 0.7319 ,takeprofit : 0.7291 ,slippage : 2 I am using the following to check my sl and tp before placing the order Code:
/ if (StopLoss<=MarketInfo(Symbol(),MODE_STOPLEVEL)) StopLoss=MarketInfo(Symbol(),MODE_STOPLEVEL)+3; if (TakeProfit<=MarketInfo(Symbol(),MODE_STOPLEVEL)) TakeProfit=2*(MarketInfo(Symbol(),MODE_STOPLEVEL)+3); 2006.06.29 08:32:56 AUDUSD,H1: open #5976740 sell 0.01 AUDUSD at 0.7309 sl: 0.7324 tp: 0.7278 ok Maybe my stops checking is just not functioning correctly. Any suggestions? Last edited by cardio : 06-30-2006 at 02:14 PM. |
|
|||
|
I think the error lies in the way you are placing your orders. If you are using stop orders, then your orders are too close to the market price. Typically, your buy stop should be atleast "MarketInfo(Symbol(),MODE_STOPLEVEL)" pips away from the current ask.
If you are placing stop orders, make sure you use RefreshRates() and then place the orders that required distance away. For fast moving markets, it still may not work and you will have to place the orders further away. Hope this helps. |
|
|||
|
that is not the hassle
I am starting to think that its interbankfx trying to prevent scalping when the market is tight. It works when the market is not tight - still it is confusing as once one's sl and tp are greater then MarketInfo(Symbol(),MODE_STOPLEVEL) it should open the trade.
Anyway Here is the code I use Code:
StopLoss = NormalizeDouble((TradeAbovePct/100)*(DemaH-DemaL)*(1/Point),0);
if (StopLoss<=MarketInfo(Symbol(),MODE_STOPLEVEL)) StopLoss=MarketInfo(Symbol(),MODE_STOPLEVEL)+3;
TakeProfit = NormalizeDouble(2*((DemaH-DemaL)*(1/Point)),0);
if (TakeProfit<=MarketInfo(Symbol(),MODE_STOPLEVEL)) TakeProfit=2*(MarketInfo(Symbol(),MODE_STOPLEVEL)+3);
//Then I call a buy and sell as needed
//e.i
OpenBuy1(10);
OpenSell1(10);
////////////////////////////////////////////////
bool OpenBuy1(int pips1)
{
int ticket;
string comment="";
//reset defaults
use_MTBE = use_MTBEd;
use_split = use_splitd;
RefreshRates();
price1 = Ask;
stoploss1 = NormalizeDouble(price1-StopLoss*Point,Digits);
tp1 = NormalizeDouble(price1+TakeProfit*Point,Digits);
//expire1 = iTime(Symbol(),TimeFrame,0)+TimeFrame*HoursStopOpen*60;
Print("Openbuy lots: ", Lots);
if(UseStopLoss)
ticket=OrderSend(Symbol(),OP_BUY,Lots,price1,2,stoploss1,tp1,comment,MAGICMA,0,Orange);
else
ticket=OrderSend(Symbol(),OP_BUY,Lots,price1,2,0,tp1,comment,MAGICMA,0,Orange);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
Print("BUY order opened : ",OrderOpenPrice());
//time1 = CurTime()+2*60*Period();
return(true);
}
}
else
{
Print("Error opening BUY order : ",GetLastError());
Print("OrderDetails: BuyPrice : ",price1," ,CurrentAsk : ", Ask," ,stoploss : ",stoploss1," ,takeprofit : ",tp1," ,slippage : ",2);
return(false);
}
}
bool OpenSell1(int pips1)
{
int ticket;
string comment="";
//reset defaults
use_MTBE = use_MTBEd;
use_split = use_splitd;
RefreshRates();
price1 = Bid;
stoploss1 = NormalizeDouble(price1+StopLoss*Point,Digits) ;
tp1 = NormalizeDouble(price1-TakeProfit*Point,Digits);
// expire1 = iTime(Symbol(),TimeFrame,0)+TimeFrame*HoursStopOpen*60;
Print("Opensell lots: ", Lots);
if(UseStopLoss)
ticket=OrderSend(Symbol(),OP_SELL,Lots,price1,2,stoploss1,tp1,comment,MAGICMA,0,Red);
else
ticket=OrderSend(Symbol(),OP_SELL,Lots,price1,2,0,tp1,comment,MAGICMA,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
Print("SELL order opened : ",OrderOpenPrice());
// time1 = CurTime()+2*60*Period();
return(true);
}
}
else
{
Print("Error opening SELL order : ",GetLastError());
Print("OrderDetails: SellPrice : ",price1," ,CurrentBid : ", Bid," ,stoploss : ",stoploss1," ,takeprofit : ",tp1," ,slippage : ",2);
return(false);
}
}
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exit Strategy: Stepping Stops vs. Trailing Stops | stu | Expert Advisors - Metatrader 4 | 44 | 07-01-2008 05:22 PM |
| Tighter Trailing Stops && Stops | Nicholishen | Expert Advisors - Metatrader 4 | 25 | 06-27-2008 01:04 AM |
| Error 130 - invalid stop. Why? | Lou G | Setup Questions | 4 | 09-26-2006 04:41 PM |
| ERROR: Invalid Integer Number As Parameter | secxces | Questions | 4 | 05-25-2006 02:50 PM |