ERROR 130 MYSTERY

 

I have an ea theat works fine for the euro and cad when I try it with the usdgbp I get error 130 Invalid stops.

Here is the code:

Print(" Entry = ", Entry,"  Stop = ",Stop,"  Takeprofit = ",Takep);       
        Ticket = OrderSend(Symbol(),OP_SELLSTOP,Lots,Entry,3,Stop,Takep,"NIBGBP1M_S",21,0,Red); 

the print output:2009.01.15 12:13:44 2009.01.02 19:11 NIBR3_USDGBP_1M GBPUSD,M1: Entry = 1.4451 Stop = 1.4547 Takeprofit = 1.4281

The stop is well above the entry which it should be for a short position.

What else can generate error 130? Been through the literature usually it is a decimal problem or too close to price.

All ideas, suggestions, hunches, wild guesses, and outright correct answers deeply appreciated.

Keith

 
What are you calculating your stop loss from? Also how are you calculating it?
 
jmca wrote >>
What are you calculating your stop loss from? Also how are you calculating it?

Hey JM

Gets really wierd: this does not work, end up with four decimal points; should be 5.

        Entry = Bid-factor;   //factor is a variable to ensure that Entry is outside of the spread
        Stop = Entry +(SL*Point);
        Takep = Entry -Takeprofit*Point;
        Print(" Entry = ", Entry,"  Stop = ",Stop,"  Takeprofit = ",Takep,"  SL*Point = ",SL*Point);       
        Ticket = OrderSend(Symbol(),OP_SELLSTOP,Lots,Entry,3,Stop,Takep,"NIBGBP1M_S",21,0,Red); 
     
but change to this:
Entry = Low[1]-factor;   //factor is a variable to ensure that Entry is outside of the spread

you still get four decimal points: 2009.01.15 16:22:02 2009.01.06 06:10 NIBR3_USDGBP_1M GBPUSD,M5: Entry = 1.4598 Stop = 1.4693 Takeprofit = 1.4428 SL*Point = 0.0095 (NOTE:SL*Point should be 0.00954)

however this time the program executes:2009.01.15 16:22:02 2009.01.06 06:10 NIBR3_USDGBP_1M GBPUSD,M5: open #205 sell stop 0.50 GBPUSD at 1.45976 sl: 1.46926 tp: 1.44276 ok (NOTE: SL*Point IS 0.00954)

Now I really have a headache and except for curiosity don't care, I can use Low[1]-factor. Still this might be a problem others will encounter.

Thanks for your suggestions, got me rooting around into what was really happening and at least I know what, even if I never know why.

Keith

 
kminler wrote >>

Hey JM

Gets really wierd: this does not work, end up with four decimal points; should be 5.

but change to this:

you still get four decimal points: 2009.01.15 16:22:02 2009.01.06 06:10 NIBR3_USDGBP_1M GBPUSD,M5: Entry = 1.4598 Stop = 1.4693 Takeprofit = 1.4428 SL*Point = 0.0095 (NOTE:SL*Point should be 0.00954)

however this time the program executes:2009.01.15 16:22:02 2009.01.06 06:10 NIBR3_USDGBP_1M GBPUSD,M5: open #205 sell stop 0.50 GBPUSD at 1.45976 sl: 1.46926 tp: 1.44276 ok (NOTE: SL*Point IS 0.00954)

Now I really have a headache and except for curiosity don't care, I can use Low[1]-factor. Still this might be a problem others will encounter.

Thanks for your suggestions, got me rooting around into what was really happening and at least I know what, even if I never know why.

Keith

Take a look to "NormalizeDouble" and "Digits"...

OrderSend(Symbol(),OP_SELLSTOP,Lots, NormalizeDouble(Entry,Digits),3, NormalizeDouble(Stop,Digits), NormalizeDouble(Takep,Digits),"NIBGBP1M_S",21,0,Red);

 
EADeveloper wrote >>

Take a look to "NormalizeDouble" and "Digits"...

OrderSend(Symbol(),OP_SELLSTOP,Lots, NormalizeDouble(Entry,Digits),3, NormalizeDouble(Stop,Digits), NormalizeDouble(Takep,Digits),"NIBGBP1M_S",21,0,Red);

Hey EA

Good point, I didn't think that I needed to use NormalizeDouble since there should not be an excess of digits to be rounded, but using it would be the safe way

to make sure. I'm still baffled by the fact that Low[1] works and Ask doesn't.

Just have to move on and use NormalizeDouble everywhere.

Thanks for the coment.

Keith

 

the same way like below, I use 10 to multiply or divide the Point which gotten from the system info.

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point*10,"EAS",16384,0,Green);