Forex
Google

Go Back   Forex Trading > Discussion Areas > Setup Questions
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2006, 09:41 PM
cardio cardio is offline
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
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);
Sometimes the sell goes through like the following
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-29-2006, 10:37 PM
Maji Maji is offline
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-30-2006, 02:16 PM
cardio cardio is offline
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
it is a buy/sell not stop

Hi
Thanks but it is not a stop it is a trade - buy/sell, I will try 2*MarketInfo(Symbol(),MODE_STOPLEVEL)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-30-2006, 02:43 PM
elihayun's Avatar
elihayun elihayun is offline
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by cardio
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);
Sometimes the sell goes through like the following
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?
Maybe u are using "+ 3" in both buy and sell. In sell u have to put "-3" to make it a valid price
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-30-2006, 04:31 PM
cardio cardio is offline
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
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);
            }


}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


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


All times are GMT. The time now is 09:25 AM.