CodeGenius v3.0 “Monte Carlo Forex”: The Most Sophisticated Robot I Ever Designed is to be released soon…
Complete with Semi-Martingale and Martingale that based on Higher Dimensions of Topological Spaces and Methodology that implements Chaos Theory, Turbulence and Markov Chain on Monte Carlo Algorithm in FOREX.
//+——————————————————————————–+
//| Neural Kohonen-Hebbian Self-Learning Networks |
//| Copyright © 2011, Mohamad Izaham Bin Mohamed Yatim |
//| http://www.omnifarm.biz |
//| COMPLETE VERSION 2.66 FINAL WITH CORRECT FUNCTIONS |
//+——————————————————————————–+
#property copyright “Copyright © 2011, Mohamad Izaham Bin Mohamed Yatim”
#property link “http://www.omnifarm.biz”
#include <stdlib.mqh>
#include <WinUser32.mqh>
// exported variables
extern double Amount32 = 0;
extern double BuyLots46 = 0.1;
extern double Amount51 = 0;
extern double SellLots40 = 0.1;
// local variables
double PipValue=1; // this variable is here to support 5-digit brokers
bool Terminated = false;
string LF = “\n”; // use this in custom or utility blocks where you need line feeds
int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks
int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names
int current = 0;
int Count19 = 0;
int init()
{
NDigits = Digits;
if (true) ObjectsDeleteAll(); // clear the chart
Comment(“”); // clear the chart
}
// Expert start
int start()
{
if (Bars < 10)
{
Comment(“Not enough bars”);
return (0);
}
if (Terminated == true)
{
Comment(“EA Terminated.”);
return (0);
}
OnEveryTick53();
}
//————————————————————–
// Put Your Mathematical Functions In Here!
//————————————————————–
//
//
//
//
//————————————————————–
void OnEveryTick53()
{
if (true == false && true) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
PrintToLog25();
IfDemo26();
PrintInfoToChart19();
IfOrderExists34();
IfOrderDoesNotExist52();
IfOrderExists49();
IfTesting28();
IfOrderDoesNotExist42();
}
void PrintToLog25()
{
Print(“I am Thinking, Honey…”);
}
void IfDemo26()
{
if (IsDemo())
{
Terminate27();
}
}
void Terminate27()
{
Print(“EA Terminated.”);
Terminated = true;
}
void PrintInfoToChart19()
{
string temp = “Some Text\nExecuted : ” + Count19 + “\n”
+ “Spread: ” + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2)+ “\n”
+ “————————————————\n”
+ “ACCOUNT INFORMATION:\n”
+ “\n”
+ “Account Name: ” + AccountName()+ “\n”
+ “Account Leverage: ” + DoubleToStr(AccountLeverage(), 0)+ “\n”
+ “Account Balance: ” + DoubleToStr(AccountBalance(), 2)+ “\n”
+ “Account Equity: ” + DoubleToStr(AccountEquity(), 2)+ “\n”
+ “Free Margin: ” + DoubleToStr(AccountFreeMargin(), 2)+ “\n”
+ “Used Margin: ” + DoubleToStr(AccountMargin(), 2)+ “\n”
+ “————————————————\n”;
Comment(temp);
Count19++;
}
void IfOrderExists34()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
if (exists)
{
TechnicalAnalysis3xOr33();
CloseOrderIf32();
}
}
void TechnicalAnalysis3xOr33()
{
if ((0 > 0) || (0 > 0) || (0 > 0))
{
BuyOrderModifyFlex31();
}
}
void BuyOrderModifyFlex31()
{
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
double SL = NormalizeDouble(Low[1], NDigits);
double TP = NormalizeDouble(High[1], NDigits);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, White);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
PrintToLog30();
}
void PrintToLog30()
{
Print(“Buy Order Modify Flexy”);
}
void CloseOrderIf32()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
if (OrderProfit() > Amount32)
{
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}
PrintToLog29();
}
void PrintToLog29()
{
Print(“Buy Order Close If”);
}
void IfOrderDoesNotExist52()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
if (exists == false)
{
TechnicalAnalysis3xOr48();
}
}
void TechnicalAnalysis3xOr48()
{
if ((0 > 0) || (0 > 0) || (0 > 0))
{
BuyOrderFlex46();
}
}
void BuyOrderFlex46()
{
double SL = NormalizeDouble(Low[1], NDigits);
if (Low[1] == 0) SL = 0;
double TP = NormalizeDouble(High[1], NDigits);
if (High[1] == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots46, Ask, 4, 0, 0, “My Expert”, 1, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots46, Ask, 4, SL, TP, “My Expert”, 1, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
PrintToLog47();
}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}
void PrintToLog47()
{
Print(“Buy Order Initiated”);
}
void IfOrderExists49()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
if (exists)
{
TechnicalAnalysis3xOr50();
CloseOrderIf51();
}
}
void TechnicalAnalysis3xOr50()
{
if ((0 > 0) || (0 > 0) || (0 > 0))
{
SellOrderModifyFlex45();
}
}
void SellOrderModifyFlex45()
{
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
double SL = NormalizeDouble(High[1], NDigits);
double TP = NormalizeDouble(Low[1], NDigits);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, White);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
}
PrintToLog43();
}
void PrintToLog43()
{
Print(“Sell Order Modify Flexy”);
}
void CloseOrderIf51()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
if (OrderProfit() > Amount51)
{
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red);
if (ret == false)
Print(“OrderClose() error – “, ErrorDescription(GetLastError()));
}
}
PrintToLog44();
}
void PrintToLog44()
{
Print(“Sell Order Close If”);
}
void IfTesting28()
{
if (IsTesting())
{
Terminate27();
}
}
void IfOrderDoesNotExist42()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i–)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print(“OrderSelect() error – “, ErrorDescription(GetLastError()));
}
if (exists == false)
{
TechnicalAnalysis3xOr41();
}
}
void TechnicalAnalysis3xOr41()
{
if ((0 > 0) || (0 > 0) || (0 > 0))
{
SellOrderFlex40();
}
}
void SellOrderFlex40()
{
double SL = NormalizeDouble(High[1], NDigits);
if (High[1] == 0) SL = 0;
double TP = NormalizeDouble(Low[1], NDigits);
if (Low[1] == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, SellLots40, Bid, 4, 0, 0, “My Expert”, 1, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, SellLots40, Bid, 4, SL, TP, “My Expert”, 1, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print(“OrderModify() error – “, ErrorDescription(GetLastError()));
}
PrintToLog39();
}
else
{
Print(“OrderSend() error – “, ErrorDescription(GetLastError()));
}
}
void PrintToLog39()
{
Print(“Sell Order Flexy Initiated “);
}
int deinit()
{
if (true) ObjectsDeleteAll();
}







