<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6968683766762345396</id><updated>2011-07-08T06:25:43.167-07:00</updated><category term='Trading'/><category term='Trading Tips'/><category term='Trading Systems'/><category term='Finances'/><category term='billionaire meeting'/><category term='MQL4 Language'/><category term='Stock-Market Purchases'/><title type='text'>Forex Trading Course</title><subtitle type='html'>Learn About Trading Currencies Online</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-7177254268551452757</id><published>2009-06-26T08:04:00.000-07:00</published><updated>2009-07-08T22:39:57.423-07:00</updated><title type='text'>Trading Video Tutorial: How To Combining Various Technical Analysis Techniques</title><content type='html'>In analysing market using Technical Analysis, various techniques are often combined to complement and support one another.&lt;br /&gt;This video of the current S&amp;P 500 market analysis shows an example of that.&lt;br /&gt;&lt;br /&gt;Some of the analyses mentioned in the video are as follow:&lt;br /&gt;* 200 Moving Average &amp; 50 Moving Average Crossover&lt;br /&gt;* Doji candlestick&lt;br /&gt;* MACD Indicator&lt;br /&gt;* Trendline&lt;br /&gt;* PSAR (Parabolic Stop and Reverse)&lt;br /&gt;* Double Top reversal pattern&lt;br /&gt;* Fibonacci Retracement&lt;br /&gt;&lt;div class="fullpost"&gt;&lt;br /&gt;(In case you need more information about the above analysis, you can click the links above to the articles in this blog that discuss further about those topics)&lt;br /&gt;&lt;br /&gt;Other than learning the tips how to make use &amp; combine various technical techniques to complement and support certain analysis, from this video you can also get some useful tips for your trading.&lt;br /&gt;&lt;br /&gt;Analysis Tool:&lt;br /&gt;&lt;a href="http://www.ino.com/info/179/CD3182/&amp;dp=0&amp;l=0&amp;campaignid=12"&gt;&lt;/a&gt;Get Free Trend Analysis for your favorite symbols&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-7177254268551452757?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/7177254268551452757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=7177254268551452757&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7177254268551452757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7177254268551452757'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/06/trading-video-tutorial-how-to-combining.html' title='Trading Video Tutorial: How To Combining Various Technical Analysis Techniques'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-578927646248912593</id><published>2009-06-22T08:09:00.000-07:00</published><updated>2009-06-22T08:16:22.692-07:00</updated><title type='text'>Get Know About Stop Limit Order</title><content type='html'>Stop Limit Order is an order (buy/sell) to close a position that only executes when the current market price of an option/stock hit or passes through a predetermined price (i.e. Stop Price).&lt;br /&gt;Once the Stop Price is passed, the Stop Order becomes a Limit Order, and can only be executed at a specific price (i.e. Limit Price) or better.&lt;br /&gt;&lt;br /&gt;As you may have noticed, Stop Limit Order is almost similar to Stop Order. The main difference is that in Stop Limit Order, when the Stop Price is passed, the order will be converted into a Limit Order, whereas for Stop Order, it’ll convert into a Market Order.&lt;br /&gt;&lt;br /&gt;Depending on the position on the market you have (long or short), there are 2 types of Stop Limit Order:&lt;br /&gt;a) Sell Stop Limit&lt;br /&gt;This is the stop limit order when you have a long position on a security.&lt;br /&gt;In this case, the Stop Price is placed below current market price of the security, and the Limit Price should be placed at least the same as or lower than the Stop Price.&lt;br /&gt;&lt;br /&gt;b) Buy Stop Limit&lt;br /&gt;This is the stop limit order when you have a short position on a security.&lt;br /&gt;In this case, the Stop Price is placed above current market price of the security, and the Limit Price should be placed at least the same as or higher than the Stop Price.&lt;br /&gt;&lt;div class="fullpost"&gt;&lt;br /&gt;Characteristic &amp; Risk of Stop Limit Order:&lt;br /&gt;Stop Limit Order will remain inactive until the Stop Price is passed. Once the Stop Price is passed, the order will be activated as a Limit Order to buy/sell at the specified Limit Price or better.&lt;br /&gt;Therefore, the advantage of Stop Limit Order is that it provides control over the price at which the order will get filled (i.e. at the Limit Price or better).&lt;br /&gt;However, the disadvantage is that a Stop Limit Order may never get filled if the market price is worse than the Limit Price. As a result, the position can continue falling with no more protection for the position. This makes a Stop Limit Order a very insecure stop loss method, particularly for the extremely volatile stocks that often experience a gap up or gap down in prices.&lt;br /&gt;Due to this risk, using Stop Limit Order to protect a position is not advisable.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;Suppose a Sell Stop Limit order were placed to protect a long position on an option with a Stop Price at $2/contract and Limit Price at $1.5. The current market price is $2.5/contract.&lt;br /&gt;This order would remain inactive, unless the price reaches or drops below $2. When that happens, the order would then turn into a Limit Order.&lt;br /&gt;As long as the order can be filled at $1.5 or higher, the order will be filled.&lt;br /&gt;However, in case the market price gap down at $1 and then continue to fall, the order will not be filled.&lt;br /&gt;&lt;br /&gt;The Difference between Stop Limit Order and LIT Order:&lt;br /&gt;Stop Limit Order is actually quite similar to Limit-If-Touched (LIT) order.&lt;br /&gt;The difference between Stop Limit Order and LIT order is basically on the placement of predetermined price that triggers its execution (i.e. “Stop Price” for Stop Limit Order and “Trigger Price” for LIT Order) and Limit Price relative to the current market price.&lt;br /&gt;&lt;br /&gt;* For Sell order, the Stop Price &amp; Limit Price for a Sell Stop Limit Order are placed below the current market price, whereas the Trigger Price &amp; Limit Price for a Sell LIT Order are placed above the current market price.&lt;br /&gt;&lt;br /&gt;* For Buy order, the Stop Price &amp; Limit Price for a Buy Stop Limit Order are placed above the current market price, whereas the Trigger Price &amp; Limit Price for a Buy LIT Order are placed below the current market price.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-578927646248912593?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/578927646248912593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=578927646248912593&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/578927646248912593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/578927646248912593'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/06/get-know-about-stop-limit-order.html' title='Get Know About Stop Limit Order'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-2732018876301875219</id><published>2009-06-19T19:30:00.000-07:00</published><updated>2009-06-22T07:57:38.134-07:00</updated><title type='text'>Understand The Various Economic Indicators To Drifting Success In Forex</title><content type='html'>Understanding the various economic indicators is valueable to drifting success in forex that have daily fluctuation.&lt;br /&gt;&lt;br /&gt;1) Current Events: Whether the economy of any particular country is showing decline or improvement can be detected from economic reports released at scheduled times by the government. When analyzing an opportunity to invest in the Forex, experienced Forex traders always focus on current events and the state of the economy as the top indicator. Unemployment figures, housing statistics and the current state of affairs all affect the prices of the Forex.&lt;br /&gt;&lt;br /&gt;2) GDP: Another economic factor widely used when analyzing the Forex is the GDP or the Gross Domestic Product. This is the broadest measure of the economy of a country. The GDP is composed of the total value of all goods and services produced within any given country, usually measured in the one-year time frame.&lt;br /&gt;&lt;div class="fullpost"&gt;&lt;br /&gt;3) Retail Sales Reports:This is not the sum of all retail sales, but is basically random samples from various retail stores throughout the country. It is considered the most reliable economic indicator because you can detect consumer spending patterns throughout the year from the retail sales reports.&lt;br /&gt;&lt;br /&gt;4) The Industrial Production Report: This is another reliable economic indicator which shows changes in production outputs in industries such as factories, mines, and utilities. The report compares what is actually produced with the production capacity over a period of time. When a country is producing at its maximum capacity, this will definitely affect the Forex and is considered ideally positive for Forex traders.&lt;br /&gt;&lt;br /&gt;5) CPI: The last but very vital economic factor is the Consumer Price Index or the CPI. This reflects the changes in consumer goods prices in 200 categories.&lt;br /&gt;&lt;br /&gt;As you can see, the Forex is affected by many factors. Some are positive while others are negative. To make money trading Forex, you should understand them thoroughly and take these indicators into account for accurate Forex predictions.&lt;br /&gt;&lt;br /&gt;Keep on learning and keep on making money trading Forex.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-2732018876301875219?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/2732018876301875219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=2732018876301875219&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/2732018876301875219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/2732018876301875219'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/06/understand-various-economic-indicators.html' title='Understand The Various Economic Indicators To Drifting Success In Forex'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-7497438250733891264</id><published>2009-06-19T19:26:00.000-07:00</published><updated>2009-06-19T19:30:17.249-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trading Tips'/><title type='text'>5 Quick Tips To Make Trading as Your Daily Income</title><content type='html'>The real meaning of day trading comprises mainly of buying and selling of financial equipment on one day duration of trade. Unlike the long-term type of investment, day trading offers almost limitless opportunities for investors and promises immediate results, that is, of either profit or loss. In addition, this is again that kind of business wherein fortunes are made or dreams are shattered on a daily basis. So with that, it is very important for investors like you to have what it takes to succeed in this kind of trading, and enjoy great benefits it offers.&lt;br /&gt;&lt;br /&gt;Given the moniker as "adrenaline junkies", and better suited for it for good measure, investors in day trading have found the necessity of mastering two or more of the strategies when it comes to dealing the business in the stock market. As implied above, day trading has its good share of advantages and downsides. And the amount of success, or bereft of it, will be determined also by the amount of effort you exert in preparing yourself by learning the proper techniques and applying the right strategies during a day trade, which can help you in making calculated steps in all your investments in the stock market. Yet again, it should be said that there have been many people who have made a good living in day trading, and even earning millions of dollars out of this kind of trade.&lt;br /&gt;&lt;div class="fullpost"&gt;&lt;br /&gt;That said, this article provides you now the 5 invaluable quick tips on how to day trade for a living, which can certainly serve you as an excellent guide in getting the best return in your investments. The following are:&lt;br /&gt;&lt;br /&gt;1. Trend Trading&lt;br /&gt;It incorporates the idea of supporting the stock, commodities, or options that are on the rise by buying them, or selling those that are on the decline in the market. Day traders would make the trade by following the trend of the day, and would eventually exit the trading platform when the trend changes course. This technique is said to have developed out of common sense among investors and work effective to some investors.&lt;br /&gt;&lt;br /&gt;2. Contrarian Trading&lt;br /&gt;As the term suggests, this second tip is the exact opposite of Trend Trading. The investors use this strategy by buying financial equipment that are on the decline, and selling those that are on the rise. This technique is all about good timing, anticipating the reverse of trend in the stock market.&lt;br /&gt;&lt;br /&gt;3. Channel or Range Trading&lt;br /&gt;Traders use this strategy by buying stock that are at their low prices and short selling stock at their high prices. This move will allow some balance in the stock market by supporting financial equipment that is falling.&lt;br /&gt;&lt;br /&gt;4. Scalping&lt;br /&gt;Scalping has been referred to before as spread trading. This strategy involves taking advantage of some price gaps that have resulted from bid-ask situation, exploiting profit opportunities while minimizing the risk of loss. The main idea of scalping is to take advantage of some imbalance in the market and make good investments out of it.&lt;br /&gt;&lt;br /&gt;5. Trading Rumors or News Playing&lt;br /&gt;This is the most common strategy used by many investors. Day traders have been using this technique as basis of their investment decisions in day trading. It suggests the idea of playing with available leads that are currently happening in the stock market, and making decisions based on some good trading rumors or on bad trading rumors.&lt;br /&gt;&lt;br /&gt;Finally, like any business endeavors, the present risks in day trading can be aplenty. But how one deals with the risks can make the big difference of either great rewards or enormous losses. Furthermore, you need to have a good plan on when to make your entry trade or exit trade, and a good strategy or strategies before entering any trade. Those aforementioned quick tips and techniques have been developed to help you make the most out of day trading. Moreover, the other key to ensure your success in this field is the due-diligence that is required from all of us in the business.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-7497438250733891264?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/7497438250733891264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=7497438250733891264&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7497438250733891264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7497438250733891264'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/06/5-quick-tips-to-make-trading-as-your.html' title='5 Quick Tips To Make Trading as Your Daily Income'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-7397189045950684945</id><published>2009-05-29T01:53:00.000-07:00</published><updated>2009-06-01T01:12:37.673-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trading Systems'/><title type='text'>What about Hedging Daily?</title><content type='html'>&lt;div style="clear: both;" id="article_content" align="justify"&gt;&lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p align="justify"&gt;I am giving away an idea of hedging the GBP/JPY &amp;amp; EUR/JPY daily. Yes Daily. This idea popped up while I was trying to generate a trading system that plays on the daily scheme, opening the trade only once a day, collecting the profit only around $100 each day, and of course, all the things do automatically. At the first time, I only tried to trade with the TD-Sequential System, owned by Tom Demark. I tried trading it daily, actually it dose a good system, but somehow give me an unacceptable loss, then the idea of hedging the two correlated pairs came out. "Why don't hedge ?, then you will lose less than today or maybe you can gain, sounds grate ! ". Then i tested it manually with 1 month past history, and found a good profit maker sign. So...no need to wait for anything, just make it automatically trade for you and test it live for a couple of months or longer. Now let's start making it comes true.&lt;/p&gt;   &lt;h3&gt;Concept of Daily Hedge&lt;/h3&gt;        &lt;p&gt;Before we start the coding process, let's make a plan together. Including...&lt;div class="fullpost"&gt; &lt;br /&gt;-&gt; What will we use for signaling the daily trading trend? : This will give us the estimate today's direction of GBP/JPY and EUR/JPY (these two pairs are always 90% correlated) . In this case i still choose the TD-Sequential System, an easy TD-Sequential I've found in a forum, to give me the daily signal.&lt;/p&gt;  &lt;p&gt; -&gt; Which hedging pairs to hedge? : Just select your favorite pairs. Mine are GBP/JPY and EUR/JPY, with the reason above.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt; -&gt; Which pair will be the base pair? &amp;amp; Which one will be the hedge pair? : This will make it easier to code the EA. I decided to mark the EUR/JPY as my base pair and hedge GBP/JPY. ("Why Base &amp;amp; Hedge?", that's because of the system is hedge by the daily trend.) For example, today the TD-Sequential signal out the UP trend of EUR/JPY, then I will BUY EUR/JPY and hedge by selling GBP/JPY. Or maybe you can make sure by mark the UP day only when both EUR/JPY and GBP/JPY are showing the TD-Sequential UP, then buy the base pair &amp;amp; sell the hedge pair.&lt;/p&gt;  &lt;p&gt; -&gt; What is the ... correlation ? : Of course, we need this factor, and you all know, it is an important factor of hedging system. In this case, I will only allow to hedge when the correlation of those two pairs is 0.9 or higher only. YES, please don't be astonished. Yes 0.9+ "WHY ?", I know every hedge professor suggests you to hedge when the correlation is low, but that is for a very very and very long - term . To me and my daily hedging system, hedging at high correlation is better. Please NOTE that, this is for my daily hedging system only. Because we need them to go the same way always, especially for today (our trading day), then we can get one positive and one negative always and then only collect the profit when they swing, even they were never swing in the profitable way, you still loss less than one way in negative trade.&lt;br /&gt;&lt;/p&gt;    &lt;p&gt; O.K. Now let's start coding.&lt;/p&gt;      &lt;h3&gt;Daily Hedge Expert Advisor&lt;/h3&gt;  &lt;p&gt;In this part, I will separate it into 5 major parts, that is . &lt;/p&gt;   &lt;ol&gt;&lt;li&gt;The Input Parameters&lt;/li&gt;&lt;li&gt;The Daily Trend Signal Function&lt;/li&gt;&lt;li&gt;The Trade Function&lt;/li&gt;&lt;li&gt;The Trading Process&lt;/li&gt;&lt;li&gt;Showing The Hedging Status Function&lt;/li&gt;&lt;/ol&gt;  &lt;p&gt;And now let's begin with the input parameters.&lt;/p&gt;    &lt;div style="text-align: justify;"&gt; &lt;h3&gt;1. Input Parameters&lt;/h3&gt;  &lt;/div&gt;&lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~External Input Parameters~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;BlockOpening&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;ShowStatus&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;Auto_Lot_______________________&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;_______&lt;/span&gt;&lt;span class="hl-code"&gt;"; &lt;/span&gt;&lt;span class="hl-comment"&gt;// Always Calculate The Lot Size Automatically&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;PercentMaxRisk&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;25&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// With Max Risk Of 25% by default&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;How_Much_You_Xpect&lt;/span&gt;&lt;span class="hl-code"&gt;?&lt;/span&gt;&lt;span class="hl-identifier"&gt;____________&lt;/span&gt;&lt;span class="hl-code"&gt; ="&lt;/span&gt;&lt;span class="hl-identifier"&gt;_______&lt;/span&gt;&lt;span class="hl-code"&gt;"; &lt;/span&gt;&lt;span class="hl-comment"&gt;// The Getting Profit Part&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Daily_Percent_ROI&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;7.98&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// How many daily %ROI you wish.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;AcceptableLoss_ROI&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;3.08&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// daily Acceptable loss calculated in ROI scheme.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Internal Input Parameters~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;GBPJPY&lt;/span&gt;&lt;span class="hl-code"&gt;";&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;EURJPY&lt;/span&gt;&lt;span class="hl-code"&gt;";&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// just for checking that short-term&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;5&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;//&amp;amp; long-term Correlation are the same concederation level&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;AutoLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;H_B_LotsRatio&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1.50&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// always hedge those 2 pairs by 1:1.5 ratio&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;MMBase&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;ExpectCorrelation______________&lt;/span&gt;&lt;span class="hl-code"&gt;= "&lt;/span&gt;&lt;span class="hl-identifier"&gt;______&lt;/span&gt;&lt;span class="hl-code"&gt;"; &lt;/span&gt;&lt;span class="hl-comment"&gt;// the concederation level of their correlation.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Between&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1.05&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;And&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0.9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;TDSequential&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;______&lt;/span&gt;&lt;span class="hl-code"&gt;"; &lt;/span&gt;&lt;span class="hl-comment"&gt;// my easy TD-Sequential signal&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;cntFrom&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// only refer the today signal by yesterday candle&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;cntTo&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// count back to the 3rd candle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;ClearTradeDaily&lt;/span&gt;&lt;span class="hl-code"&gt;?=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// always clear the yesterday hedge&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;MISC___________________________&lt;/span&gt;&lt;span class="hl-code"&gt;= "&lt;/span&gt;&lt;span class="hl-identifier"&gt;______&lt;/span&gt;&lt;span class="hl-code"&gt;";&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;317&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;PlayAudio&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BOP&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HOP&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;up&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Hcnt&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;u&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;d&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;day&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntm&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;curm&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HOpen&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseLots&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLots&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt; &lt;span class="hl-comment"&gt;//Base Used Margin&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;GBUM&lt;/span&gt; &lt;span class="hl-comment"&gt;//Get BUM&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt; &lt;span class="hl-comment"&gt;//Hedge Used Margin&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;GHUM&lt;/span&gt; &lt;span class="hl-comment"&gt;//Get HUM&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt; &lt;span class="hl-comment"&gt;//Total Used Margin&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BPt&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HPt&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;midpt3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;SResult&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BResult&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;allmeetcor&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;candletxt&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;tdstxt&lt;/span&gt;&lt;span class="hl-code"&gt;="";&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| expert initialization function                                   |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//----&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_SPREAD&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_SPREAD&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;BPt&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_POINT&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;HPt&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_POINT&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_LOTSTEP&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_MINLOT&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_MAXLOT&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;//----&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;br /&gt; &lt;h3&gt;2. Daily Trend Signal Function&lt;/h3&gt;    &lt;h3&gt;&lt;br /&gt;&lt;/h3&gt;  &lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|TOM DEMARK SEQUENTIAL : Return +Value for UP &amp;amp; -Value for DOWN Sig|&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;s&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;pos&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;36&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;num&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;num1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Rnum&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;w&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;m&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;pos&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;--&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;midPt3&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;s&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntTo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;s&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntTo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;s&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntFrom&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;midPt3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;w&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-identifier"&gt;m&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;num&lt;/span&gt;&lt;span class="hl-code"&gt;++; &lt;/span&gt;&lt;span class="hl-identifier"&gt;num1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;         &lt;/span&gt;&lt;span class="hl-identifier"&gt;Rnum&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;num&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntFrom&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;midPt3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;           &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;m&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-identifier"&gt;w&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;num1&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-identifier"&gt;num&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;            &lt;/span&gt;&lt;span class="hl-identifier"&gt;Rnum&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;num1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;           &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;num1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;num&lt;/span&gt;&lt;span class="hl-code"&gt; =&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;Rnum&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Rnum&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| CORRELATION : Calculate the correlation of the 2 pairs           |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;symboldif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;shift&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;shift&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_SMA&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PRICE_CLOSE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;shift&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;powdif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;val&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathPow&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;val&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;u&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;val1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;val2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;val1&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;val2&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;base&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;hedge&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;u1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;l1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;s1&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt; ;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt; &gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt; ;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;--&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-identifier"&gt;u1&lt;/span&gt;&lt;span class="hl-code"&gt; +=&lt;/span&gt;&lt;span class="hl-identifier"&gt;u&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symboldif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;base&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;symboldif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hedge&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-identifier"&gt;l1&lt;/span&gt;&lt;span class="hl-code"&gt; +=&lt;/span&gt;&lt;span class="hl-identifier"&gt;powdif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symboldif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;base&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-identifier"&gt;s1&lt;/span&gt;&lt;span class="hl-code"&gt; +=&lt;/span&gt;&lt;span class="hl-identifier"&gt;powdif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symboldif&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hedge&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;l1&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;s1&lt;/span&gt;&lt;span class="hl-code"&gt; &gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;u1&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathSqrt&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;l1&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;s1&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;h3&gt;3. Trade Function&lt;/h3&gt;    &lt;h3&gt;&lt;br /&gt;&lt;/h3&gt;  &lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|  TOTAL PROFIT                                                    |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;MyCurrentProfit&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;cnt&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;cnt&lt;/span&gt;&lt;span class="hl-code"&gt; &lt; &lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;cnt&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;cnt&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt; &lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-identifier"&gt;MyCurrentProfit&lt;/span&gt;&lt;span class="hl-code"&gt;+= &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSwap&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MyCurrentProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|  CLOSE HEDGE                                                     |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;CloseHedge&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;//_______________________________________________________________________&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;--&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderTicket&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderClosePrice&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_SPREAD&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-consts"&gt;CLR_NONE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-identifier"&gt;SResult&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SResult&lt;/span&gt;&lt;span class="hl-code"&gt;||&lt;/span&gt;&lt;span class="hl-identifier"&gt;BResult&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;PlayAudio&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-predfunc"&gt;PlaySound&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ok.wav&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;CloseHedge Error: &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;ErrorDescription&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;GetLastError&lt;/span&gt;&lt;span class="hl-brackets"&gt;()))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;//_______________________________________________________________________&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;RefreshRates&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| SEND HEDGE                                                       |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;SendH&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;lots&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;sp&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;comment&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSend&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;lots&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;sp&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;comment&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-consts"&gt;CLR_NONE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   &gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;PlayAudio&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-predfunc"&gt;PlaySound&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;expert.wav&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;: &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;        ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;        ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;ErrorDescription&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;GetLastError&lt;/span&gt;&lt;span class="hl-brackets"&gt;()))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|  EXISTING POSITION                                               |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|  EXISTING OP POSITION                                            |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderType&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| CLOSE SCRAP                                                      |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;//_______________________________________________________________________&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;--&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;sym&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderType&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderTicket&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderClosePrice&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_SPREAD&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-consts"&gt;CLR_NONE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-identifier"&gt;BResult&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SResult&lt;/span&gt;&lt;span class="hl-code"&gt;||&lt;/span&gt;&lt;span class="hl-identifier"&gt;BResult&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;PlayAudio&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-predfunc"&gt;PlaySound&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ok.wav&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;CloseScrap Error: &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;ErrorDescription&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;GetLastError&lt;/span&gt;&lt;span class="hl-brackets"&gt;()))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;//_______________________________________________________________________&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;RefreshRates&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|  Transform OP Value To string                                    |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;OP2Str&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;switch&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;op&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;case&lt;/span&gt; &lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt; : &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;BUY&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;case&lt;/span&gt; &lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;: &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;SELL&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;default&lt;/span&gt;&lt;span class="hl-code"&gt; : &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;~~&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| ET ORDERTIME OF EXISTING POSITION                                |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrdersTotal&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSelect&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;SELECT_BY_POS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_TRADES&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderSymbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderMagicNumber&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-identifier"&gt;magic&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;OrderOpenTime&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;NumPos&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Translate bool to string                                         |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;bool2str&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt; &lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;boolval&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;boolval&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Yes&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;boolval&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;No&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|AUTO LOT                                                          |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Base&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;MM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;switch&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;case&lt;/span&gt; &lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;: &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;AccountBalance&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-reserved"&gt;break&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;case&lt;/span&gt; &lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-code"&gt;: &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;AccountEquity&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-reserved"&gt;break&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;case&lt;/span&gt; &lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;: &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;AccountFreeMargin&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;Lots&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;symbol&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;risk&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;risk&lt;/span&gt;&lt;span class="hl-code"&gt; &gt; &lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;risk&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;NormalizeDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Base&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MMBase&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;risk&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-predfunc"&gt;AccountLeverage&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;10.0&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;NormalizeDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt; &lt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt; &gt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;AutoBLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;z&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_B_LotsRatio&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Lots&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;PercentMaxRisk&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;z&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;NormalizeDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt; &lt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt; &gt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                                  |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;AutoHLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;AutoBLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_B_LotsRatio&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;NormalizeDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;lot_step&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt; &lt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Min_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt; &gt; &lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;Max_Lot&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLot&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;h3&gt;4. Trading Process&lt;/h3&gt;  &lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| expert start function                                            |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;  &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-identifier"&gt;midpt3&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;hb&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;B317.csv&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_CSV&lt;/span&gt;&lt;span class="hl-code"&gt;|&lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_READ&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;// Get the latest Used Margin&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;   ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;hh&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H317.csv&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_CSV&lt;/span&gt;&lt;span class="hl-code"&gt;|&lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_READ&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// for calculating the %ROI&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hb&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-identifier"&gt;GBUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;StrToDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileReadString&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hb&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hb&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hh&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-identifier"&gt;GHUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;StrToDouble&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileReadString&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hh&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;hh&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;GBUM&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;GHUM&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Period&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;// only allow to atatch on D1 timeframe&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-comment"&gt;//----&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;day&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt; &lt;span class="hl-comment"&gt;// the new day has come&lt;/span&gt;&lt;br /&gt;           &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;            &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-comment"&gt;//if the hedge exist.&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;!= &lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeDay&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                          &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeDay&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-comment"&gt;//the order-time is not the same as today&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ClearTradeDaily&lt;/span&gt;&lt;span class="hl-code"&gt;? &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;AcceptableLoss_ROI&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-comment"&gt;//allow to clear hedge daily and in acceptable loss&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseHedge&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)){&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;//cleared.&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-comment"&gt;//in case the Demark's signal has changed&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;br /&gt;          &lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                     ||&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;br /&gt;          &lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseHedge&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)){&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;//cleared.&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-comment"&gt;// in case there was any acident occure during clearing the hedge.&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;!= &lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeDay&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;&lt;br /&gt;   {&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt; &lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;!= &lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeDay&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;&lt;br /&gt;         {&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;){&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;         &lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}}&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-comment"&gt;// block opening if the correlation are not in allowed level.&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt; &lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;Between&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;            || &lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;And&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;            ||&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt; &lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;Between&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;            || &lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;And&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;            &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;/span&gt;&lt;span class="hl-identifier"&gt;day&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// the new day process finished&lt;/span&gt;&lt;br /&gt;           &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-comment"&gt;// The intra-day tick comes.&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeCurrent&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-comment"&gt;// there are the hedge exist&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-code"&gt;!&lt;/span&gt;&lt;span class="hl-identifier"&gt;cleared&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;AcceptableLoss_ROI&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;!= &lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeDay&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;GetTimeExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               ||&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;Daily_Percent_ROI&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseHedge&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;// closed hedge when rich daily expected ROI.&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-comment"&gt;//~~~~~~~&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;BMid&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HMid&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;         ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLST&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLST&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;AutoBLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// auto calculate the hedge lots&lt;/span&gt;&lt;br /&gt;         &lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;AutoHLots&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class="hl-comment"&gt;//~~~~~~~&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;           &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;BMid&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;&lt;br /&gt;     MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HMid&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-comment"&gt;// only open trade when the prices are both near each daily open&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;B&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;317&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;.csv&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_CSV&lt;/span&gt;&lt;span class="hl-code"&gt;|&lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_WRITE&lt;/span&gt;&lt;span class="hl-code"&gt;, ';'&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;317&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;.csv&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_CSV&lt;/span&gt;&lt;span class="hl-code"&gt;|&lt;/span&gt;&lt;span class="hl-consts"&gt;FILE_WRITE&lt;/span&gt;&lt;span class="hl-code"&gt;, ';'&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               ;&lt;/span&gt;&lt;span class="hl-comment"&gt;// prepair to write the used margin to the files to recallable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;midpt3&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-comment"&gt;// Demark signaled the UP TREND&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-identifier"&gt;up&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                  &lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// Buy Base Symbol&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-identifier"&gt;HOpen&lt;/span&gt;&lt;span class="hl-code"&gt; =&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// Sell Hedge Symbol&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                  &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-comment"&gt;// if they both near daily open&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-code"&gt;!&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; !&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpening&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;// not both Manual blocking and Correlation blocking&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                          &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-comment"&gt;// there's one (or more) old base order exist&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                          &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt; &lt;span class="hl-comment"&gt;// no base order exist&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           || &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                             &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURJPY&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_LOTSIZE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                              &lt;/span&gt;&lt;span class="hl-comment"&gt;// calculate base used margin&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                                &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileWrite&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// write to a file&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SendH&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;TDS UP : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;|&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;// sent base order&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-identifier"&gt;BLST&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                             &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                          &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-comment"&gt;// there's one (or more) old hedge order exist&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                          &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-comment"&gt;// no hedge order exist&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           || &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                             &lt;span class="hl-brackets"&gt;{&lt;/span&gt; &lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPJPY&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_LOTSIZE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                              &lt;/span&gt;&lt;span class="hl-comment"&gt;// calculate the hedge used margin&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                                &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileWrite&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// write to a file&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SendH&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HOpen&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;TDS UP : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;|&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;// sent hedge order&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-identifier"&gt;HLST&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                             &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-comment"&gt;//~~~~~~~~~~~~&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;midpt3&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-comment"&gt;// same thing but the DOWN signal came out&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-identifier"&gt;up&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                  &lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                  &lt;/span&gt;&lt;span class="hl-identifier"&gt;HOpen&lt;/span&gt;&lt;span class="hl-code"&gt; =&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;                  &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                  &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iOpen&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HPt&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;gsp&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-code"&gt;!&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; !&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpening&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                          &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                          &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           || &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                             &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;EURJPY&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_LOTSIZE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                              &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                                &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileWrite&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                 &lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleB&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SendH&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseOpen&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;TDS DN : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;|&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-identifier"&gt;BLST&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLS&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                             &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                          &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                          &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                           || &lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                             &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_BID&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPUSD&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_ASK&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;br /&gt;        &lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;MarketInfo&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;GBPJPY&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;MODE_LOTSIZE&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                              &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                                &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                                 &lt;span class="hl-predfunc"&gt;FileWrite&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                 &lt;/span&gt;&lt;span class="hl-predfunc"&gt;FileClose&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;handleH&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                                &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;SendH&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HOpen&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;TDS DN : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                              +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;|&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Cor&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;CorPeriod_2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;sent&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                              &lt;span class="hl-identifier"&gt;HLST&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLS&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;                             &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-comment"&gt;//~~~~~~~~~~~~~~~~~&lt;/span&gt;&lt;br /&gt;              &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;            &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;day&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Day&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt; &lt;span class="hl-comment"&gt;// just check if there still be any scrab orde left by any reason.&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeCurrent&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt; &lt;span class="hl-comment"&gt;// and clear it or them&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;               &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;br /&gt;               &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                  &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;((&lt;/span&gt;&lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;AcceptableLoss_ROI&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                     &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                     &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;                     &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistPositions&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;br /&gt;                     &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_BUY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                        &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;                           &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;CloseScrap&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OP_SELL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;BUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;HUM&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                       &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                    &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;                 &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;           &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span class="hl-comment"&gt;//----&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-predfunc"&gt;Alert&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Please Attatch The EA On D1 Only.&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt;  &lt;h3&gt;&lt;br /&gt;&lt;/h3&gt;  &lt;h3&gt;5. Showing the Hedging Status Function&lt;/h3&gt;  &lt;pre class="code"&gt;   &lt;span class="hl-comment"&gt;//~~~~~~~~~~~~~~~~~~~~~~~For Showing Status Section~~~~~~~~~~~~~~~~~~~~~~//&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt; &lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;tdstxt&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;UP&lt;/span&gt;&lt;span class="hl-code"&gt;";&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;DeMark&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-identifier"&gt;tdstxt&lt;/span&gt;&lt;span class="hl-code"&gt;="&lt;/span&gt;&lt;span class="hl-identifier"&gt;DN&lt;/span&gt;&lt;span class="hl-code"&gt;";&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-identifier"&gt;tdstxt&lt;/span&gt;&lt;span class="hl-code"&gt;="~~";&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;curm&lt;/span&gt;&lt;span class="hl-code"&gt;!=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Minute&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-identifier"&gt;cntm&lt;/span&gt;&lt;span class="hl-code"&gt;++;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-identifier"&gt;curm&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Minute&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;cntm&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-number"&gt;15&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;timetxt&lt;/span&gt;&lt;span class="hl-code"&gt;="\&lt;/span&gt;&lt;span class="hl-identifier"&gt;n&lt;/span&gt;&lt;span class="hl-code"&gt;\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nThis&lt;/span&gt; &lt;span class="hl-identifier"&gt;text&lt;/span&gt; &lt;span class="hl-identifier"&gt;section&lt;/span&gt; &lt;span class="hl-identifier"&gt;will&lt;/span&gt; &lt;span class="hl-identifier"&gt;disappear&lt;/span&gt; &lt;span class="hl-identifier"&gt;in&lt;/span&gt; &lt;span class="hl-number"&gt;15&lt;/span&gt; &lt;span class="hl-identifier"&gt;minutes&lt;/span&gt; &lt;span class="hl-identifier"&gt;after&lt;/span&gt; &lt;span class="hl-identifier"&gt;this&lt;/span&gt;&lt;span class="hl-code"&gt;."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;n&lt;/span&gt;&lt;span class="hl-code"&gt;"&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;n&lt;/span&gt;&lt;span class="hl-code"&gt;\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nIn&lt;/span&gt; &lt;span class="hl-identifier"&gt;order&lt;/span&gt; &lt;span class="hl-identifier"&gt;to&lt;/span&gt; &lt;span class="hl-identifier"&gt;run&lt;/span&gt; &lt;span class="hl-identifier"&gt;this&lt;/span&gt; &lt;span class="hl-identifier"&gt;EA&lt;/span&gt; &lt;span class="hl-identifier"&gt;you&lt;/span&gt; &lt;span class="hl-identifier"&gt;need&lt;/span&gt; &lt;span class="hl-identifier"&gt;to&lt;/span&gt; &lt;span class="hl-identifier"&gt;turn&lt;/span&gt; &lt;span class="hl-identifier"&gt;off&lt;/span&gt; &lt;span class="hl-identifier"&gt;every&lt;/span&gt; &lt;span class="hl-identifier"&gt;other&lt;/span&gt; &lt;span class="hl-identifier"&gt;EAs&lt;/span&gt;&lt;span class="hl-code"&gt;."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nThis&lt;/span&gt; &lt;span class="hl-identifier"&gt;EA&lt;/span&gt; &lt;span class="hl-identifier"&gt;was&lt;/span&gt; &lt;span class="hl-identifier"&gt;created&lt;/span&gt; &lt;span class="hl-identifier"&gt;to&lt;/span&gt; &lt;span class="hl-identifier"&gt;be&lt;/span&gt; &lt;span class="hl-identifier"&gt;standed&lt;/span&gt; &lt;span class="hl-identifier"&gt;alone&lt;/span&gt; &lt;span class="hl-identifier"&gt;due&lt;/span&gt; &lt;span class="hl-identifier"&gt;to&lt;/span&gt; &lt;span class="hl-identifier"&gt;the&lt;/span&gt; &lt;span class="hl-predfunc"&gt;AccountMargin&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt; &lt;span class="hl-identifier"&gt;function&lt;/span&gt;&lt;span class="hl-code"&gt;."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nRunning&lt;/span&gt; &lt;span class="hl-identifier"&gt;other&lt;/span&gt; &lt;span class="hl-identifier"&gt;EA&lt;/span&gt; &lt;span class="hl-identifier"&gt;at&lt;/span&gt; &lt;span class="hl-identifier"&gt;the&lt;/span&gt; &lt;span class="hl-identifier"&gt;same&lt;/span&gt; &lt;span class="hl-identifier"&gt;time&lt;/span&gt; &lt;span class="hl-identifier"&gt;will&lt;/span&gt; &lt;span class="hl-identifier"&gt;cause&lt;/span&gt; &lt;span class="hl-identifier"&gt;the&lt;/span&gt; &lt;span class="hl-identifier"&gt;WRONG&lt;/span&gt; &lt;span class="hl-identifier"&gt;calculation&lt;/span&gt; &lt;span class="hl-identifier"&gt;of&lt;/span&gt; &lt;span class="hl-identifier"&gt;your&lt;/span&gt; &lt;span class="hl-identifier"&gt;Daily&lt;/span&gt; &lt;span class="hl-identifier"&gt;ROI&lt;/span&gt; &lt;span class="hl-identifier"&gt;function&lt;/span&gt;&lt;span class="hl-code"&gt;."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nPLS&lt;/span&gt; &lt;span class="hl-identifier"&gt;Strickly&lt;/span&gt; &lt;span class="hl-identifier"&gt;follow&lt;/span&gt; &lt;span class="hl-identifier"&gt;the&lt;/span&gt; &lt;span class="hl-identifier"&gt;instruction&lt;/span&gt; &lt;span class="hl-identifier"&gt;above&lt;/span&gt; &lt;span class="hl-identifier"&gt;to&lt;/span&gt; &lt;span class="hl-identifier"&gt;see&lt;/span&gt; &lt;span class="hl-identifier"&gt;the&lt;/span&gt; &lt;span class="hl-identifier"&gt;real&lt;/span&gt; &lt;span class="hl-identifier"&gt;performance&lt;/span&gt; &lt;span class="hl-identifier"&gt;of&lt;/span&gt; &lt;span class="hl-identifier"&gt;Daily&lt;/span&gt; &lt;span class="hl-identifier"&gt;Hedge&lt;/span&gt; &lt;span class="hl-identifier"&gt;Strategy&lt;/span&gt;&lt;span class="hl-code"&gt;."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;nThank&lt;/span&gt; &lt;span class="hl-identifier"&gt;You&lt;/span&gt;&lt;span class="hl-code"&gt; ^&lt;/span&gt;&lt;span class="hl-identifier"&gt;_&lt;/span&gt;&lt;span class="hl-code"&gt;^."&lt;br /&gt;      +"\&lt;/span&gt;&lt;span class="hl-identifier"&gt;n&lt;/span&gt;&lt;span class="hl-code"&gt;~~~~~~~";&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-identifier"&gt;timetxt&lt;/span&gt;&lt;span class="hl-code"&gt;="";&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ShowStatus&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;Comment&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n\n&lt;/span&gt;&lt;span class="hl-string"&gt;DailyH : Daily GBPJPY ~ EURJPY Hedge.&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n&lt;/span&gt;&lt;span class="hl-string"&gt;By sexytrade.wordpress.com&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n&lt;/span&gt;&lt;span class="hl-string"&gt;With A Static Magic No. of 317&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-identifier"&gt;timetxt&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n\n&lt;/span&gt;&lt;span class="hl-string"&gt;BlockOpen : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;bool2str&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpen&lt;/span&gt;&lt;span class="hl-code"&gt; || &lt;/span&gt;&lt;span class="hl-identifier"&gt;BlockOpening&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n\n&lt;/span&gt;&lt;span class="hl-string"&gt;B/H [sp] : &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; [&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;BSP&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;]&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; / &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; [&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;HSP&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;]&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n&lt;/span&gt;&lt;span class="hl-string"&gt;CurOp [Lots]: &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;OP2Str&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BaseSymbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; [&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;BLST&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;]&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; ~ &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;OP2Str&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ExistOP&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;H_Symbol&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; [&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;HLST&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;]&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      ,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-special"&gt;\n&lt;/span&gt;&lt;span class="hl-string"&gt;CurPF [Expect]: $&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;TotalCurProfit&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;MagicNo&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; [$&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;TUM&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Daily_Percent_ROI&lt;/span&gt;&lt;span class="hl-code"&gt;/&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt; / ROI: &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;Daily_Percent_ROI&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;2&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;      +&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;]&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;     &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-predfunc"&gt;Comment&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;""&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt;     &lt;br /&gt;  &lt;h3&gt;Let Me Show Off&lt;/h3&gt;  &lt;p&gt;  My daily hedge system with some live testing results.&lt;/p&gt;  &lt;img src="http://articles.mql4.com/c/articles/2008/06/21stsMarn2007.png" width="375" height="76" /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://articles.mql4.com/c/articles/2008/06/22vMaru2007.png" width="363" height="75" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://articles.mql4.com/c/articles/2008/06/23kMarh2007.png" width="364" height="77" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://articles.mql4.com/c/articles/2008/06/29tMard2007.png" width="368" height="75" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="width: 395px; height: 67px;" src="http://articles.mql4.com/c/articles/2008/06/30iMars2007.png" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="width: 426px; height: 59px;" src="http://articles.mql4.com/c/articles/2008/06/4uApre2007.PNG" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="width: 448px; height: 83px;" src="http://articles.mql4.com/c/articles/2008/06/5gAprf2007.png" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="width: 480px; height: 87px;" src="http://articles.mql4.com/c/articles/2008/06/10xAprm2007pfull.png" /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;   &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p align="justify"&gt;  From my 1 month report and the back testing result that show a possibility to make money in forex using this daily hedge concept, I think this system can help at least one idea of you to light up ("&lt;i&gt;&lt;u&gt;Ping Pong!!!, Hey! What about doing this instead ?&lt;/u&gt;&lt;/i&gt;") and generate a money maker system that is more qualify. Or maybe my style of coding can at least help one newbie to learn and practical for his/her &lt;span&gt;traditional &lt;/span&gt;coding style. I strongly hope that my article is useful for all readers, even the system may fail later, and you all like it. Now I will follow my plan of testing it for at least 6 months and I will post the result if possible. GOOD LUCK.&lt;/p&gt;&lt;/div&gt;  &lt;div style="margin-top: 10px;"&gt;&lt;strong&gt;Attachments:&lt;/strong&gt;      &lt;br /&gt;      &lt;a href="http://articles.mql4.com/download/7261"&gt;&lt;img src="http://www.mql4.com/i/ico/mq4.gif" align="absbottom" border="0" width="17" height="15" /&gt;&lt;/a&gt;       &lt;a href="http://articles.mql4.com/download/7261"&gt;DailyH.mq4&lt;/a&gt; &lt;small&gt;(27.5 Kb)&lt;/small&gt; &lt;/div&gt;  &lt;div style="width: 100%; text-align: right; padding-bottom: 5px;" id="article_author"&gt;  Author: &lt;a href="http://www.mql4.com/users/vixenme"&gt;chayutra sriboonruang&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-7397189045950684945?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/7397189045950684945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=7397189045950684945&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7397189045950684945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/7397189045950684945'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/05/what-about-hedging-daily.html' title='What about Hedging Daily?'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-3541192809037333241</id><published>2009-05-29T01:50:00.000-07:00</published><updated>2009-06-01T01:10:07.269-07:00</updated><title type='text'>Comparative Analysis of 30 Indicators and Oscillators</title><content type='html'>&lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p class="longtext"&gt;The abundance of indicators and oscillators developed nowadays inevitably leads to the problem of choosing the most efficient of them. Very often a beginning trader first facing this plenty of available analysis and forecasting tools starts testing them on history data and demo accounts. After that a set of conclusions is made about the efficiency and uselessness of this or that indicator in certain situations.&lt;/p&gt;&lt;br /&gt;&lt;p class="longtext"&gt;However such an estimation is not always objective because of the large number of parameters (symbol, chard period, volatility, etc.) and therefore the large amount of the analyzed information. More reliable conclusions about certain indicators and oscillators can be made after conducting their comparative analysis.&lt;/p&gt;&lt;br /&gt;&lt;p class="longtext"&gt;Actually the comparative analysis of indicators and oscillators is impossible without their simultaneous consideration bounding them to a price chart. However attaching even ten different indicators to a chart considerably overloads it. The obtained figure becomes tangled and unsuitable for analysis. An Expert Advisor described in this article can solve this problem and make the conduction of the comparative analysis more convenient.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Expert Advisor&lt;/h3&gt;  &lt;p class="longtext"&gt;Pay attention, this EA is not intended for the execution of live trading and therefore does not contain the money management block. Block of trade execution is implemented in a very simple way. The main task of the Expert Advisor is the provision of information about the presence or absence of signals from different indicators in connection with a price chart.&lt;/p&gt;&lt;br /&gt;&lt;div class="fullpost"&gt; &lt;p class="longtext"&gt;The program analyzes the following indicators and oscillators:&lt;/p&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Acceleration/Deceleration — АС&lt;/li&gt;&lt;li&gt;Accumulation/Distribution - A/D&lt;/li&gt;&lt;li&gt;Alligator &amp;amp; Fractals&lt;/li&gt;&lt;li&gt;Gator Oscillator&lt;/li&gt;&lt;li&gt;Average Directional Movement Index - ADX&lt;/li&gt;&lt;li&gt;Average True Range - ATR&lt;/li&gt;&lt;li&gt;Awesome Oscillator&lt;/li&gt;&lt;li&gt;Bears Power&lt;/li&gt;&lt;li&gt;Bollinger Bands&lt;/li&gt;&lt;li&gt;Bulls Power&lt;/li&gt;&lt;li&gt;Commodity Channel Index&lt;/li&gt;&lt;li&gt;DeMarker&lt;/li&gt;&lt;li&gt;Envelopes&lt;/li&gt;&lt;li&gt;Force Index&lt;/li&gt;&lt;li&gt;Ichimoku Kinko Hyo (1)&lt;/li&gt;&lt;li&gt;Ichimoku Kinko Hyo (2)&lt;/li&gt;&lt;li&gt;Ichimoku Kinko Hyo (3)&lt;/li&gt;&lt;li&gt;Money Flow Index – MFI&lt;/li&gt;&lt;li&gt;Moving Average&lt;/li&gt;&lt;li&gt;MACD (1)&lt;/li&gt;&lt;li&gt;MACD (2)&lt;/li&gt;&lt;li&gt;Moving Average of Oscillator (Гистограмма MACD) (1)&lt;/li&gt;&lt;li&gt;Moving Average of Oscillator (Гистограмма MACD) (2)&lt;/li&gt;&lt;li&gt;Parabolic SAR&lt;/li&gt;&lt;li&gt;RSI&lt;/li&gt;&lt;li&gt;RVI&lt;/li&gt;&lt;li&gt;Standard Deviation&lt;/li&gt;&lt;li&gt;Stochastic Oscillator (1)&lt;/li&gt;&lt;li&gt;Stochastic Oscillator (2)&lt;/li&gt;&lt;li&gt;Williams Percent Range&lt;/li&gt;&lt;/ol&gt;  &lt;p class="longtext"&gt;For the implementation of this task a digital matrix consisting of "-1", "0" and "1" is drawn on a chart. Each matrix line belongs to a certain indicator or oscillator. The matrix coluns are formed at each moment of time (according to the selected chart period). The appearance of "-1" in a certain matrix line denotes the presence of a signal to sell produced by a certain indicator (oscillator); appearance of "1" - presence of a buy signal, "0" denotes the absence of any signal. Fig. 1 illustrates the program operation results.&lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;img style="width: 464px; height: 390px;" src="http://articles.mql4.com/c/articles/2008/05/1_2.png" /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="longtext"&gt;Fig. 2 illustrates the analysis of RVI operation based on the matrix. In the line 26 (it contains data about this indicator) "1" is recorded when the main line moves above the signal one (the indicator recommends to buy), "-1" - when the signal line is above the main one (Sell signal). Due to the indicator characteristics this line does not contain "0".&lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;img style="width: 483px; height: 405px;" src="http://articles.mql4.com/c/articles/2008/03/2.JPG" /&gt;&lt;/div&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Due to characteristics of indicators and oscillators, we can detect two types of indexes in the matrix: constantly significant ones, the corresponding flags (values in the matrix) of which are never equal to zero, and pointwise significant, the flags of which can accept zero and make signals only in some certain moments of time (for example, Parabolic SAR). It is shown in Fig. 3.&lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;img style="width: 464px; height: 390px;" src="http://articles.mql4.com/c/articles/2008/03/3_2.JPG" /&gt;&lt;/div&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="longtext"&gt;It is recommended to analyze the obtained information and then form a package of indicators the following way. First of all select the chart part with a trend. Then the period of possible trades is specified. The beginning of such a trend can be a flat period before the selected trend or trend origination; the end of the period is the last time moment when a trade is still profitable. Thus anticipatory and late indicator signals are not taken into account. In fig. 4 such a period is indicated by green lines. After that information by indicators (oscillators) is analyzed inside this period: all indicators showing trend correctly are taken, other ones are sifted away. After that the package can be extended or restricted by the analogous analysis on other time intervals, as a result the final package will be formed.&lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;img style="width: 490px; height: 411px;" src="http://articles.mql4.com/c/articles/2008/05/2_2.png" /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="longtext"&gt;The program provides the testing of formed packages. For this purpose in a corresponding line of the strategy processing Block enumerate conditions (indicator showings) based on which the final decision about selling (or buying) is made.&lt;/p&gt;&lt;br /&gt;&lt;p class="longtext"&gt;Thus the combined analysis of the price behavior and signals produced by each certain indicator (oscillator) provides the possibility of selecting the most efficient of them for further formation of a package of indicators.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Algorithm&lt;/h3&gt;  &lt;p class="longtext"&gt;At the first stage values of "flags" (-1, 0, 1) are defined for each indicator (oscillator). Assuming that one indicator (for example, MACD) produces signals different ways (convergence/divergence, crossing of a zero line, etc.), the program code contains the description of its defining principle. For example, analysis of the oscillator "Williams Percent Range" is implemented so:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//30. Williams Percent Range&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//Buy: crossing -80 upwards&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//Sell: crossing -20 downwards&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt; &lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-consts"&gt;NULL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwpr&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwprbar&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;-&lt;/span&gt;&lt;span class="hl-number"&gt;80&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-consts"&gt;NULL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwpr&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwprbar&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;80&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;f30&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt; &lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-consts"&gt;NULL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwpr&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwprbar&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-consts"&gt;NULL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwpr&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;piwprbar&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;f30&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt;  &lt;p class="longtext"&gt;After that unique objects of the 'Text' type are formed from the obtained digital values of flags (to avoid duplication of object names current time value is used) and the displayed:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span class="hl-identifier"&gt;timeident&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;TimeCurrent&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;//Time to form the unique object name&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt; &lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;=&lt;/span&gt;&lt;span class="hl-number"&gt;29&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;//Loop for displaying values&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//Forming unique object names&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-identifier"&gt;ident&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;30&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;   &lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;timeident&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;//Creating objects, indicating their location&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ident&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_TEXT&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;timeident&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;WindowPriceMin&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-predvars"&gt;Point&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;5&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;info&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;DoubleToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;f&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;30&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-identifier"&gt;i&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;//Forming a text line to be displayed&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;ident&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;info&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;6&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Arial&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-identifier"&gt;Black&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt; &lt;span class="hl-comment"&gt;//Describing the format of displaying and displaying&lt;/span&gt;&lt;/pre&gt;  &lt;p class="longtext"&gt;To check the formed packages the program includes "The block of processing a strategy and placing the Main Flag". This block contains conditions providing which the EA must buy (if the Main Flag is equal to 1) and sell (if the Main Flag is equal to -1). If the described conditions are not fulfilled, the Main Flag stays equal to zero and trades are not executed. The EA also contains a block of position closing (it is commented).&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;f8&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;f21&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;//Set of conditions, providing which Buy is executed&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-identifier"&gt;flag&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;f8&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="hl-identifier"&gt;f21&lt;/span&gt;&lt;span class="hl-code"&gt;==-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt; &lt;span class="hl-comment"&gt;//&lt;/span&gt;&lt;span class="hl-comment"&gt;Set of conditions, providing which Sell is executed&lt;/span&gt;&lt;span class="hl-comment"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-identifier"&gt;flag&lt;/span&gt;&lt;span class="hl-code"&gt;=-&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="longtext"&gt;Parameters of each indicator (oscillator) are described in the form of variables, which allows their automatic optimization (initial parameters are those generally accepted).&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p class="longtext"&gt;As said above, the offered Expert Advisor is not a ready automated trading system. Its main task is the conduct of a comparative analysis of indicators and oscillators for further formation of a package. The EA demonstrates signals produced by indicators not overloading a trader's desktop making the analysis very convenient.&lt;/p&gt;&lt;br /&gt;&lt;p class="longtext"&gt;The flexibility of the EA is in the following: a new set of indicators can be included into the matrix and formed packages can be tested on history data.&lt;/p&gt;&lt;br /&gt;&lt;div align="right"&gt;&lt;small&gt;Translated from Russian by MetaQuotes Software Corp.&lt;/small&gt;&lt;br /&gt;&lt;/div&gt; &lt;div align="right"&gt;&lt;small&gt;Original article: &lt;a target="_blank" href="http://articles.mql4.com/ru/577"&gt;http://articles.mql4.com/ru/577&lt;/a&gt;&lt;/small&gt;&lt;/div&gt;&lt;br /&gt;  &lt;div style="margin-top: 10px;"&gt;&lt;strong&gt;Attachments:&lt;/strong&gt;     &lt;br /&gt;     &lt;a href="http://articles.mql4.com/download/5567"&gt;&lt;img src="http://www.mql4.com/i/ico/mq4.gif" align="absbottom" border="0" width="17" height="15" /&gt;&lt;/a&gt;       &lt;a href="http://articles.mql4.com/download/5567"&gt;Matrix.mq4&lt;/a&gt; &lt;small&gt;(32.4 Kb)&lt;/small&gt; &lt;/div&gt;  &lt;div style="width: 100%; text-align: right; padding-bottom: 5px;" id="article_author"&gt;&lt;strong&gt;&lt;/strong&gt;  Author: &lt;a href="http://www.mql4.com/users/Sovetnik"&gt;Александр&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-3541192809037333241?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/3541192809037333241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=3541192809037333241&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/3541192809037333241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/3541192809037333241'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/05/comparative-analysis-of-30-indicators.html' title='Comparative Analysis of 30 Indicators and Oscillators'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-5684834279673734931</id><published>2009-05-29T01:47:00.000-07:00</published><updated>2009-06-19T13:59:44.754-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trading'/><title type='text'>View of Technical Analysis in the Context of Automatic Control Systems (ACS), or "Reverse View"</title><content type='html'>&lt;h3 style="text-align: justify;"&gt;Introduction&lt;/h3&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;To get a living, it is sufficient to work.&lt;br /&gt;However, to grow rich, you have to find something else.&lt;br /&gt;Alphonse Karr&lt;br /&gt;(translated from French by MetaQuotes Software Corp.)&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If something goes wrong, you should get better, expand your view, look at things differently. This sometimes may bring to very interesting and unusual results. At the first glance, some ideas seem to be absurd... just "by definition". Fortunately, they do that only at the first glance. Indeed, an unprepared person can hardly imagine what happens at, for example, relativistic velocities. The scale is, of course, absolutely, different, but we will sometimes discuss extremes having their practical applications. The most interesting and unusual results are usually obtained when utilizing something "unusual". What is meant here is exactly that "something".&lt;div class="fullpost"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Technical analysis has been successfully developing for many years. The understanding of current processes becomes deeper, more and more complicated properties and laws are used. And, what is more remarkable, they started to speak about fully automated trading systems a while back. At the same time, the automatic control theory and practice go on developing as a scientific and engineering subject.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It is logical that the education and experiences in these two fields suggest the idea of compounding them. A keeping up feeling of superficiality, a wish to strike into the nature of case are good additional stimuli. Most known methods, as complicated they may be, use rather simple properties.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Below is a brief representation of the 1.5-year development in this direction. It is mostly theory and some interesting practical methods. All given below is "field-proven". The purpose was to represent an alternative view. I can provide more details later if need be.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It is interesting that it turned out to be a generalization of the existing laws somewhere, but it is a real "reverse view" sometimes. Of course, we can say the matter is that machines and finances are "apples and pears". However, it seems to me that they still have much in common. Moreover, as to the technical side, the theory itself is developed much more fundamentally, i.e., not as an application in only one field, and much deeper. Such laws are always more reliable. Naturally, the high-level principles can hardly find their applications here. In the technical scope, a huge discretization and spread are rather unpleasant things. The main controlling principle is quite unusual. The question is exactly fundamental laws.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt; &lt;p style="text-align: justify;"&gt;In my opinion, it turned out to be a generalization of all known principles in a larger class of systems and deepening into the part thereof that had not been traditionally touched upon (at least in my practice). This, of course, does not lower the importance of classical methods.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;            &lt;/div&gt;&lt;h3 style="text-align: justify;"&gt;Central Tenets&lt;/h3&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Nobody should believe to anyone as to the Lord thy God or as to His prophet.&lt;br /&gt;It is sufficient just to listen to a person that makes you think.&lt;br /&gt;Ascribed to Peter Oppenheimer&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Classically viewed, the analysis solves the task of predicting and finding the points of entering/exiting the market. When a position is opened, it is accompanied (hedged, etc.). Even this formulation itself implies high discretization and the existence of 'good' and 'bad' movements. The main subject of the analysis is the past, and there is some persistence in decision making. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;What will happen to the market, in case the "Holy Grail" is found and implemented worldwide, is another question. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The market movements and their usability are usually related in a very simple manner. For example, on Friday, the 8th of August 2008, most liquid securities fell in price in the Russian securities market on a negative external background. Investors are uneasy.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Moreover, the analysis and decision making often represent two separate systems. An analyst estimates the market situation and proposes his or her recommendations. The whole management is reduced to comparing the analytical data from various sources (including one's own ones), making the decision of opening or closing, and accompanying the position on the basis of further information obtained. No feedback is foreseen, or it is poorly realized due to that the information about the trader's situation seems to be absurd to the analyst. Moreover, the analytical part is distributed and can be changed.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The created constructions (indicators, shapes, etc.), as a rule, are closely related to fundamental market laws. Normally, they are related to the market laws only (psychology, macroeconomics, etc.). There are some more general approaches, like Fibonacci or Elliott. However, many other fundamental laws participate in the work of an ACS (automatic control system).&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;All above is a historical special case. Everything may go by opposites. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Technical analysis as such is not a simple field, whereas this part thereof (management) is even more complicated. This is partly because it requires deep knowledge and experience in both many technical fields (nonlinear dynamics, computational mathematics, system analysis, theory of probability and mathematical statistics, programming, etc.) and in the field of financial markets, investment analysis, etc. However, the prize is much more attractive, too.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Thus, the monitoring can be practically permanent (discrete, of course, but "always in the market"). It's another matter that the activity can be low most of the time. The relation between the market movements and their usability may turn out to be complicated, highly nonlinear. It is quite optional that the 'good' and the 'bad' (for the system) movements of the market are determined by psychology or by macroeconomic processes (there will be an example given below). There can exist a strong feedback, when the identification of the state includes considering the data about the result obtained.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;In the automatic control theory, a servo-type system is standard, i.e., a system that follows up the task. The difference between the task and the current result is inputed to the control system. It would be absurd to use this (as it is) on the market. However, the idea itself finds application here, too.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;So, considered from this viewpoint, analysis is permanently related to control. It would be more properly to speak about control that includes analysis. Further, a system is understood to be, totally, the control object, control system and communications. An object is, of course, understood to be an account, but this is performed through the market, by resizing positions. Controlling rates and prices (for example, the exchange rates of one country or of several countries, the prices of the securities of one company or of its competitors, etc.) is a separate topic.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The role of analysis, which consists in prediction, becomes not so important in this context and fully disappears, in extreme cases. Then the main task becomes to answer the question: What should be done in different development variations and what can this result in?&lt;br /&gt;This abstracting results in using some other properties of the market.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;            &lt;/div&gt;&lt;h3 style="text-align: justify;"&gt;Generalization and Extension&lt;/h3&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;"&gt;You create your own Universe as you go along.&lt;br /&gt;Winston Churchill&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The basic equation can be formulated as follows:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;y(i+1)=y(i) + (x(i+1) – x(i))*k(i)&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;where:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;y – result,&lt;br /&gt;x – initial chart,&lt;br /&gt;i – step.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It is quite clear. At the 'i' moment, the position is open with the amount of lots equal to k(i). Therefore, the result changes in proportion to that. I've not considered spread yet. It can be written as follows, too:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=dx(i)*k(i)&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;k(i) has also the sense of speed. Actually, there can be many choices for k(i).&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It could seem: What else can be invented here? For example, this equation is just a transformation from one chart to another. The resulting chart is usually taken as equity (again, spread is not considered here). This is not necessary so. For an open position, the resulting chart repeats the initial one as a weighted one, i.e., their properties can be practically corresponding with each other. We can take the resulting chart as an initial one and process it again. Thus, this system can be multilevel, while spread becomes considered only at the last level. At each level, you should keep and add the necessary properties and delete the unnecessary ones.&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If an idea or a trading system is tested and the test result does not satisfy you (large drawdowns, very instable profits, etc.), you can, of course, try to improve the system. However, this chart may be better than the initial one and worth to be processed at a higher level. It is not the fact, of course, but it can often turn out to be so.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;I recently conceived the idea of that it would be possible to work on the others' equity charts in a similar way. This opens a variety of interesting opportunities. However, this matter is closely related to the development of the investment market, trust management, etc. Well, this is another pair of shoes.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;This was vertical complication, or consideration into the depth. It is also possible to consider everything horizontally, if we use several parallel systems. In the simplest case, the one system compensates the disadvantages of the other. The idea is by far not new. It's another matter if they are interrelated. Among other things, such systems must be synchronized due to the presence of discretization and spread. This will be considered at the end of this present article.&lt;br /&gt;In a general case, the main equation is transformed into a combined equation:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy1(i)=dx(i)*k10(i)+dy1(i)*k11(i)+dy2(i)*k12(i)+…&lt;/span&gt;&lt;br /&gt;&lt;span class="important"&gt;dy2(i)=dx(i)*k20(i)+dy1(i)*k21(i)+dy2(i)*k22(i)+…&lt;/span&gt;&lt;br /&gt;&lt;span class="important"&gt;...&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;In my practice, it happened that there were over one thousand systems horizontally and over ten levels vertically.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Vertically, the real system is only the last system (position size or speed are multiplied on all levels). Horizontally, any systems may be real. It means that some systems can be used as internal, auxiliary or fake systems. They provide a much greater flexibility. The useful properties show, for example, when such a system acts under the laws of a real one, but with a small deviation, and is actively present in the operations of other systems at the same time. For example, if there is a real system that controls it.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Eventually, parallel systems are added (or subtracted), so everything can be reduced to the first basic equation. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If two systems are added and if we subtract a part from the result of the first system and add that part to the result of the second system, then the sum will remain the same and such an operation is quite allowable. At the first glance, there is no reason for doing this, maybe only if there is no feedback. However, if the further conduct of the system depends on its current situation, this method may turn out to be most welcome (an example will be given below).&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Now a few words concerning chart transformations. If the chart moves up, it is good. If it moves down, then we can always change it, and it will move up again. We can easily decrease the deposit only using a spread or the deposit scarcity, although other ways may also exist. Or the task is reduced to that of increasing the deposit. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If the chart is fluctuating, it is often possible to turn it to a directional movement. It depends of the movement property. I like it better to reduce to such form first and then to work with it.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;These are well-known trend and nearly flat markets. In practice, naturally, everything is much more complicated: there are many frequencies there, including the low ones.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;A useful feature: Any chart can be reduced to one of two forms. It's another matter that the properties obtained may be not very attractive: The trend movement may have short but large drawdowns, while the fluctuating movement may sometimes have too large random amplitude. But these disadvantages appear if you use a brute-force approach. However, the fact of this opportunity, as such, is useful.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Another useful note is that no limitations related to spread or the deposit scarcity are valid in the intermediate, internal charts.&lt;br /&gt;The market carries a large part of uncertainty in itself. This uncertainty usually also passes to your equity due to the methods used and to the closeness of the initial and the resulting chart (one level). The meaning of all these transformations consists in that you change the chart properties consecutively at each level in order to reduce the uncertainty.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;            &lt;/div&gt;&lt;h3 style="text-align: justify;"&gt;Some Techniques&lt;/h3&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;Who knows how many words the God had tried, before He found the one that could create the world.&lt;br /&gt;Ascribed to Stanisław Jerzy Lec&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;All techniques described here are just possible tools that cannot work independently, but they can find their applications in various combinations with each other in compound systems. They are written as examples that represent rather extreme cases. There can be much more between the extremes, though.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;i&gt;&lt;b&gt;Servo-Type Systems&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Strict feedback revisited. The simplest example (the solution does not depend on the movement of the initial chart):&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=dx(i)*(y - g)*m&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;where:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;m – coefficient, a constant, in this example;&lt;br /&gt;g – task that can be a constant, but it can also be a variable.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;On the other hand, g is an attractor (a simple one, though there can occur complicated ones, too), i.e., it is a state the system is attracted to by the down-trend or by the flat market. It is also the point of possible bifurcation, i.e., of multiplied further movement directions, if we don't allow the system to hold at this point. If the chart is moving up, the system tends to leave its stable state in the direction to the position where the resulting chart was when it had started moving.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;There can be many variations here.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If g is a constant, the system is attracted to this position, and only specific measures can get it out of there. For example, exchange with other systems (this is an example why it may be necessary), setting it as a sine curve with a small amplitude or as follows:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=dx(i)*|y – g|*m + c&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;where:&lt;br /&gt;c – some constant.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If c is positive, there are no equilibrium states; if it is negative, then there are two of them: above and below zero. You cannot create an oscillating system with a limited amplitude using the negative 'c', because of sticking at the boundaries. Where c is a positive number, the amplitude is not limited and often turns out to be too large. However, all this depends on what the given system is working at and what additional techniques are used. However, as a whole, the situation is as described above.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;All this applies to a wide range of servo-type systems, to its oscillatory part. Its standard appearance is approximately as follows:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;img style="width: 547px; height: 176px;" src="http://articles.mql4.com/c/articles/2008/08/oscillating_system.JPG" border="0" /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;Another example, where the task is not a constant and, for example, moves up linearly. Then the system follows the task most of the time, never exceeds it, but has huge drawdowns. If you place TakeProfit and StopLoss, then the long-term resulting direction depends on volatility and on trends. In any case, if we make a reverse, we will obtain a drawdown-limiting technique. Standard appearance:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;img style="width: 511px; height: 163px;" src="http://articles.mql4.com/c/articles/2008/08/follow_up_system1.JPG" border="0" /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;Task can be selected in a more complicated way. We can take, for instance, the initial chart itself or the chart of another system. Then the result follows the task quite well. If we find the difference between the initial chart and the result, we will obtain one more oscillating system. There are many variations here, too.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It would a be a good direction of work: Let the task move linearly. Then we can use various techniques (for example, exchange between the initial chart and those following it up) trying to increase the probability of the movement from the task. Most of the time, the system moves exclusively in one direction, but it is compensated by rare but strong opposite movements. The problem is only that they are rare. Then we can try and create several parallel system of this kind, based on different initial charts (other currency pairs, different pre-processing or by the technique described below and based on random processes). We should also add here synchronization to compensate drawdowns and spreads. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Drawdown limitation can be an extremely useful property.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Another solution would be to use two or more practically identical systems. They all work under the same laws, but with small deviations in form of an introduced random signal, for example, through speed. The systems must tend to the same value. Then, in the task area, the deviations between them tend to zero. Subtracting one system from the other, we can obtain the result of introducing the random signal. It turns out not to be quite random, but the idea is not bad, as a whole.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Servo-type systems can be used for the opposite purpose, setting by the task a boundary the system must not exceed. Then, if we have protected it against sticking, then the system will oscillate only on one side of the task.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Data Exchange&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Let's return to a simple variation. If we add a minus to it:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=-dx(i)*(y - g)*m,&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;then no opposite chart will be obtained. Just the actions of trends will replace each other. Should the first system (with plus) decline from zero, the other one will approach to it, and vice versa. The flat market will act in the same way.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;We can complicate it a little. Let's add such a data exchange:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy1(i)=dx(i)*(k1*y1 + k2*y2 – g)*m,&lt;/span&gt;&lt;br /&gt;&lt;span class="important"&gt;dy(i)=-dx(i)*(k2*y1 + k1*y2 – g)*m,&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If k1 = 1 and k2 = 0, then we obtain two separate considered systems. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If k1 &gt; 0.5 and k2 &lt;&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If k1 = 0.5 and k2 = 0.5, then we obtain an analog of self-oscillations. The speed depends on g. If g is a sine, the speed will be a sine, too. It must not oscillate about zero.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If k1 &lt;&gt; 0.5, then the system diverges. It is still oscillating about zero, but its amplitude increases with acceleration (most probably, also with higher derivatives). I.e., if the ratio between the amplitudes of neighboring oscillations could be a bit more than one at the beginning, it is counted in hundreds later. Its typical appearance (the system consists of two subsystems, as given in the formula):&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;img style="width: 523px; height: 237px;" src="http://articles.mql4.com/c/articles/2008/08/instability.JPG" border="0" /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;To start, you can use a sine as a task, though it is reasonable only at the very beginning. You can simply set the initial value of the result of one of the systems, other than zero. It will never converge anymore: the situation of (y1=0, y2=0) is automatically avoided.&lt;br /&gt;In the movement itself, there are some other useful properties.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The main advantages are oscillation about zero and divergence.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The fact of instability itself (the ratio between amplitudes is more than one) can be very useful. Besides, look at the first basic equation. It is very interesting that such a simple transformation (with k1 and k2) changes the chart so significantly.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Of course, this movement is very difficult and hardly controlled. Here we can speak about the art of management. I've made a certain headway in such processes, but the things have not come to real systems here yet.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;b&gt;&lt;i&gt;Backward Transformation&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;If a forward transformation is possible, then a backward one is possible, too (in these conditions):&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=dx(i)*k(i),&lt;/span&gt;&lt;br /&gt;&lt;span class="important"&gt;dx(i)=dy(i)/k(i).&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;We can first make a forward one (for example, for the oscillating variation), correct it using one more transformation, and then apply a backward transformation to the new chart as to the previous one. Then we will obtain a modified initial chart in the direction we need.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It should be repeated that most of these transformations are internal. It means that, eventually, neither large drawdowns nor reckless speeds will pass. A diverging chart can be limited by two levels above and below zero. It will oscillate and finally comes to one of them. As such, it doesn't produce much sense, but it suits as an example of limiting. Very strange and, at first sight, unusual processes may take place inside, but not outside. It is like a ballistic rocket that took off from the Earth and landed on the Earth, and used the advantages of its distance from that Earth on its way.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;b&gt;&lt;i&gt;Random Processes&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;By the way, about the space. We can abstract away from the market even more using random processes, without losing generality. The first transformation will appear as follows:&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span class="important"&gt;dy(i)=dx(i)*k(i)&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;where&lt;br /&gt;k(i) – a random (pseudo) number. For example, from -1 to 1. I prefer to use a discrete variation: either 1 or -1.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Only volatility come to result. Practically everything else is random. Some properties of the initial chart in the periods between decision makings pass, too. We can, of course, add randomness in smaller scales, the the situation becomes mixed.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;The notions of the 'good' and 'bad' movements of the initial chart strongly change here. &lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Of course, the properties of a chart change.For example, a system that sells at an up-movement by 20 points (the speed of -1) and buys at a down-movement usually wins approximately the same at a long period as it loses on spreads. This won't happen with such a chart.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;There are problems related to volatility that, in its turn, is related to the discretion of decision making, spread, and other factors of the kind. However, there are some limited ways to smooth and increase persistence, which improves the situation to some extend.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Generally, the following question arises quite logically: Is it, in principle, possible to successfully manage such a process? Wouldn't it be so that on a large time interval, the probabilities of winning or losing the same amount of points would be fifty-fifty? It wouldn't, perhaps. For example, there is such function as module. Purely mathematically, a random chart is always above zero. It wouldn't probably work as you wish, but this is determined not by the chart alone. I.e., the problems here are not strictly related to randomness. However, this produces a great variety of limitations that pay, in my opinion.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Advantages. First of all, abstractness. You aren't touched by any crises, it makes no difference to you where the initial chart moves and how it does it. A crisis can, of course, occur without visible causes, this must be taken into consideration. In this case, it is easier to consider this using a bit different working principles.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Second, you can make as many initial charts as you wish. As in the example above: Let you have a system that gradually moves down, while a rare but strong up-movement compensates the drawdowns. Then, having a large amount of systems of this kind and correctly synchronizing them, we can get the summarized result in a more standard appearance. A successful parallel working of systems with other properties is possible, too.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Third, risks are essentially reduced. Trading can be modeled for up to 1000 years in advance.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Continuous switching that means that spread is a semblant problem. It needs the synchronization of a large number of systems. You can always 'freeze' a part of systems for one or two periods so that the after-adding speed does not differ very much from the preceding one. The main thing is not to overplay. You can do so that the speed is always equal to one or zero. There is no sense in in, though. Additional conditions like prioritizing the 'freezed' systems and other techniques will make the speed less oscillatory, but will not significantly affect the availability of the system.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;there are two serious disadvantages, as well. The first one concerning volatility and discretization is describede above. The second one is the probabilities of the resulting chart moevements. It is difficult to shift them into the range of values appropriate for working with them. The situation can be improved due to some methods that allow you to increase your profits significantly if the system is just a bit profitable. However, those critical values are mostly determined by the development of the methods.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Some words about the discretization of decision making. By the way, it may sometimes help. I often check all systems on a strict period of 1.5 hours. Then I make corrections to adjust it to the system's properties and make it change according to the situation. It is better to attach the moments of possible speed changes to some discretion, except for extraordinary occasions. This will help to reduce losses on spreads, because, if there are many parallel systems working simultaneously, their speeds are eventually summed, and the summed losses turn out to be much smaller than the sum of losses of individual systems.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Such techniques as TakeProfit and StopLoss, as a rule, are better to be used at the last levels. At the first stages, it would be better to use continuous transformations.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Well, finally, watching the activities of such systems from 'outside', it is extremely difficult to have an insight into their operation logic. Especially, if there are random processes inside.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;            &lt;/div&gt;&lt;h3 style="text-align: justify;"&gt;Conclusion&lt;br /&gt;&lt;/h3&gt;&lt;div style="text-align: justify;"&gt;        &lt;/div&gt;&lt;p style="text-align: justify;"&gt;It is our often practice to estimate the accomplishments of science by its practical results only.&lt;br /&gt;So it turns out that he who picks the apple is the person who has done the main work,&lt;br /&gt;when, in fact, the apple is made by him who has planted out an apple tree.&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt; P.L. Kapitsa&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Here I have shown some extreme cases (the use of feedback only, the use of pseudo random charts, etc.), that turn out to be quite viable. If even they produce so many opportunities, then there much more intermediate variations. This gives a huge flexibility, there can be a large amount of various choices. What I have shown here is just a small part of what can be really done.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;I didn't write about various small features we cannot do without, in such extreme cases. For example, if parameters are not set very accurately or no special measures are foreseen, then the discretization may result in that a servo-type system exceeds its task (which has not been foreseen) and moves to a large distance from it. However, that boundary might be determining a drawdown. It shows up especially well when working with diverging processes.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Amid the developments of information technologies, increased liquidity and reduced spreads and commissions, such methods can gain in importance.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Of course, it's not very easy to work with such things, but the prospects are not bad. All this often seemed impossible. This doubting resulted in changing viewpoints, finding new opportunities, principles, techniques. Fortunately, appearances are all for us. I cannot say that I have already made great advances. 1.5 years are not a really large period for these things (complicated, as they may seem). Most of time, it was just a hobby for me. However, this hobby is now tending to become my professional activity after the first positive results obtained. By the way, I'd love to work on all this in a team. It is another pair of shoes, though. Let's work, create and become better all the time.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;Best wishes.&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;small&gt;Translated from Russian by MetaQuotes Software Corp.&lt;br /&gt;Original article: &lt;a target="_blank" href="http://articles.mql4.com/ru/719"&gt;http://articles.mql4.com/ru/719&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;   &lt;/div&gt;&lt;div style="width: 100%; padding-bottom: 5px; text-align: justify;" id="article_author"&gt;  Author: &lt;a href="http://www.mql4.com/users/Oberon"&gt;Sergei Ivanov&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-5684834279673734931?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/5684834279673734931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=5684834279673734931&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/5684834279673734931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/5684834279673734931'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/05/view-of-technical-analysis-in-context.html' title='View of Technical Analysis in the Context of Automatic Control Systems (ACS), or &quot;Reverse View&quot;'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-8591838985546411682</id><published>2009-05-29T01:40:00.000-07:00</published><updated>2009-06-01T01:13:07.439-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trading'/><title type='text'>Channels. Advanced Models. Wolfe Waves</title><content type='html'>&lt;h3&gt;Introduction&lt;/h3&gt;    &lt;p&gt;Channels are vivid examples of defining points of trade position opening and closing, allow conducting the estimation of the current situation for the trade decision making. Basic rules of decision making about trading in a channel inform well about price movements within a channel, but the absence of defined or formalized ruled prohibit detecting break out points, and this often catches traders unawares. For the identification of such places M and W models or Merill patterns, Gartley butterflies, Pesavento models and Wolfe waves are used.&lt;/p&gt;  &lt;br /&gt;&lt;h3&gt;Wolfe Waves. Defining and Marking Rules&lt;br /&gt;&lt;/h3&gt;    &lt;p&gt;Notwithstanding the uniqueness of the market, for the whole history of its existence there were empirically gathered repeating combinations of price, volume and indicators that are now called patterns. The analysis of patterns is based on one of axioms of the analysis of technical parameters of prices - "History repeats itself". Patterns are also called figures or templates.&lt;/p&gt;  &lt;p&gt;There are several types of patterns:&lt;/p&gt;    &lt;ul&gt;&lt;li&gt;undefined patterns;&lt;/li&gt;&lt;li&gt;continuation patterns;&lt;/li&gt;&lt;li&gt;reversal patterns.&lt;/li&gt;&lt;/ul&gt;    &lt;p&gt;Channel models of Wolfe Waves belong to the latter type.&lt;/p&gt;      &lt;p&gt;The author of this method explains on his website that the Wolfe Wave is made of supply and demand that form their own equilibrium. Such models are not unique. They can be met on any markets and in all timeframes. Investigations of the author of this model allow another understanding of Elliott waves or Merill model. Particularly, example of such waves in a downward channel is the combination of Elliott's five-wave structure 1-2-3-4-5, where the point one is the beginning of the correction wave 2, or &lt;span&gt;W&lt;/span&gt;14 of Merill model. This is an example for an up-trend. And the example of a down-trend is Merill's M3 model or the point four as the beginning in Elliott waves (4-5-а-&lt;span&gt;b&lt;/span&gt;-&lt;span&gt;c&lt;/span&gt;). However the most correct formations are figures that appear at corrections of waves. There they can be absolutely correct and show the point of the channel break out, which is the correction.&lt;/p&gt;  &lt;p&gt;The most precious feature of Wolfe Wave formation is that the range of movement can be predicted with the amazing accuracy.&lt;/p&gt;  &lt;div class="fullpost"&gt; &lt;p&gt;In my article &lt;a title="Idleness is the Stimulus to Progress. Semiautomatic Marking a Template" href="http://articles.mql4.com/732" target="_blank"&gt;"Idleness is the Stimulus to Progress. Semiautomatic Marking a Template"&lt;/a&gt; I already included rules of marking the pattern for trading by Wolfe Waves.&lt;/p&gt;  &lt;p&gt;Let's consider step-by-step an example of the generation of the indicated formation that was formed at the end of 2009.&lt;/p&gt;  &lt;p class="picture" align="center"&gt;&lt;a href="http://articles.mql4.com/c/articles/2009/02/scy1.gif" target="_blank"&gt;&lt;img style="width: 486px; height: 339px;" title="Рисунок 1" src="http://articles.mql4.com/c/articles/2009/02/scy1_small.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Fig. 1&lt;/p&gt;  &lt;p class="picture" align="center"&gt;&lt;br /&gt;On the first stage of marking we should place fibo levels between points 2 and 3. Thus we project the future development of the price movement. The back movement that starts from point 3 ends between 38 and 61 percent of the price movement of points 2 and 3. This is the ideal correlation. Thus we get point 4 on the chart and wait for the formation of wave 5. Here we should take into account that wave 5 can be 138 or 161 percent of the wave 2-3. In this case we have exactly 138,2%&lt;/p&gt;      &lt;p&gt;After defining key points on our pattern, let's number the found waves and draw trend lines for projecting the target zone of our pattern. The important moment in marking any pattern is the correct detection of point 1. This point is not always on the top of a zigzag break. This point can be located between points 1 and 2. In order to project it, we should join points 5 and 3 by a trend line and then the wanted point will be found in the point of intersection of the line between points 1-2; from this point let's draw a ray through the point 4 for projecting the target zone of point 6.&lt;/p&gt;  &lt;p class="picture" align="center"&gt;&lt;a href="http://articles.mql4.com/c/articles/2009/02/trz2.gif" target="_blank"&gt;&lt;img style="width: 457px; height: 319px;" title="Рисунок 2" src="http://articles.mql4.com/c/articles/2009/02/trz2_small.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Fig. 2&lt;/p&gt;  &lt;p&gt;To complete our work let's draw temporary fibo zones to define the completion time of price movement. Take into account that time zones have a certain inaccuracy connected with the fact that there are holiday omissions on the chart. However there is a reference, though quite a relative one.&lt;/p&gt;  &lt;p class="picture" align="center"&gt;&lt;a href="http://articles.mql4.com/c/articles/2009/02/hzu3.gif" target="_blank"&gt;&lt;img style="width: 449px; height: 313px;" title="Рисунок 3" src="http://articles.mql4.com/c/articles/2009/02/hzu3_small.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Fig. 3&lt;/p&gt;  &lt;p&gt;A confident market entering can be performed after candles break out the trend line that joins points 2 and 4. The channel formed by trend lines 1-3-5 and 2-4 is mostly narrowing or parallel. The important feature noted by the author of the system is the symmetry. The most precise models are obtained when time intervals between points 1-3-5 are equal.&lt;/p&gt;  &lt;p&gt; Nevertheless, the above formations work even if symmetry is not strictly observed. Sometimes price does not reach the projected level by several points or crosses it and moves further. There were cases when price moved much further, and the corresponding formation of waves was detected on higher timeframes. That was overlapping, which made the movement in one direction even stronger. Obviously, this is the so called market fractality.&lt;/p&gt;  &lt;p class="picture" align="center"&gt;&lt;a href="http://articles.mql4.com/c/articles/2009/02/hrg4.gif" target="_blank"&gt;&lt;img style="width: 458px; height: 320px;" title="Рисунок 4" src="http://articles.mql4.com/c/articles/2009/02/hrg4_small.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Fig. 4&lt;/p&gt;    &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Please note that Wolfe Wave patterns as models of channel break-out, like most trading strategies, are very subjective. It is important to use these models only after gathering experience and necessary skills on history and demo account. And, of course, stop orders should not be forgotten.&lt;/p&gt;  &lt;p align="right"&gt;&lt;small&gt;Translated from Russian by MetaQuotes Software Corp.&lt;br /&gt;Original article: &lt;a target="_blank" href="http://articles.mql4.com/ru/774"&gt;http://articles.mql4.com/ru/774&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;   &lt;div style="width: 100%; text-align: right; padding-bottom: 5px;" id="article_author"&gt; Author: &lt;a href="http://www.mql4.com/users/Vladlv"&gt;Vladimir&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-8591838985546411682?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/8591838985546411682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=8591838985546411682&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/8591838985546411682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/8591838985546411682'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/05/channels-advanced-models-wolfe-waves.html' title='Channels. Advanced Models. Wolfe Waves'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-3592571295201558721</id><published>2009-05-29T01:38:00.000-07:00</published><updated>2009-06-01T01:03:03.358-07:00</updated><title type='text'>Can the Forex Market Be Forecasted? How to Create One's Own Trading Strategy?</title><content type='html'>&lt;div align="right"&gt;"What is half will become perfect. What is crooked will become straight.&lt;/div&gt; &lt;div align="right"&gt;What is empty will be filled. What is old will be rejuvenated.&lt;/div&gt; &lt;div align="right"&gt;Who has little, will receive in plenty.&lt;br /&gt;&lt;/div&gt; &lt;div align="right"&gt;Who has much, will be deprived."&lt;/div&gt; &lt;div align="right"&gt;Laozi, &lt;i&gt;Tao Te Ching&lt;/i&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p&gt;Really, there are many discussions about Forex: is it of a random nature? to what extent is it random? can it be forecasted? I cannot give an irrefragable answer to all these questions, because the market is a very complicated phenomenon. But I can give you two examples from my own experience. The first one does not refer directly to this topic, but it helped me, instilling confidence and patience, to manage to forecast the Forex market.&lt;/p&gt;  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;h3&gt;Can the Forex Market Be Forecasted? How to Create One's Own Trading Strategy?&lt;/h3&gt;  &lt;div&gt;   &lt;p&gt;It happened 30 years ago. In Soviet Union a game Sportloto (kind of Bingo) was very popular. There is a lottery drum with balls numbered from 1 to 36. One by one 5 balls are thrown out into a special tray. I decided to write a program that could forecast, what numbers will fall out in the next drawing. Although theoretically I knew that a random process cannot be predicted, I had not only confidence, but an inner knowledge that I will find the solution of this task. I will not go dip into details, but the fact is I managed to forecast 3 numbers out of 5.&lt;/p&gt;  &lt;p&gt;This was enough for receiving almost 1000% profit from one ticket. Pity, after ten years of hard work, having achieved positive results I didn't have chance to use it. The fact is, this program written on a quite good for that time computer EC-1055 needed 1 day for calculations. At that time I could come Saturday morning into a computation center, start the machine and wait for the results till Sunday evening. In working days the machine was busy, so it was impossible to use it. The tickets needed to be sent till Friday, drawings took place on Sunday. But what is really important is the result of my work.&lt;br /&gt;&lt;br /&gt; In reality there are almost no absolutely random processes, each one has though a weak, but determined part, because a process cannot be singled out and isolated from the environment. Any interaction creates correlation, and this allows detect directly or indirectly such relations and using this relations predict the process itself.&lt;br /&gt;&lt;br /&gt; In my example there was an interesting moment. First the lottery drum was an octahedral cylinder that revolves on its axes. But then the drum was replaced by a spherical one with a vibrator in its bottom, which through up balls falling to its center. And after this replacement my program failed, stopped forecasting. And I had to wait half a year for new statistics to be collected enough and to change completely the program algorithm and only after that I managed once again to achieve stable forecasting. The algorithm change was connected with the description of space inside the drum.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Inside the sphere from the point of its contact with the plane, a vector moved on the inner sphere surface; its coordinates were indirectly expressed by winning numbers from drawing statistics. The task of forecasting directly by numbers was not solved. First it was necessary to create the model of space in which the numbers were formed and only after that the quasirandom process, formed by this space, could be forecasted by setting my own artificial limits. &lt;/p&gt;  &lt;p&gt;For better informative character of input features one needs to create their covariations between each other, using different laws of combining these features and to single out an optimal group that forms the most accurate model. For forecasting I used methods that were very close to present-time genetic algorithms.&lt;br /&gt;&lt;br /&gt; When I first saw Forex charts, they seemed very familiar to me. The statistic of Sportloto drawing that I used looked like almost identical. Sportloto and the Forex market regardless of the equal difficulty of their prognosis are antipodes. In their size they can be compared to a water drop and an ocean. In the lottery the determined part is very weak, while in the Forex market, on the contrary, random processes constitute quite a small part.&lt;/p&gt;  &lt;p&gt;The numerous events in the market itself, as well as in global economy and politics that directly influence the market, are marked by deep cause-effect relations. Exactly these relations in case of insufficiency of information and because of complexity of their correlation may look like random events for a casual observer.&lt;br /&gt;&lt;br /&gt; From the year 2000 I started studying and modeling the Forex market. My conclusion is the following: it can be really forecasted, but like any complex event it cannot be done using casual technical means like indicators and oscillators. After many years of working in the Forex market, I made some conclusions that may be interesting to many of you, and they are connected not only with the technical side of the problem, but also touch upon the market nature.&lt;br /&gt;&lt;br /&gt; The world we live in is so complicated and multivariate, that it is impossible to bring it to one formula. Though the processes that take place in it seem obvious at first sight, in a closer examination they reveal that behind this outer obviousness they hide the inner nature that is absolutely different than we think. And for the correct understanding of this nature we should change our existing thinking stereotype. &lt;/p&gt;  &lt;p&gt;For example, black coal seems to be solid. But if we change our superficial perception and try to apprehend its inner nature, we will see that behind the outer unchangeable solid substance there is a dynamic energy structure, consisting of multidimensional force fields connecting myriads of elementary particles and forcing them to move in their orbit at a very high speed.&lt;/p&gt;  &lt;p&gt;We will find nothing solid inside it, everything consists of energy only, and the solid form is only illusion of our perception due to the limitedness of our sense organs. The solid black coal contains a powerful energy potential, which appears when it burns, and the energy contained in it passes from one form into another. I am describing obvious matters, and hope you can draw an analogy and what I am going to tell further will also be evident.&lt;br /&gt;&lt;br /&gt; Everything in this world is energy. Some of its forms are explicit, other ones are hidden behind the illusion of materia or reveal themselves only as symbols, through which one can get access to processes that take place in a delicate field and very often we do not suspect the existence of such processes.&lt;br /&gt;&lt;br /&gt; Money is also energy. And like any other energy it does not appear from nowhere and does not disappear to nowhere. It follows the principle of conservation of energy, passing from one form into another. Dollars, pounds, yens are only symbols that represent certain kinds of energy, and the Forex market is a large transmutator, transforming energy of one kind into another kind energy. Behind the evident side of this phenomenon another one is hidden, which is unavailable to our limited perception unable to enter other dimensions.&lt;/p&gt;  &lt;p&gt;When money moves or is converted in our world of consequence, energy pathway move in correspondence with the potential of this money in a delicate cause plane, which without special training is unavailable to our sense organs. Forex itself is an informational energy system including not only technical system means, but also emotions and psychology of all its participants and the variety of different energy flows corresponding to money movement in the world. This energy creates a powerful Egrigor which is like a magnet - on the one side it attracts additional energy from those who touch it, on the other side it influences the psychology of those, who is in the sphere of its influence.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Knowing that large amount of money daily moves in the Forex, that the emotional tension of those trading in it is very high, we can imagine the huge energy potential and power of energy flows that accompany its operation. And there is nothing accidental in the movement of these energies, they follow certain laws.&lt;br /&gt;&lt;div class="fullpost"&gt; &lt;br /&gt; Despite its global nature, the Forex market is very sensitive and vulnerable. Events from the whole world influence it directly or indirectly. Statements of famous politicians and financiers, military and political conflicts, states of economy of different countries, price fluctuations in other markets - all these elicit changes of the situation in Forex. Besides there are attempts to manipulate the Forex market.&lt;/p&gt;      &lt;p&gt;Some large traders try to do this, executing risky speculative operations, trying to disturb its balance. Also this can be some structures and persons who have mastered techniques of energy control and management and trying to influence directly energy flows in a delicate plane, thus provoking price movement into a wanted direction in the physical dimension. The main noises and distortions, or what can be called the accidental part of the Forex, are produced by dealing centers and connection channels. Are there ways out?&lt;br /&gt;&lt;br /&gt; One can learn to feel the market and forecast it without additional technical means. What is important, one should not try to guess, because by doing so you distract your subconsciousness. And everything is done exactly on the level of subconsciousness. Simply observe, trust yourself and be patient. Charts are only symbols, but they help to catch the energies that form and lead the market movement.&lt;/p&gt;  &lt;p&gt;This energy appears long before a price changes on the chart. By concentrating attention on the chart you will connect on the subconscious level to these energies, start sensing them. After that you will be able to forecast the direction of the following tick. &lt;/p&gt;  &lt;p&gt;Move to the next stage. Open several (4-6) minute charts on different symbols well correlated with the symbol you are going to work with. Observe price movements, trying to catch the general movement dynamics. You will see, that combination of dynamics movement of some symbols predetermines the movement of other symbols, so you will know the further movement of your symbol.&lt;br /&gt;&lt;br /&gt; The next stage is trading on a demo-account using the acquired knowledge. To find out how good the knowledge is, try different trading strategies. You can experiment also on real accounts, because the psychology here is different. You should understand that losses are inevitable. And you should learn to lose. If you want to learn to forecast the market, you should take into account all said above.&lt;br /&gt;&lt;br /&gt; First, a person needs a back-up - some technical means like indicators and oscillators. Of course they can help. And traders widely use them. But actually those who have been trading for a long time feel the market intuitively. This is the secrete of success. And the earlier you understand this, the earlier you achieve this success. Indicators and oscillators are based on the past time. And what we need is the future. So, technical and fundamental analysis only hinder our quick movement to the future.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;So what is the principle that lays in the basis of most trading strategies? It is a very simple fact - the chance that a market will continue its movement in its direction is a little higher than the probability that it will change its direction. Another variant is that tomorrow the market will be the same as it was yesterday. And many traders use these principles together with indicators and oscillators. And while the difference in probabilities is not very high, traders either lose, or gain very little profit. &lt;/p&gt;  &lt;p&gt;But the supposition about the unchangeable character of markets is initially wrong. The market is dynamic and it constantly changes during a day which is connected with the dominating market (Asian, European or American), with entering or leaving of large participants, with news releases and other reasons. Optimization is a very long process and it cannot be conducted in real time. So optimization does not help much in adjusting used instruments which reflect only the market's past. &lt;/p&gt;  &lt;p&gt;So, building an efficient trading strategy is possible, though it is difficult. This must be expert systems that can analyze the market in real time, as well as combine all available data. Actually the information we get is a well-mixed cocktail that consists of numerous components. Upon artificially built signs that adequately reflect the existing tendencies, one can make short-term and medium-term forecasting. Such is the algorithm of an efficient trading strategy and after its program realization - of a trading system. Of course the algorithm takes into account the individual characteristics of its developer, because it already includes the experience, temperament and fears of its creator. But it is not enough. This should be done consciously. The system is only a tool and for its efficient operation it must be the continuation of yourself. And the maximal result can be acquired only if this harmony is achieved. &lt;/p&gt;   &lt;p&gt;Well, how can we do this? Just follow the recommendations above. Learn to sense the market, its energies and you will always be a step ahead of all its changes. For creating an adequate market model you also should use the maximally possible number of symbols. The market is constituted by all its symbols, they are all connected with each other. The mutual dynamics of its symbols is a key moment in building the tendency model.&lt;br /&gt;&lt;br /&gt; When building the model it is better to use a tick history, because methods, used in candlestick formation lose a sufficient part of information reflecting the dynamic character of the market. The principles of candlestick construction were formed when there were no computers. And the main task was visualization of information, though some of it was omitted.&lt;/p&gt;  &lt;p&gt;Unfortunately it is hard to find a tick history, the more so it should be synchronyzed on all symbols, used for calculation and the history depth should be five-six years. So such a model is hard to calculate for most computers used by private traders.&lt;br /&gt;&lt;br /&gt; But there is a way out. We can build dynamic models using the principle of self-organization. Here the small prehistory may be enough. On it, train the model and synthesize new features, reflecting the trend dynamics. The built model should continue training at each receipt of new data and dynamically trace and forecast not only all market changes, but also detect newly beginning trends of this changes. Based on such a model one can prepare short-term forecasts of the market dynamics which leads to a successful trading.&lt;br /&gt;&lt;br /&gt; And this model can be implemented in practice. The program implementation of this algorithm can be different depending on the experience and preferences of a developer as well as other factors. But this task is not an easy one. One needs patience and must be ready for a hard job for an efficient solution of this task.&lt;br /&gt;&lt;/p&gt;   &lt;p&gt;For me developing a successful model took many years. I tried many times, searching for a solution and only when I started to experiment with market sensing described earlier, I suddenly managed to find an algorithm of a trading system optimally suiting my market understanding. After that it was easier to implement this algorithm.&lt;br /&gt;&lt;br /&gt; On the first stage of the algorithm implementation I synthesize a trend model for a symbol I am going to trend on. According to the resulting model a two-step forecast is conducted. The firs step is forecasting six points forward. The second step is forecasting six points forward more based on the previous forecasting. As a result: building a new trend model, continuation of its training on new data and two-step forecasting - all this takes less than one minute and by the receipt of a new bar on a minute tick the program stops its operation. I also tried to make a five-step forecast thus increasing the forecasting up to thirty points and the result was quite satisfactory. This algorithm can be applied to any timeframe with any symbol.&lt;br /&gt;&lt;br /&gt; This is only one approach to Forex forecasting. I am sure many of you can find your own way out. Moreover I am persuaded that the systems like mine already exist. Though, probably, their developers prefer not to announce the existence of such efficient systems.&lt;br /&gt;&lt;br /&gt; This article could probably disappoint those who wanted to build a successful trading by writing a simple trading system using only MQL4 means and gain millions. But I hope it will inspire those who, having spared a lot of time and hard work, have not achieved any successful results and have lost their enthusiasm. There are a lot of ways to solve this task and I am sure you can find you own one following the conditions I have described.&lt;br /&gt;&lt;br /&gt; And I want to draw your attention to the fact that I used technical means only as a secondary means, I tried to use them during my work and achieved no success until I managed to form a clear understanding of a strategy and algorithm that should be implemented. Only if you have a clear understanding of the market and its processes, you can develop an algorithm that will adequately reflect such processes. I suppose one cannot rely on a computer hoping that it will form a necessary model using available technical means and software, because the market is a very difficult phenomenon. This will be possible after the appearance of much more powerful software and technical means, possessing artificial intelligence and operating on the principle of a heuristic self-organization of models.&lt;/p&gt;    &lt;p&gt;But today we can solve only local tasks, and for their realization we need a clearly determined task and algorithm, reflecting these local processes. When this algorithm is created, we can implement it using different available means, including MQL4. For example, when using the package PolyAnalyst &lt;a href="http://www.megaputer.com/" rel="nofollow"&gt;http://www.megaputer.com&lt;/a&gt;, working on the principle Data Mining, one can train a neural network and further formalize its parameters. As a result we get a non-linear polynominal that connects the network exits with its entrances; this polynominal can be included into any indicator or a trading system, written in MQL4 or any other programming language. Thus we get an autonomous neural network not using any external packages. This package includes many different possibilities for an efficient modeling, finding regularities, clusterization, though nowadays there are more efficient programs to be used as external applications.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;At the end of the article let us try to speculate about the near future to see the ways of trading development. With the growth of computer power and software development, using in their basis the principle of searching knowledge, self-organization and self-training algorithms of forecasting, more and more popularity in trading will be gained by efficient mechanical trading systems. For traders that try to use trading systems built on the basis of indicators and oscillators it will be more difficult to compete and stay in the market. &lt;/p&gt;  &lt;p&gt;Computer technology development is going on at a geometric progression. There is already the first information about the development of experimental samples of bio-computers, the power of which is billion times higher than that of the already existing ones. With the course of time the struggle will be more between robots, than between people and the winners will be those with a more efficient trading strategy, and not with higher technical resources. As a result in about twenty years financial markets as we see them now will cease to exist, because they will become absolutely predictable. &lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;What is written in the article is applicable not only for the Forex market, but also for any other financial market. Forex is the largest market among all others and is the most dynamic and hard-to-forecast. I tried to answer myself during my personal search all the questions, contained in this article. And here I presented my own small experience of investigating the Forex nature and my own conclusions based on my personal practice. Some of readers will agree with me, most of them will question my conclusions, some will consider all this charlatanism.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;This is like a parable about four blinds, who tried to guess about an elephant's appearance by touching it and each one had a different opinion, because one touched its tail, the second one - its leg, the third one - its trunk and the last one touched its tusk.&lt;/p&gt;  &lt;p&gt;I touched only the tail end and made my conclusions. I hope this article will provoke a wide discussion of this topic. Other sides of the problem will be found and thus one by one, idea after idea a whole picture of the market will be drawn.&lt;/p&gt;  &lt;div align="right"&gt;&lt;small&gt;Translated from Russian by MetaQuotes Software Corp.&lt;/small&gt;&lt;br /&gt;&lt;/div&gt; &lt;div align="right"&gt;&lt;small&gt;Original article: &lt;a href="http://articles.mql4.com/ru/372"&gt;http://articles.mql4.com/ru/372&lt;/a&gt;&lt;/small&gt;&lt;/div&gt;  &lt;/div&gt;&lt;/div&gt;            &lt;div style="width: 100%; text-align: right; padding-bottom: 5px;" id="article_author"&gt;&lt;strong&gt;&lt;/strong&gt;  Author: &lt;a href="http://www.mql4.com/users/DAO"&gt;DAO&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6968683766762345396-3592571295201558721?l=forex-grow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://forex-grow.blogspot.com/feeds/3592571295201558721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6968683766762345396&amp;postID=3592571295201558721&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/3592571295201558721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6968683766762345396/posts/default/3592571295201558721'/><link rel='alternate' type='text/html' href='http://forex-grow.blogspot.com/2009/05/can-forex-market-be-forecasted-how-to.html' title='Can the Forex Market Be Forecasted? How to Create One&apos;s Own Trading Strategy?'/><author><name>psycho_learner</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6968683766762345396.post-2776922381036756626</id><published>2009-05-29T01:15:00.000-07:00</published><updated>2009-06-01T01:04:23.205-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MQL4 Language'/><title type='text'>MQL4 Language for Newbies. Custom Indicators (Chapter 2)</title><content type='html'>&lt;h3&gt;Introduction&lt;/h3&gt; &lt;p&gt;This is the fifth article from the series "MQL4 Languages for Newbies". Today we will learn to use graphical objects - a very powerful development tool that allows to widen substantially possibilities of using indicators. Besides, they can be used in scripts and Expert Advisors. We will learn to create objects, change their parameters, check errors. Of course, I cannot describe in details all objects - there are a lot of them. But you will get all necessary knowledge to be able to study them yourself. This article also contains a step-by-step guide-example of creating a complex signal indicator. On its basis you can create any signal indicators that will show trade signals on all periods for several indicators. At that, many parameters will be adjustable which will make it possible to change easily the appearance of the indicator.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;About Graphical Objects&lt;/h3&gt; &lt;p&gt;You often deal with them when working in MetaTrader 4 terminal. You can use graphical objects for various purposes. Traders place support and resistance levels, pivot points, Fibonacci levels etc. Let us view a simple example of using objects:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 465px; height: 295px;" src="http://articles.mql4.com/c/articles/2008/01/pic001_en.png" /&gt;&lt;/p&gt; &lt;p&gt;Four graphical objects are attached to this chart: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;2 horizontal lines&lt;/li&gt;&lt;li&gt;a text object&lt;/li&gt;&lt;li&gt;an object-symbol (an arrow)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Today we will learn to attach such objects using MQL4. Just imagine how many manual actions can be automated by using objects! For example, have you ever calculated pivot points, support and resistance levels and then drawn them manually? Well, there is not so much work, but if this process is automated in MQL4, the terminal will calculate and draw the corresponding levels itself. All you need is a double click on the script name, and everything will be done. Besides, using graphical objects one can write very useful signal indicators. &lt;/p&gt; &lt;h3&gt;Concepts of Working with Objects &lt;/h3&gt; &lt;p&gt;The algorithm of working with all graphical objects in MQL4 is the following:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;creating an object&lt;/li&gt;&lt;li&gt;modifying its parameters (moving, changing color, stile etc.)&lt;/li&gt;&lt;li&gt;deleting an object&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This is a certain "life cycle". Now let's dwell on each stage.&lt;/p&gt; &lt;h3&gt;Creating a Graphical Object &lt;/h3&gt; &lt;p&gt;For drawing any graphical object &lt;b&gt;the universal function ObjectCreate() &lt;/b&gt;is used. Here is its prototype:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;name&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;type&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;window&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;datetime&lt;/span&gt; &lt;span class="hl-identifier"&gt;time1&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;&lt;br /&gt;               double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price1&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;datetime&lt;/span&gt; &lt;span class="hl-identifier"&gt;time2&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price2&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;br /&gt;               &lt;/span&gt;&lt;span class="hl-reserved"&gt;datetime&lt;/span&gt; &lt;span class="hl-identifier"&gt;time3&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price3&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;The function returns &lt;b&gt;true&lt;/b&gt;, if everything is correct, and &lt;b&gt;false&lt;/b&gt;, if an object cannot be created or an error has occurred. To find out the error code, use the function &lt;b&gt;GetLastError()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-comment"&gt;/* arguments */&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// an error occurred, its code should be recorded into a journal&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Error of calling ObjectCreate():&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;GetLastError&lt;/span&gt;&lt;span class="hl-brackets"&gt;())&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div class="fullpost"&gt; &lt;p&gt;What for do we need the error code? It will help you to find the error description and possibly eliminate it. All code descriptions are contained in: &lt;b&gt;MQL4 Reference -&gt; Standard Constants -&gt; Error Codes&lt;/b&gt;.&lt;/p&gt; &lt;p&gt;Let's dwell on all the arguments of the function &lt;b&gt;ObjectCreate():&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;name&lt;/b&gt; – a unique name of an object. You cannot create 2 objects with the same name. Further this name will be used in other functions for changing the parameters of the object representation or moving the object.&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;type&lt;/b&gt; – an object type. All object types that can be created are contained in: &lt;b&gt;MQL4 Reference -&gt; Standard Constants -&gt; Object Types&lt;/b&gt;. Note, it depends on the object type, whether the last function arguments should be used. Look once again at the prototype. Values to the last 4 arguments are assigned by default: different objects require different amount of data for creation. It is easy. Suppose you need to draw a point. What information do you need? Obviously, the point position. This will be enough, right? And to draw a rectangle we need 2 - positions of the upper left and the lower right points. The same is with the function &lt;b&gt;ObjectCreate()&lt;/b&gt;. It is universal. So, it needs position of one point for drawing a horizontal line and of two points for drawing a line segment. For drawing a triangle it needs three points. That's why when creating an object it is recommended to study properly the number of points needed for drawing it.&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;window &lt;/b&gt;– the window number, in which the object should be drawn. If you need to draw an object on a chart, i.e. in the main window, use &lt;b&gt;0 &lt;/b&gt;as the window number. &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;time1&lt;/b&gt; – the X coordinate of the first point. The X-axis in the terminal shows time, so indicate here time value. For example, to find out the time of the last available bar you may use the predefined array Time[], like this: Time[0].&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;price1&lt;/b&gt; – the Y coordinate of the first point. The Y-axis in the terminal shows price, so price values should be used. For example, use the predefined arrays Open[], Close[] etc.&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt; &lt;p&gt;&lt;b&gt;other arguments&lt;/b&gt; are 2 pairs of the analogous coordinates that define points for drawing more complex objects. If an object is simple, these parameters are not used.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;Example of Creating Objects. Drawing Lines&lt;/h3&gt; &lt;p&gt;Now for better understanding, let's draw a couple of lines. Let's mark the minimal and the maximal price of the last day. First we need to create a new script and change the function &lt;b&gt;start()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt;  &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iHigh&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(255, 204, 153);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts" style="background-color: rgb(204, 255, 204);"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// this useful function returns the maximal price for:&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// * &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;specified security&lt;/span&gt;, in our case it is Symbol() - &lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//   active security&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// * &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;specified period&lt;/span&gt;, in our case it is PERIOD_D1 (daily)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// * &lt;span class="hl-comment" style="background-color: rgb(204, 255, 255);"&gt;specified bar&lt;/span&gt;, in our case it is 0, the last bar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(255, 204, 153);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(255, 204, 153);"&gt;highLine&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(255, 204, 153);"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts" style="background-color: rgb(204, 255, 204);"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(0, 204, 255);"&gt;price&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// let us view all parameters: &lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;"highLine" - &lt;/span&gt;&lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;the unique object name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;OBJ_HLINE - object type of the horizontal line&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// &lt;span class="hl-comment" style="background-color: rgb(204, 255, 255);"&gt;0 - the object is drawn in the main window (chart window)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// &lt;span class="hl-comment" style="background-color: rgb(153, 204, 255);"&gt;0 - X coordinate (time), it shouldn't be indicated, because&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//     &lt;span class="hl-comment" style="background-color: rgb(153, 204, 255);"&gt;we are drawing a horizontal line&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// &lt;span class="hl-comment" style="background-color: rgb(0, 204, 255);"&gt;price - Y coordinate (price). It is the maximal price&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iLow&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// the function is identical with iHigh in arguments, but it returns&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// the minimal price&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;lowLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Of course we have missed checking for errors. So if you write the same name for the two objects, it will be your fault. When you start the script, it should look like this:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 440px; height: 279px;" src="http://articles.mql4.com/c/articles/2007/12/pic004.png" /&gt;&lt;/p&gt; &lt;p&gt;Lines are drawn but there is something that I dislike. It is the red color, which is too intense, so it is recommended to use tints. Generally the line appearance can be set up.&lt;/p&gt; &lt;h3&gt;Modifying Object Properties. Setting Up the Appearance of Lines&lt;/h3&gt; &lt;p&gt;There is a special function that allows setting up parameters of a created graphical object. It is the function &lt;b&gt;ObjectSet()&lt;/b&gt;. Its prototype is:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt; &lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;name&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;index&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;value&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Like the previous function it returns &lt;b&gt;true&lt;/b&gt;, if everything is correct, and &lt;b&gt;false&lt;/b&gt;, if there are any problems. For example, you have specified a non-existent object name. Let's view the arguments of this function:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;name&lt;/b&gt; – name of a created object. Before starting the modification, make sure that an object with such a name exists.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;index&lt;/b&gt; – index of an object's property that should be modified. All indexes can be found in: &lt;b&gt;MQL4 Reference -&gt; Standard Constants -&gt; Object properties&lt;/b&gt;. This function is also universal. It operates according to the following principle: you specify what property should be modified and what value should be assigned to this property. &lt;/li&gt;&lt;li&gt;&lt;b&gt;value &lt;/b&gt;– this is the value, to which a selected property should be changed. For example, if you change the color, specify here a new color. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Now let us change our lines, namely: their color, width and style. Change the function &lt;b&gt;start()&lt;/b&gt; of the same script:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt;  &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;double&lt;/span&gt; &lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iHigh&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;highLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iLow&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;PERIOD_D1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;lowLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;price&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;highLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_COLOR&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;LimeGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// changing the color of the upper line&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;highLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_WIDTH&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// now the line will be 3 pixel wide&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;lowLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_COLOR&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Crimson&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// changing the color of the lower line&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;lowLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_STYLE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;STYLE_DOT&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// now the lower line will be dashed   &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;You will see the following on the chart:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 461px; height: 292px;" src="http://articles.mql4.com/c/articles/2007/12/pic007.png" /&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;Deleting Objects&lt;/h3&gt; &lt;p&gt;You will often need to delete old or unnecessary objects. There are several functions for doing this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-predfunc"&gt;ObjectDelete&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;name&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;This function deletes an object of the specified name. If you indicate a non-existent name, 'false' will be returned.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;window&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-consts"&gt;EMPTY&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;type&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-consts"&gt;EMPTY&lt;/span&gt;&lt;span class="hl-brackets"&gt;);&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;This is an advanced function, it returns the number of deleted objects. It also has default values. If you do not specify any parameters, the terminal will delete all objects of an active chart:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// deleting all objects&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;If you have created an object in a sub-window (for example, in a window of some indicator), by specifying the number of this window in the first argument, you can delete all its objects. We will discuss sub-windows later, so now indicate 0 in the first argument.&lt;/p&gt; &lt;p&gt;If you need to delete all objects of a certain type, specify this type in the second argument:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_ARROW&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// deleting all arrows&lt;/span&gt;&lt;/pre&gt; &lt;h3&gt;How to Use All This Correctly?&lt;/h3&gt; &lt;p&gt;You may think that you need much knowledge for using all this correctly. For example, that one should know all these properties and types of objects. But this is not so. Everything can be found in a Userguide.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;First open &lt;b&gt;Toolbox&lt;/b&gt; (CTRL+T). There are several tabs in the bottom, select &lt;b&gt;Help&lt;/b&gt;. Suppose you need to draw a graphical object, but don't know how to do this. The function &lt;b&gt;ObjectCreate() &lt;/b&gt;should be used. Write it and leave the arguments empty. Now place the cursor inside the function name and press &lt;b&gt;F1&lt;/b&gt;. And the Help window will show the information about this function. It means you don't need to search anything. Now see the function description. It is followed by the description of all its arguments. Pay attention to the description of the argument &lt;b&gt;type&lt;/b&gt;:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 454px; height: 101px;" src="http://articles.mql4.com/c/articles/2008/01/1_Param.png" /&gt;&lt;/p&gt; &lt;p&gt;It contains a link. By clicking it you will see the list of existing objects. Suppose you like an ellipse:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 464px; height: 59px;" src="http://articles.mql4.com/c/articles/2008/01/2_Ellipse.png" /&gt;&lt;/p&gt; &lt;p&gt;Read the description and you will find that 2 coordinates are needed. Let's start:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt;  &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ellipse&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_ELLIPSE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Low&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;High&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;])&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// indicate 2 points for creating an ellipse:&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// * 1st - lower left point&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// * 2nd - upper right point &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;It is also written that the property &lt;b&gt;OBJPROP_SCALE&lt;/b&gt; determines the correlation of sides. So if we place it as 1, we will get a circle:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt;  &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// clear the chart before drawing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ellipse&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_ELLIPSE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Low&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;100&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;Time&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predvars"&gt;High&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;])&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ellipse&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_SCALE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1.0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// change the correlation of sides&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;ellipse&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_COLOR&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// change the color&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div align="center"&gt;&lt;img style="width: 447px; height: 283px;" src="http://articles.mql4.com/c/articles/2007/12/pic013.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I am sure you also didn't get a circle, because one-to-one scale should be set in the chart properties (click right button on any empty place of the chart and select &lt;b&gt;Properties&lt;/b&gt;):&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 458px; height: 307px;" src="http://articles.mql4.com/c/articles/2008/01/3_Properties.png" /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;You see, everything is easy. Actually you can place the cursor on any &lt;b&gt;key word&lt;/b&gt; and press &lt;b&gt;F1&lt;/b&gt;, after that you will see the corresponding information from the Help. So you do not need to remember all names of types and properties for quick and efficient code writing using the built-in Help. MetaEditor has one more very important property that will help you to write a code: when writing arguments in a built-in function, press &lt;b&gt;CTRL + SHIFT + space&lt;/b&gt;. You will see a prompting with the function prototype:&lt;/p&gt; &lt;p align="center"&gt;&lt;img src="http://articles.mql4.com/c/articles/2007/12/pic014.png" width="342" height="61" /&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt; &lt;h3&gt;Creating Graphical Objects in Subwindows&lt;/h3&gt;&lt;/b&gt;  &lt;/p&gt;&lt;p&gt;If you need to draw graphical objects in a subwindow for example in a window of a custom indicator, you should know its number. As an example we will write a simple indicator that will draw a horizontal line in a separate window. Create a custom indicator and add the following in the code:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                   creatingObjectsInSubWindow.mq4 |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                     Antonuk Oleg |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                            antonukoleg@gmail.com |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;copyright&lt;/span&gt; &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Antonuk Oleg&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;link&lt;/span&gt;      &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;antonukoleg@gmail.com&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_separate_window&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// indicator will be written in a separate window&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_minimum&lt;/span&gt; &lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// minimal indicator value is 1&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_maximum&lt;/span&gt; &lt;span class="hl-number"&gt;10&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// maximal is 10&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator initialization function                         |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;IndicatorShortName&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;NiceLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// this simple function sets a short indicator name,&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// you see it in the upper left corner of any indicator.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// What for do we need it? The function WindowFind searches a subwindow&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// with a specified short name and returns its number.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;WindowFind&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;NiceLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// finding the window number of our indicator&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;// if the number is -1, there is an error&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Can\'t find window&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;5.0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// drawing a line in the indicator subwindow&lt;/span&gt;&lt;br /&gt;         &lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_COLOR&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;GreenYellow&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_WIDTH&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;WindowRedraw&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;   &lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// redraw the window to see the line&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator deinitialization function                       |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;deinit&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// delete all objects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator iteration function                              |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-comment"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Start the indicator. There is no line!&lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 464px; height: 309px;" src="http://articles.mql4.com/c/articles/2007/12/pic016.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;We need to change the chart period.&lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 463px; height: 308px;" src="http://articles.mql4.com/c/articles/2007/12/pic017.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now it is here. What happened? Actually, the subwindow number cannot be found in the function &lt;b&gt;init()&lt;/b&gt;, when it is started for the first time. Perhaps, the reason is that the subwindow is not yet crated by the terminal during initialization. There is a way to avoid it - everything should be done in the function &lt;b&gt;start()&lt;/b&gt;,when the window is already created, like this:&lt;br /&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                   creatingObjectsInSubWindow.mq4 |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                                     Antonuk Oleg |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//|                                            antonukoleg@gmail.com |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;copyright&lt;/span&gt; &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Antonuk Oleg&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;link&lt;/span&gt;      &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;antonukoleg@gmail.com&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_separate_window&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_minimum&lt;/span&gt; &lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_maximum&lt;/span&gt; &lt;span class="hl-number"&gt;10&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;bool&lt;/span&gt; &lt;span class="hl-identifier"&gt;initFinished&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// adding a variable that will remember the initialization state.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// false - there was no initialization&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// true - there was initialization&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator initialization function                         |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator deinitialization function                       |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;deinit&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// deleting all objects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//| Custom indicator iteration function                              |&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//+------------------------------------------------------------------+&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;initFinished&lt;/span&gt;&lt;span class="hl-code"&gt;==&lt;/span&gt;&lt;span class="hl-reserved"&gt;false&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;IndicatorShortName&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;NiceLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-predfunc"&gt;WindowFind&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;NiceLine&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// if the subwindow number is -1, there is an error&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;Print&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Can\'t find window&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_HLINE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;windowIndex&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;5.0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// drawing a line in the indicator subwindow&lt;/span&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_COLOR&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;GreenYellow&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;line&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_WIDTH&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;WindowRedraw&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;   &lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// redraw the window to see the line   &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="hl-identifier"&gt;initFinished&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-reserved"&gt;true&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// drawing is finished&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Now everything will be drawn from the first time. What you should remember here, is that the subwindow number is found out in the function start(), and not init(). &lt;/p&gt; &lt;h3&gt;Have Some Practice&lt;/h3&gt; &lt;p&gt;Using the Help, try to study some new types of graphical objects. After that write a script that will draw them and set up parameters. Study this properly, have some practice and only after that continue reading the article.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Writing a Signal Indicator. What Is It?&lt;/h3&gt; &lt;p&gt;Imagine the situation. A trader uses several indicators for making decisions about entering the market: Moving Average, Parabolic SAR and Williams’ Percent Range. These are built-in indicators, which look like this: &lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 470px; height: 313px;" src="http://articles.mql4.com/c/articles/2007/12/pic001_1.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;A trader constantly estimates a situation in the market the following way: the market should be entered when signals come from each of the three indicators:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;If the quick moving average is above the slow one, this is a signal to buy. If vice versa - to sell.&lt;/li&gt;&lt;li&gt;If price is lower than Parabolic SAR, this is a signal to sell. If vice versa - to buy.&lt;/li&gt;&lt;li&gt;If WPR is larger than -20, this is a signal to buy. If WPR is lower than -80, this is a signal to sell.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The trader constantly has to check all the conditions, trying also to track the situation on several periods. It is a hard job. So, a signal indicator doing all checks could help him:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 449px; height: 299px;" src="http://articles.mql4.com/c/articles/2007/12/pic002.png" /&gt;&lt;/p&gt; &lt;p&gt;Today we will learn to solve this problem. We will write a signal indicator that will be easily set up. Besides, you will easily create your own modification with your favorite indicators based on this one.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Basics&lt;/h3&gt; &lt;p&gt;We will face some problems of drawing when creating this indicator. All graphical objects are drawn using price and time coordinates. Because of this, what is drawn is constantly shifted. To make objects stay in one place, we would need to change constantly their coordinates. But if you want to see what was earlier and shift the chart, the signal table will also be shifted. But each rule has exceptions. Among graphical objects there is the one called &lt;b&gt;OBJ_LABEL&lt;/b&gt;. It is a text mark used for positioning not price and time, but coordinates about the window in pixels. It is easy:&lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 443px; height: 295px;" src="http://articles.mql4.com/c/articles/2007/12/pic003.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;We see a common text sign "X". In its parameters you can see that its coordinates are specified in pixels. A pixel is the smallest point on the screen. Note that the coordinates of the upper left corner are: x=0, y=0 (0,0). If we &lt;b&gt;increase x&lt;/b&gt;, the object will be shifted to the &lt;b&gt;right&lt;/b&gt;, if we &lt;b&gt;diminish&lt;/b&gt; it, it will be shifted to the &lt;b&gt;left&lt;/b&gt;. The same is with the &lt;b&gt;y&lt;/b&gt;-coordinate. It can be shifted &lt;b&gt;upwards&lt;/b&gt; or &lt;b&gt;downwards&lt;/b&gt;. It is important to understand and remember this principle. For practicing, you can create a mark and shift it to see how its coordinates are changed in the properties. Also you can view old quotes by shifting the chart. At that the mark is not shifted. Using such marks we can create a signal indicator without the disadvantages described above.&lt;/p&gt; &lt;h3&gt;Options of a Text Mark&lt;/h3&gt; &lt;p&gt;Our signal indicator will use only text marks. So let's dwell on their options. First, create a new indicator (do not use data buffers and parameters) and change the function&lt;b&gt; init()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// now we will crate a text mark.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// for this use the function ObjectCreate.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// do not indicate coordinates&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// change the x-coordinate&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;50&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// change the y-coordinate&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;50&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// to indicate the mark text, use the following function&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;lambada&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;14&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Tahoma&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// "signal" - object name&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// "lambada" - text&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// 14 - font size&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// Gold - color&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;You see, everything is easy. The &lt;b&gt;ObjectCreate()&lt;/b&gt; function will be used only in initialization to create all necessary objects. Using &lt;b&gt;ObjectSetText()&lt;/b&gt;, we will change the appearance of objects at each price change in the function &lt;b&gt;start()&lt;/b&gt;. We also need to change the function &lt;b&gt;deinit():&lt;/b&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;deinit&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// when deleting the indicator delete all objects&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectsDeleteAll&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Now start the indicator and view the results:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="width: 464px; height: 309px;" src="http://articles.mql4.com/c/articles/2007/12/pic004_1.PNG" /&gt; &lt;/p&gt; &lt;p&gt;We will use the following options of marks:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;change the font into &lt;b&gt;Wingdings&lt;/b&gt; to make available special symbols (from squares and circles to smiles):&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;img style="width: 447px; height: 177px;" src="http://articles.mql4.com/c/articles/2007/12/pic005.PNG" /&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;we will change color and text of the mark&lt;/li&gt;&lt;li&gt;we will change position and size of the mark&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Using the Font Wingdings&lt;/h3&gt; &lt;p&gt;Now let's create a mark using the Windings font. Change the &lt;b&gt;init()&lt;/b&gt; function:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;50&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;50&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// use symbols from the Wingdings font&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;164&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;60&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// CharToStr() - this function returns a line with a single&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// symbol, the code of which is specified in the single argument.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// Simply select a symbol from the table above and write&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// its number into this function&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// 60 - use large font&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// "Wingdings" - use font Wingdings&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Here is the result:&lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 437px; height: 291px;" src="http://articles.mql4.com/c/articles/2007/12/pic006.PNG" /&gt;&lt;/div&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;Drawing a Model of a Signal Table&lt;/h3&gt; &lt;p&gt;Now let us draw a model of a table of signals. Actually this will be a number of squares:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// use 2 cycles. &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;The first cycle&lt;/span&gt;, with the counter "x" draws one by one&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// each column from left to wright. &lt;span class="hl-comment" style="background-color: rgb(204, 255, 255);"&gt;The second cycle&lt;/span&gt; draws symbols of each&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// column from top downward. At each iteration the cycle will create a mark.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// These 2 cycles create 9 columns (9 periods) 3 marks each (3 signal types)&lt;/span&gt;&lt;span class="hl-comment"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved" style="background-color: rgb(255, 204, 153);"&gt;for&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;(&lt;/span&gt;&lt;span class="hl-reserved" style="background-color: rgb(255, 204, 153);"&gt;int&lt;/span&gt;&lt;span style="background-color: rgb(255, 204, 153);"&gt; &lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(255, 204, 153);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;=&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;;&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(255, 204, 153);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;9&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;;&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(255, 204, 153);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;++&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved" style="background-color: rgb(204, 255, 255);"&gt;for&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 255);"&gt;(&lt;/span&gt;&lt;span class="hl-reserved" style="background-color: rgb(204, 255, 255);"&gt;int&lt;/span&gt;&lt;span style="background-color: rgb(204, 255, 255);"&gt; &lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 255);"&gt;y&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 255);"&gt;=&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 255);"&gt;;&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 255);"&gt;y&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 255);"&gt;3&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 255);"&gt;;&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 255);"&gt;y&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 255);"&gt;++&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// create the next mark, Note that &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;the mark name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// is created "on the fly" and depends on "x" and "y" counters&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// change the X coordinate.&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// x*20 - each mark is created at the interval of 20 pixels&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// horizontally and directly depends on the "x" counter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// change the Y coordinate.&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// y*20 - each mark is created at the interval of 20 pixels&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// vertically and directly depends on the "y" counter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// use the 110th symbol code (square)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div align="center"&gt;&lt;img style="width: 473px; height: 315px;" src="http://articles.mql4.com/c/articles/2007/12/pic005_1.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The pattern is ready. Let us add indents to the left and above it, so that the terminal text could be seen:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 0);"&gt;12&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// adding a horizontal indent &lt;span class="hl-comment" style="background-color: rgb(255, 204, 0);"&gt;12 pixels&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 0);"&gt;20&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// adding a vertical indent &lt;span class="hl-comment" style="background-color: rgb(255, 204, 0);"&gt;20 pixels&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div align="center"&gt;&lt;img style="width: 422px; height: 281px;" src="http://articles.mql4.com/c/articles/2007/12/pic006_1.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;Activate the Pattern&lt;/h3&gt; &lt;p&gt;Now let's make operate at least one of the squares. Suppose the upper left square will show a signal of moving averages on a minute timeframe (M1). If there is a signal to buy, the square will change its color into green. If there is a signal to sell - it becomes red. We need to change the function &lt;b&gt;start()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// if &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;quick moving average&lt;/span&gt; (period - 13) &lt;span class="hl-comment" style="background-color: rgb(255, 204, 0);"&gt;is larger&lt;/span&gt; than &lt;span class="hl-comment" style="background-color: rgb(153, 204, 255);"&gt;the slow one&lt;/span&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// this is a signal to buy. Check the last bar&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds" style="background-color: rgb(204, 255, 204);"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;()&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;1&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;13&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;)&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 0);"&gt;&gt;&lt;/span&gt;&lt;span class="hl-tech_inds" style="background-color: rgb(153, 204, 255);"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(153, 204, 255);"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(153, 204, 255);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(153, 204, 255);"&gt;()&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;1&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;24&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(153, 204, 255);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(153, 204, 255);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;&lt;span style="background-color: rgb(153, 204, 255);"&gt;)&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal00&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(255, 153, 204);"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;// change the color of the mark named "signal00" (the upper left)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// into &lt;span class="hl-comment" style="background-color: rgb(255, 153, 204);"&gt;green&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// else, if the quick MA is smaller than the slow one, this is a signal to sell.&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal00&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(51, 204, 204);"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// change the color into &lt;span class="hl-comment" style="background-color: rgb(51, 204, 204);"&gt;red&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p align="center"&gt;&lt;img style="width: 474px; height: 317px;" src="http://articles.mql4.com/c/articles/2008/01/pic007_1_en.png" /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;h3&gt;Activate the Upper Row&lt;/h3&gt; &lt;p&gt;Let's continue the activation. The left square indicates the smallest timeframe - M1. Now let's make it so that each square indicates a timeframe larger than the previous one. So, the second square shows signals on M5, the third one - M15 and so on, up to MN1. Of course, all this will be done in a cycle. What is changed, is the name and the period. We have 0 squares, so we use one counter. But we face a problem with periods, because they are changed without any regularities. See:&lt;/p&gt; &lt;div align="center"&gt;&lt;img style="width: 418px; height: 232px;" src="http://articles.mql4.com/c/articles/2008/01/4_Period.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;One would think that a cycle cannot be used here. It is not true. All we need is to declare a special array in the indicator code beginning:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-comment"&gt;//////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;//&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;//                                                  signalTable.mq4 &lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//                                                     Antonuk Oleg &lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;//                                            antonukoleg@gmail.com &lt;/span&gt;&lt;span class="hl-code"&gt;&lt;br /&gt;//&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-comment"&gt;//////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;copyright&lt;/span&gt; &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Antonuk Oleg&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;link&lt;/span&gt;      &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;antonukoleg@gmail.com&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_chart_window&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved" style="background-color: rgb(255, 204, 153);"&gt;int&lt;/span&gt;&lt;span style="background-color: rgb(255, 204, 153);"&gt; &lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(255, 204, 153);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;[]&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;=&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;{&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;1&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;5&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;15&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;30&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;60&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;240&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;1440&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;10080&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;43200&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;}&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;All periods are written down in the array, now they can easily be used in a cycle:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// use a cycle to activate all squares of the first line&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;13&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;24&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-comment"&gt;// "signal"+x+"0" - create a mark name dynamically depending on&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-comment"&gt;// the counter "x"&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;We use the array &lt;b&gt;period[]&lt;/b&gt; as a table of correspondence of the "x" counter and the period. Imagine how much code would be needed if not for this small array! So, the first row of signal squares is ready:&lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;img style="width: 427px; height: 284px;" src="http://articles.mql4.com/c/articles/2007/12/pic009_1.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Adding Writings&lt;/h3&gt; &lt;p&gt;It is all ok, but it is hard to understand what is the timeframe of the square, so let's create explanatory signatures. We will also use an array of correspondences that will store writings for each column:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_chart_window&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;5&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;15&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;30&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;60&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;240&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;10080&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;43200&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved" style="background-color: rgb(204, 255, 204);"&gt;string&lt;/span&gt;&lt;span style="background-color: rgb(204, 255, 204);"&gt; &lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[]&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;=&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;{&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;M1&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;M5&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;M15&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;M30&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;H1&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;H4&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;D1&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;W1&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-string" style="background-color: rgb(204, 255, 204);"&gt;MN1&lt;/span&gt;&lt;span class="hl-quotes" style="background-color: rgb(204, 255, 204);"&gt;"&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;}&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Writings will be created in &lt;b&gt;init()&lt;/b&gt; with the help of the following cycle:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number"&gt;12&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// create writings for periods from left to right&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;// everything is as usual&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-number"&gt;12&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;10&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;8&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Tahoma&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// we use the array periodString[], to indicate writings&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div align="center"&gt;&lt;img style="width: 431px; height: 287px;" src="http://articles.mql4.com/c/articles/2007/12/pic010_1.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Adding Some Parameters&lt;/h3&gt; &lt;p&gt;Let's make the indicator more flexible, adding a couple of parameters so that a user could set up the external view of the indicator:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;copyright&lt;/span&gt; &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Antonuk Oleg&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;link&lt;/span&gt;      &lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;antonukoleg@gmail.com&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-prepro"&gt;#property&lt;/span&gt; &lt;span class="hl-reserved"&gt;indicator_chart_window&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;extern&lt;/span&gt; &lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;scaleX&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-comment"&gt;// horizontal interval at which the squares are created&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-identifier"&gt;scaleY&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-comment"&gt;// vertical interval&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-identifier"&gt;offsetX&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;35&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-comment"&gt;// horizontal indent of all squares&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-identifier"&gt;offsetY&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;, &lt;/span&gt;&lt;span class="hl-comment"&gt;// vertical indent&lt;/span&gt;&lt;br /&gt;        &lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;20&lt;/span&gt;&lt;span class="hl-code"&gt;; &lt;/span&gt;&lt;span class="hl-comment"&gt;// font size&lt;/span&gt;&lt;br /&gt;     &lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;5&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;15&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;30&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;60&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;240&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;10080&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;43200&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M5&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M15&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M30&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H4&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;D1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;W1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;MN1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Also let's change the code of functions &lt;b&gt;init()&lt;/b&gt; and &lt;b&gt;start()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;scaleX&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;offsetX&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;scaleY&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;offsetY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;scaleX&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;offsetX&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;offsetY&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;10&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;8&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Tahoma&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;13&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;24&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Activating Other Rows&lt;/h3&gt; &lt;p&gt;The second row will indicate signals of &lt;b&gt;Williams’ Percent Range&lt;/b&gt;, the third raw – of &lt;b&gt;Parabolic SAR&lt;/b&gt;. Modifying the function &lt;b&gt;start()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;start&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;13&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&gt;&lt;/span&gt;&lt;span class="hl-tech_inds"&gt;iMA&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;24&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;))&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;0&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// activate the second row&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;// if &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;the absolute value of WPR&lt;/span&gt; &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;is lower than 20&lt;/span&gt;, this is a signal to buy&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds" style="background-color: rgb(204, 255, 204);"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;()&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;]&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;13&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;))&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;20.0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// if &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;the absolute value of WPR&lt;/span&gt; &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;is larger than 80&lt;/span&gt;, this is a signal to sell&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt; &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;MathAbs&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds" style="background-color: rgb(204, 255, 204);"&gt;iWPR&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;()&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;]&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;13&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;))&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(255, 204, 153);"&gt;&gt;&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;80.0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// else, if there are no signals, a square is painted gray&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;DarkGray&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;   &lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// activate the third row&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-comment"&gt;// if &lt;span class="hl-comment" style="background-color: rgb(255, 204, 153);"&gt;the current price&lt;/span&gt; is larger &lt;span class="hl-comment" style="background-color: rgb(204, 255, 204);"&gt;than the value of SAR&lt;/span&gt;, this is a signal to buy&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;if&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-tech_inds" style="background-color: rgb(204, 255, 204);"&gt;iSAR&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;(&lt;/span&gt;&lt;span class="hl-predfunc" style="background-color: rgb(204, 255, 204);"&gt;Symbol&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;()&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;period&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;[&lt;/span&gt;&lt;span class="hl-identifier" style="background-color: rgb(204, 255, 204);"&gt;x&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;]&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0.02&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0.2&lt;/span&gt;&lt;span class="hl-code" style="background-color: rgb(204, 255, 204);"&gt;,&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(204, 255, 204);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(204, 255, 204);"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-predvars" style="background-color: rgb(255, 204, 153);"&gt;Close&lt;/span&gt;&lt;span class="hl-brackets" style="background-color: rgb(255, 204, 153);"&gt;[&lt;/span&gt;&lt;span class="hl-number" style="background-color: rgb(255, 204, 153);"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;&lt;span style="background-color: rgb(255, 204, 153);"&gt;]&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;2&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;YellowGreen&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-comment"&gt;// otherwise, it is a signal to sell&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;2&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Tomato&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;return&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;/pre&gt; &lt;div align="center"&gt;&lt;img style="width: 456px; height: 304px;" src="http://articles.mql4.com/c/articles/2007/12/pic011.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Adding the Names of Signals&lt;/h3&gt; &lt;p&gt;Now let's put a name for each row. Let's create 3 writings on the left using an array as earlier:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;period&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-number"&gt;1&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;5&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;15&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;30&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;60&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;240&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;1440&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;10080&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;43200&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M5&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M15&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;M30&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;H4&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;D1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;W1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;MN1&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span class="hl-comment"&gt;// create one more array with indicator names&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;string&lt;/span&gt; &lt;span class="hl-identifier"&gt;signalNameString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[]&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;MA&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;WPR&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;SAR&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Change the function &lt;b&gt;init()&lt;/b&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;init&lt;/span&gt;&lt;span class="hl-brackets"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-reserved"&gt;int&lt;/span&gt; &lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;scaleX&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;offsetX&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;scaleY&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;offsetY&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;      &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;signal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-predfunc"&gt;CharToStr&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-number"&gt;110&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;fontSize&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Wingdings&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;9&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_XDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;*&lt;/span&gt;&lt;span class="hl-identifier"&gt;scaleX&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;offsetX&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSet&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJPROP_YDISTANCE&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;offsetY&lt;/span&gt;&lt;span class="hl-code"&gt;-&lt;/span&gt;&lt;span class="hl-number"&gt;10&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/span&gt;&lt;span class="hl-predfunc"&gt;ObjectSetText&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textPeriod&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;periodString&lt;/span&gt;&lt;span class="hl-brackets"&gt;[&lt;/span&gt;&lt;span class="hl-identifier"&gt;x&lt;/span&gt;&lt;span class="hl-brackets"&gt;]&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;8&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;Tahoma&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-identifier"&gt;Gold&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span class="hl-brackets"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hl-comment"&gt;// draw signal names from top downwards&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-reserved"&gt;for&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;=&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;&lt;&lt;/span&gt;&lt;span class="hl-number"&gt;3&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;++&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="hl-brackets"&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class="hl-predfunc"&gt;ObjectCreate&lt;/span&gt;&lt;span class="hl-brackets"&gt;(&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-string"&gt;textSignal&lt;/span&gt;&lt;span class="hl-quotes"&gt;"&lt;/span&gt;&lt;span class="hl-code"&gt;+&lt;/span&gt;&lt;span class="hl-identifier"&gt;y&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-consts"&gt;OBJ_LABEL&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-code"&gt;,&lt;/span&gt;&lt;span class="hl-number"&gt;0&lt;/span&gt;&lt;span class="hl-brackets"&gt;)&lt;/span&gt;&lt;span class="hl-code"&gt;;&lt;br /&gt;   &lt;/spa
