Mixed (R01-R03, S01, Manual) | 2010.11.30 - present | IBFX (By Raiden)

The user has deleted this system.

Mixed (R01-R03, S01, Manual) | 2010.11.30 - present | IBFX Discussion

Dec 01, 2010 at 09:29
4,962 Views
60 Replies
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 10:26
Yes, I see where you're coming from. It is always interesting to study other posters' statements.
However, while I do keep a massive number of workfiles and a large changelog, I'm not prepared to publicly post that information. I don't see any upside doing so, apart from perhaps satisfying some peoples' curiosity but that's not my objective. The potential downside, however, is large, for reasons people who have seen dealing desks being operated physically would know.

I would make my live accounts public were I advertising to be a manager but I'm not. And neither am I selling the EA or signals. What would one expect to achieve from doing so? Repute?
Consistency above all.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 10:54
Upside could be you come accross people who can contribute to your work. There are some veteran programmers here - to name but one: Edward - chances are he could give you a few tips on how not to flood the server.

Do you care to explain this:

<i>The potential downside, however, is large, for reasons people who have seen dealing desks being operated physically would know</i>

You mean you could get hosed by the broker if they knew your trading?

Either way, I'm interested in how dealing desks are being operated ... if you could share this information ... thanks.
Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 11:28
The repository of coding information and congregation of coders is not as rich as on the mql4, ForexFactory, Forex-TSD, TradingSystemForex forums. I honestly don't get any coding information from here.

The flooding of OrderModify attempts was logically unjustified. Error logs could not explain why 0.12345==0.12345 was not true.
I had thought it was something endemically wrong with my code and I spent a LOT of time rewriting stuff and still couldn't work around it, hence the hair pulling.

In my case, it was specifically to do with the floating point of the Double variable OrderStopLoss() when compared with a StopLoss value calculated from OrderOpenPrice(). E.g. 0.1234567890123456==0.1234567890123451, which will show up as 0.12345==0.12345, will return false and this was likely the case.
See https://www.forexfactory.com/showthread.php?t=236951 as reference, I am not the TC.

I've PM'ed you regarding one nugget of information that is not a good idea to advertise.
Consistency above all.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 11:45
You see? Ask, and it shall be given you; seek, and ye shall find; knock, and it shall be opened unto you.
Without looking at the ForexFactory link, here's a tip:
(it's on the page 4 in the <i>'Teach yourself MQL4 in 21 days'</i> ebook) always use NormalizeDouble.
Never worked with floating point numbers before? 😄
Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 12:24 (edited Apr 27, 2011 at 12:33)
Good that we are discussing this as I feel I need to ask this. (Code has been truncated and simplified to leave out irrelevant bits)
If you have:

extern int StopLoss=30;
Start(){
if(OrderStopLoss()!=(OrderOpenPrice()-StopLoss*Point))
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point),0,Red); //for buy orders
}

Why would anyone reason that OrderOpenPrice()-StopLoss*Point would generate a different number than OrderStopLoss()?
It's a genuine bug.

Another thing why I don't discuss code here is that there's no formatting available unlike in the other forums I mentioned above. It would be a good addition and has been suggested.

The e-book is clearly wrong(can you provide the link?), it's not a good idea to NormalizeDouble at all when calculations are being done.
Consistency above all.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 12:34
My friend if you do some binary / floating point arithmetics by hand (on paper), you'd know it's possible that for example, OrderStopLoss returns 1.234500000000 while the result of <i>OrderOpenPrice() - StopLoss * Point</i> would be 1.234500000074857485 something. That's the way floating point numbers work. I wouldn't say it's a bug or a feature, anyway if you use Normalize, you can get what you want without the fuss. But I'm not the sharpest knife in the cupboard ... maybe Edward can give you a better explanation.



Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 12:37 (edited Apr 27, 2011 at 12:38)
Ok, I'm not arguing with the chaps over at MetaQuotes ... are you? 😁

https://docs.mql4.com/convert/normalizedouble

<i>'The calculated StopLoss and TakeProfit values, as well as open price of pending orders <b>must be normalized</b> with a precision the value of which is stored in the pre-defined variable of Digits.'</i>


'it's not a good idea to NormalizeDouble at all when calculations are being done.'
Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 13:15
speki posted:
    My friend if you do some binary / floating point arithmetics by hand (on paper), you'd know it's possible that for example, OrderStopLoss returns 1.234500000000 while the result of <i>OrderOpenPrice() - StopLoss * Point</i> would be 1.234500000074857485 something. That's the way floating point numbers work. I wouldn't say it's a bug or a feature, anyway if you use Normalize, you can get what you want without the fuss.

I have to elaborate, immediately after my OrderSend, I successfully OrderModify by
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,0,Red)

Notice no NormalizeDouble.

When I perform a check as in my previous post:
if(OrderStopLoss()!=(OrderOpenPrice()-StopLoss*Point))
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,0,Red); //for buy orders
}

I get the OrderModify Error#1 that can only be resolved by writing this:
if(OrderStopLoss()!=(OrderOpenPrice()-StopLoss*Point))
OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()-StopLoss*Point,Digits),0,Red); //for buy orders
}