I am forever thought about this, thanks for posting .
An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!
I see something genuinely special in this web site .
Some really nice stuff on this web site , I love it.
Loving the info on this internet site , you have done outstanding job on the content .
I consider something genuinely special in this internet site .
I believe this web site has some really excellent information for everyone : D.
I got what you intend, thankyou for posting .Woh I am pleased to find this website through google.
I like this site so much, saved to favorites .
I like the valuable info you provide in your articles. I¡¦ll bookmark your blog and check again here regularly. I’m quite certain I will learn a lot of new stuff right here! Best of luck for the next!
You are so cool! I don’t think I’ve read through a single thing like that before. So great to discover someone with a few original thoughts on this subject matter. Really.. thanks for starting this up. This site is one thing that is required on the internet, someone with a bit of originality!
As soon as I noticed this website I went on reddit to share some of the love with them.
Very interesting topic , thankyou for posting .
Cool, there is actually some good points on this post some of my friends might find this relevant, will send them a link, many thanks.
You have noted very interesting details ! ps nice site.
I am not real superb with English but I come up this really easygoing to interpret .
Sweet internet site , super layout, rattling clean and utilise genial .
Really clean site, appreciate it for this post.
You have observed very interesting details ! ps nice site.
Regards for this post, I am a big big fan of this web site would like to proceed updated.
Way cool! Some extremely valid points! I appreciate you penning this article plus the rest of the site is also very good.
You have brought up a very excellent details , appreciate it for the post.
I am not real excellent with English but I get hold this really leisurely to interpret .
I like this web blog very much so much great info .
I don’t unremarkably comment but I gotta admit appreciate it for the post on this perfect one : D.
Utterly pent subject material , thankyou for information .
I conceive other website proprietors should take this site as an model, very clean and superb user pleasant style .
I believe this site holds very fantastic pent articles posts .
Glad to be one of several visitors on this awing website : D.
This internet site is my intake , very excellent style and design and perfect subject material .
Perfect piece of work you have done, this internet site is really cool with fantastic information.
I went over this web site and I believe you have a lot of wonderful information, saved to favorites (:.
Very interesting topic , appreciate it for posting .
I also think so , perfectly pent post! .
so much good information on here, : D.
Its fantastic as your other posts : D, thanks for putting up.
I don’t normally comment but I gotta tell thanks for the post on this great one : D.
Great goods from you, man. I have understand your stuff previous to and you are just too fantastic. I actually like what you have acquired here, certainly like what you’re saying and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I cant wait to read far more from you. This is really a tremendous web site.
Merely wanna input that you have a very nice website , I like the layout it really stands out.
Very interesting info !Perfect just what I was looking for!
Thankyou for helping out, fantastic info .
Some truly nice stuff on this website , I enjoy it.
I like this blog very much so much wonderful information.
I as well conceive therefore , perfectly pent post! .
Some genuinely interesting points you have written. Aided me a lot, just what I was searching for : D.
Loving the information on this internet site , you have done great job on the content .
I truly value your work , Great post.
As soon as I detected this site I went on reddit to share some of the love with them.
I am thankful that I found this web site, precisely the right information that I was looking for! .
I think this is among the most vital information for me. And i’m glad reading your article. But wanna remark on some general things, The website style is ideal, the articles is really great : D. Good job, cheers
Appreciate it for this marvelous post, I am glad I discovered this website on yahoo.
I conceive this web site contains very great pent subject matter posts .
I discovered your weblog web site on google and verify just a few of your early posts. Continue to keep up the very good operate. I just further up your RSS feed to my MSN News Reader. Searching for ahead to reading extra from you afterward!…
You are my breathing in, I possess few web logs and sometimes run out from to brand : (.
I think this site has some very wonderful information for everyone : D.
I like this internet site because so much utile material on here : D.
Keep up the superb piece of work, I read few blog posts on this internet site and I think that your web blog is rattling interesting and holds bands of fantastic information.
I really like meeting utile info, this post has got me even more info! .
Sweet internet site , super design and style , rattling clean and use genial .
I conceive you have noted some very interesting details , appreciate it for the post.
Yeah bookmaking this wasn’t a high risk determination outstanding post! .
Yay google is my queen aided me to find this great web site ! .
Really appreciate you sharing this blog post.Really looking forward to read more. Awesome.
Hmm it looks like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to the whole thing. Do you have any recommendations for first-time blog writers? I’d really appreciate it.
Awesome article post.Really looking forward to read more. Cool.
Major thankies for the article.Really looking forward to read more. Cool.
Thanks for your marvelous posting! I actually enjoyed reading it, you happen to be a great author.I will make sure to bookmark your blog and definitely will come back later on. I want to encourage you to continue your great posts, have a nice evening!
Have you ever considered about adding a little bit more than just your articles? I mean, what you say is valuable and all. But imagine if you added some great pictures or videos to give your posts more, “pop”! Your content is excellent but with pics and video clips, this site could undeniably be one of the greatest in its field. Great blog!
Im grateful for the blog article. Cool.
Hi there! This post could not be written any better! Reading this post reminds me of my old room mate! He always kept chatting about this. I will forward this page to him. Fairly certain he will have a good read. Many thanks for sharing!
At this time it looks like Movable Type is the preferred blogging platform out there right now. (from what I’ve read) Is that what you’re using on your blog?
Really appreciate you sharing this post.Really thank you! Awesome.
I cannot thank you enough for the post.Really looking forward to read more. Cool.
Very good blog post.Thanks Again. Will read on…
Thanks for sharing, this is a fantastic blog article.Thanks Again. Much obliged.
Wow, great post.Much thanks again. Will read on…
I cannot thank you enough for the blog.Really thank you! Really Cool.
Thanks for the article.Thanks Again. Keep writing.
Thanks-a-mundo for the blog article.Really thank you! Awesome.
Really enjoyed this blog.Really looking forward to read more. Really Great.
I truly appreciate this blog.Really looking forward to read more. Keep writing.
I really like and appreciate your blog article.Thanks Again. Want more.
Thanks a lot for the blog post.Thanks Again. Fantastic.
Thanks again for the post. Much obliged.
Thanks so much for the article.Really looking forward to read more. Awesome.
I really enjoy the article. Keep writing.
Awesome blog post.Really looking forward to read more. Keep writing.
Hello, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam responses? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it’s driving me mad so any help is very much appreciated.
Great article post. Want more.
I think this is a real great post.Really looking forward to read more. Fantastic.
Awesome website you have here but I was wondering if you knew of any user discussion forums that cover the same topics discussed in this article? I’d really like to be a part of community where I can get suggestions from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Thanks a lot!
But wanna remark on few general things, The website pattern is perfect, the subject matter is real good : D.
I like the valuable information you provide in your articles. I will bookmark your blog and check again here regularly. I’m quite sure I will learn many new stuff right here! Good luck for the next!
Would love to incessantly get updated outstanding blog ! .
Some truly nice stuff on this web site , I like it.
Some really prime blog posts on this web site , bookmarked .
Wow, great blog article.Really thank you! Really Cool.
This design is incredible! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really loved what you had to say, and more than that, how you presented it. Too cool!
Great, thanks for sharing this post.Thanks Again. Cool.
Thanks again for the post. Keep writing.
A big thank you for your blog article.Really looking forward to read more. Want more.
Major thanks for the blog article.Really thank you! Really Great.
Hey, thanks for the blog.Thanks Again. Really Great.
Really informative blog.Thanks Again. Keep writing.
I’m not that much of a online reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. Many thanks
http://anticyberforensics.wordpress.com/2011/09/08/my-written-submission-for-the-reversal-of-malicious-prosecution-and-recalcitrant-of-magistrate-malice-defeats-immunity-judicial-immunity-2/attachment/1267/
Im thankful for the article.Really looking forward to read more. Cool.
I really liked your article.Thanks Again. Will read on…
http://wordpress.hotpress.com/robsmith/2012/01/27/the-kaiser-the-victor-lustig-of-football/kaiser-470/
Fantastic blog.Thanks Again. Really Great.
A big thank you for your blog.Really thank you! Will read on…