//+------------------------------------------------------------------+ //| ExAccount.mq4 | //| Copyright © 2006, Alex Sidd (Executer) | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Alex Sidd (Executer)" #property link "mailto:work_st@mail.ru" #property show_inputs //---- #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| Executer Account Script | //+------------------------------------------------------------------+ int start() { int i, j = 0, counted_bars = IndicatorCounted(); i = Bars - 1; string m_buf, m_data, m_type, m_order; datetime tim; int handle, m_find, count = 0; handle = FileOpen("StrategyTester.htm", FILE_READ, ';'); if(handle < 1) { MessageBox("File StrategyTester.htm not found", "Script", MB_OK); return(false); } while(FileIsEnding(handle)!=true) { m_buf = FileReadString(handle, 0); m_find = StringFind(m_buf, "<td class=msdate>", 0); if(m_find != -1) { m_data = StringSubstr(m_buf, m_find + 17, 16); if(StringFind(m_buf, "buy", 0) != -1) { m_type = "buy"; m_find = StringFind(m_buf, "buy</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 12); m_order = StringSubstr(m_buf, m_find + 12, count - m_find - 12); } } if(StringFind(m_buf, "sell", 0) != -1) { m_type = "sell"; m_find = StringFind(m_buf, "sell</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 13); m_order = StringSubstr(m_buf, m_find + 13, count - m_find - 13); } } if(StringFind(m_buf, "close", 0) != -1) { m_type = "close"; m_find = StringFind(m_buf, "close</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 14); m_order = StringSubstr(m_buf, m_find + 14, count - m_find - 14); } } if(StringFind(m_buf, "modify", 0) != -1) { m_type = "modify"; m_find = StringFind(m_buf, "modify</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 15); m_order = StringSubstr(m_buf, m_find + 15, count - m_find - 15); } } if(StringFind(m_buf, "s/l", 0) != -1) { m_type = "s/l"; m_find = StringFind(m_buf, "s/l</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 12); m_order = StringSubstr(m_buf, m_find + 12, count - m_find - 12); } } if(StringFind(m_buf, "t/p", 0) != -1) { m_type = "t/p"; m_find = StringFind(m_buf, "t/p</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 12); m_order = StringSubstr(m_buf, m_find + 12, count - m_find - 12); } } if(StringFind(m_buf, "close at stop", 0) != -1) { m_type = "close at stop"; m_find = StringFind(m_buf, "close at stop</td><td>", 0); if(m_find != -1) { count = StringFind(m_buf, "<", m_find + 22); m_order = StringSubstr(m_buf, m_find + 22, count - m_find - 22); } } //----------- tim = StrToTime(m_data); // if(tim>Time[i]&&tim<Time[i-1]) tim = i = Bars - 1; while(i >= 0) { if(tim >= Time[i] && tim < Time[i-1]) { if(m_type == "sell") { ObjectCreate("Sell" + m_order, OBJ_ARROW, 0, tim, High[i] + 20*Point); ObjectSet("Sell" + m_order, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN); ObjectSet("Sell" + m_order, OBJPROP_COLOR, Red); } if(m_type == "buy") { ObjectCreate("Buy" + m_order, OBJ_ARROW, 0, tim, Low[i] - 20*Point); ObjectSet("Buy" + m_order, OBJPROP_ARROWCODE, SYMBOL_ARROWUP); ObjectSet("Buy" + m_order, OBJPROP_COLOR, Blue); } if(m_type == "close") { ObjectCreate("Close" + m_order, OBJ_ARROW, 0, tim, High[i] + 10*Point); ObjectSet("Close" + m_order, OBJPROP_ARROWCODE, SYMBOL_STOPSIGN); ObjectSet("Close" + m_order, OBJPROP_COLOR, Black); } if(m_type == "s/l") { ObjectCreate("Stop Limit" + m_order, OBJ_ARROW, 0, tim, High[i] + 15*Point); ObjectSet("Stop Limit" + m_order, OBJPROP_ARROWCODE, SYMBOL_CHECKSIGN); ObjectSet("Stop Limit" + m_order, OBJPROP_COLOR, Red); } if(m_type == "t/p") { ObjectCreate("Take Profit" + m_order, OBJ_ARROW, 0, tim, High[i] + 15*Point); ObjectSet("Take Profit" + m_order, OBJPROP_ARROWCODE, SYMBOL_CHECKSIGN); ObjectSet("Take Profit" + m_order, OBJPROP_COLOR, Green); } if(m_type == "modify") { ObjectCreate("Modify" + m_order, OBJ_ARROW, 0, tim, High[i] + 5*Point); ObjectSet("Modify" + m_order, OBJPROP_ARROWCODE, 4); ObjectSet("Modify" + m_order, OBJPROP_COLOR, Blue); } break; } i--; } //----------- } // MessageBox(m_data+" "+m_type+" "+m_order,"Script",MB_OK); j++; } FileClose(handle); return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
Uses files from the file system
It opens Message Boxes to the user
It reads information from a file