Why would OrderStopLoss()!=OrderOpenPrice()-StopLoss*Point return true? It doesn't make any logical sense.

To be forced to use a NormalizeDouble is sloppy but I'm sure Metaquotes has their reason. Note that this issue was addressed by bugfixes in several MT4 releases but it clearly isn't not resolved completely. It should be better documented on their site.

And generally, rounding numbers before calculations are made gets ultimately the wrong answer, particularly with numerous calculations.
Consistency above all.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 14:14
Lives and learns, my friend ...
You were lucky if it actually worked w/o Normalize.

I don't think it's only the sloppyness of Metaquotes ... it's something about floating point numbers ...

https://www.google.com/search?q=floating+point+comparison+problem

you see what Microsoft says about it?
https://support.microsoft.com/kb/69333

quote: <b>NO OTHER TEST FOR EQUALITY WILL BE RELIABLE.</b>

This is also interesting, how 1.1 is in fact 1.099999904632568359375

https://stackoverflow.com/questions/3962724/problems-in-floating-point-comparison

Let's turn the page, shall we? 😁

<quote=Raiden>
I have to elaborate, immediately after my OrderSend, I successfully OrderModify by
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,0,Red)

Notice no NormalizeDouble.
</quote>
Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 20:49 (edited Apr 27, 2011 at 20:51)
To summarise:

OrderStopLoss = A
OrderOpenPrice = B
StopLoss*Point=C

A=B-C

if(A is not equal to B-C) <b>make</b> A equal to B-C
test if A is now equal to B-C

OrderModify Error#1
OrderModify Error#1
OrderModify Error#1
OrderModify Error#1
...
..
.
*faint*

The point I would like to make is that OrderStopLoss() and OrderOpenPrice() are calculated differently by MT4. I do understand the computational limits of floating point numbers, but thank you for the links nonetheless, they are interesting and useful reads.

And you must understand it from my perspective when I first came across it, I didn't know it could be resolved by rounding. I thought it was an OrderModify problem and I scratched my head for a whole day reworking the OrderModify itself. I suspect comic relief from a coding angle is rather dry for most people so I'll leave it as that. Thanks for discussing though.
Consistency above all.
Member Since Nov 18, 2009   735 posts
Apr 27, 2011 at 21:19
No worries. Now you're good friends with Mr. NormalizeDouble and this takes care of the problem. Bloody floating point numbers and their computational limits.
Surround yourself with people whose eyes light up when they see you and who have no agenda for your reform.
Member Since Nov 27, 2010   244 posts
Apr 27, 2011 at 22:31
Lolz...
Consistency above all.
Member Since Nov 27, 2010   244 posts
Jan 12, 2012 at 11:04
2012-01-12 Soft SL (-1.38%) was well-executed. Overall very pleased. It may be lost on non-system traders but for a smooth equity curve system like this, those in the know know it is not easy to achieve.
Consistency above all.
Member Since Nov 27, 2010   244 posts
Jan 26, 2012 at 02:37
2012-01-26 Confirmed better performance of update, will be shifted to Live accounts. Updated from 15.10.26 to 16.2.4
Consistency above all.
Member Since Nov 27, 2010   244 posts
May 02, 2012 at 00:48
2012-05-01 Soft SL (-3%) hit. Not a good idea to be trading with so many countries being on holiday. China, Japan, Switzerland, France, Germany, Italy. Primary action from Australia, UK and US markets only. Didn't really affect (or so I observe/think) but RBA changed its cash rate from 4.5% to 3.75%, down 0.25% more than the expected 4.00%. US ISM Manufacturing was a mover.
Consistency above all.
Member Since Nov 27, 2010   244 posts
May 31, 2012 at 16:57
Been a quiet week.

Would have preferred earlier notification of mandatory update to MT4 builds 416 and above, but I understand it is a Metaquotes issue and not from the brokers. Testing has not been as comprehensive as I would have liked.

MT4 updated to build 427 for June 1st operation onwards.
Consistency above all.
Member Since Nov 27, 2010   244 posts
May 31, 2012 at 16:57
Whoops, 419 for IBFX.
Consistency above all.
ForexScam
forex_trader_32776
Member Since Mar 28, 2011   1008 posts
Oct 25, 2012 at 21:28
sorry to see your alpari pamm accounts no longer under your profile. 😭
I've been watching them for a long time and didn't expect them to crash.
All the asian scalpers were hit badly.
Member Since Nov 27, 2010   244 posts
Oct 26, 2012 at 05:10
They went down within their set parameters and should recover given time. That's the plan at least. ;)
Consistency above all.
ForexScam
forex_trader_32776
Member Since Mar 28, 2011   1008 posts
Oct 26, 2012 at 09:15
Best Luck to the recovery.
Sign In / Sign Up to comment
You must be connected to Myfxbook in order to leave a comment
*Commercial use and spam will not be tolerated, and may result in account termination.
Tip: Posting an image/youtube url will automatically embed it in your post!
Tip: Type the @ sign to auto complete a username participating in this discussion.