MQL4 - automated forex trading   /  

Forum

Always price error

Back to topics list To post a new topic, please log in or register. You can also visit MQL5 forum

avatar
10
webcrea 2009.01.14 17:23 

Hello,


I send an order and I have always the error 129 or 4107 (error price) then my price is 30 pips under the close...??


thanks for your comments

Chris

article

Visual Testing of the Profitability of Indicators and Alerts

What indicator of trading alerts or just the methods of their calculating to use is usually decided when testing EAs using these alerts. However, it is not always possible/necessary/reasonable to write an EA for each indicator. You can promptly calculate the profitability of trading on the alerts from other indicators, using a special indicator that collects their alerts itself and draws a picture of ideal trading with them. It can help you both make a visual estimate of the results obtained and quickly choose most optimal parameters.


avatar
1736
Roger 2009.01.14 21:46 
Do you normalize price?

avatar
10
webcrea 2009.01.14 23:38 
Roger:
Do you normalize price?

Hello roger,

what do you mean by "normalize"

is it for example 1.36252525 --> 1.36250000 if that's, I do with a personnal function, maybe it exists one furnish

but i find what doesn't work, it was because I use OP_SELL and not OP_SELLLIMIT :-))


Now, I have another error : 138

2008.12.05 07:39 dev4 EURUSD,M15: OrderClose error 138

means in doc --> REQUOTE !!!

Do you have an idea on this term


thanks

chris


avatar
1736
Roger 2009.01.15 00:04 

I mean if you don't use Ask and Bid but calculate your price, you have to normalize it:

price=NormalizeDouble(price,4); //or 2 if JPY.


avatar
10
webcrea 2009.01.15 12:28 
Roger:

I mean if you don't use Ask and Bid but calculate your price, you have to normalize it:

price=NormalizeDouble(price,4); //or 2 if JPY.

thanks Roger


Effectively, I made a function for it; Even I use NormalizeDouble, I always have the same error...

It's only the stop that dosen't work because, when I trap it, the order is send.

Maybe, does the stop must be far from the price?


chris


avatar
1736
Roger 2009.01.15 19:08 
Unfortunately I'm not a medium, I have to see a code.

avatar
87
brspMA 2009.02.22 23:25 

hi...


i am struggling with the same error ( OrderClose error 138.) i have normalized the price... and i placed a RefreshRates also... plaese if you have some idea how to fix it... thanks.


      if (OrderLots() ==lots)
         {
         if (Ask-OrderOpenPrice() >= 10*Point) 
            {
            RefreshRates();
            OrderClose (OrderTicket(),lots/2,Ask,2,White);
            
            return(0);
            }
         } 

avatar
3012
Ais 2009.02.23 00:22 
Hello friends
brspMA:
Try to use "OrderClosePrice ()" function instead of "Ask" price in your code sample.
Best regards
Ais


avatar
87
brspMA 2009.02.23 00:51 
Ais:
Hello friends
brspMA:
Try to use "OrderClosePrice ()" function instead of "Ask" price in your code sample.
Best regards
Ais

thank you so much Ais! it worked perfectly fine!


just one question now: all code i've been studying uses Ask price for closing an order... this is the first time i saw the use of "OrderClosePrice ()" in place of Ask... is this a bug of mql4?


thank you so much again, my friend!


avatar
3012
Ais 2009.02.23 01:07 

This is just a feature.


avatar
87
brspMA 2009.02.23 08:37 
Ais:

This is just a feature.

thanks again....

Back to topics list  

To add comments, please log in or register