<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Help on a strategy]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/1838/" />
	<updated>2010-10-27T07:09:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/1838/help-on-a-strategy/</id>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7094/#p7094" />
			<content type="html"><![CDATA[<p>Hi footon,</p><p>Can you please post what I should do to correct the above problem of sending traded history by mail as I am a new commer to Mt4.</p><p>Thanks</p>]]></content>
			<author>
				<name><![CDATA[powerstar]]></name>
				<uri>https://forexsb.com/forum/user/2647/</uri>
			</author>
			<updated>2010-10-27T07:09:47Z</updated>
			<id>https://forexsb.com/forum/post/7094/#p7094</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7033/#p7033" />
			<content type="html"><![CDATA[<p>Thanks Again,&nbsp; I think I got it</p>]]></content>
			<author>
				<name><![CDATA[cruzsurfn]]></name>
				<uri>https://forexsb.com/forum/user/2378/</uri>
			</author>
			<updated>2010-10-20T18:37:37Z</updated>
			<id>https://forexsb.com/forum/post/7033/#p7033</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7032/#p7032" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>what am I replacing it with?</p></blockquote></div><p>Replace the whole function <br />void SetBreakEvenStop(string symbol)<br />with the code shown below.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2010-10-20T18:10:52Z</updated>
			<id>https://forexsb.com/forum/post/7032/#p7032</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7030/#p7030" />
			<content type="html"><![CDATA[<p>Popov,&nbsp; Thanks for all the help and for all the great work!!&nbsp; &nbsp; </p><p>I am a little confused though..<br />When you say <br />&quot;After that find the &quot;void SetBreakEvenStop(string symbol)&quot; function on line 1031 and replace it with that one:&quot;</p><p>what am I replacing it with?</p><p>Thanks again..&nbsp; &nbsp; <img src="https://forexsb.com/forum/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></content>
			<author>
				<name><![CDATA[cruzsurfn]]></name>
				<uri>https://forexsb.com/forum/user/2378/</uri>
			</author>
			<updated>2010-10-20T16:30:44Z</updated>
			<id>https://forexsb.com/forum/post/7030/#p7030</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7024/#p7024" />
			<content type="html"><![CDATA[<p>Hi,</p><p>Here is the coding, please note not only the date is not functioning, the price details and the profits are also not updating.</p><p>Thanks</p><p>//+------------------------------------------------------------------+<br />//|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MailAlert TEST.mq4 |<br />//|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Nicholishen |<br />//|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />//+------------------------------------------------------------------+<br />//http://www.forex-tsd.com/metatrader-4/1125-code-send-email-alerts-when-closed-trades.html<br />#property copyright &quot;Nicholishen&quot;<br />#property link&nbsp; &nbsp; &nbsp; &quot;&quot;<br />int k;<br />//+------------------------------------------------------------------+<br />//| expert initialization function&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />//+------------------------------------------------------------------+<br />int init()<br />&nbsp; {<br />for(int i=0;i&lt;1000;i++){<br />&nbsp; &nbsp; &nbsp; if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(OrderSymbol()==Symbol()&nbsp; ){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k++;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; }else{<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br />&nbsp; &nbsp; &nbsp; }&nbsp; <br />&nbsp; &nbsp;}<br />&nbsp; &nbsp;Comment(&quot;Init() Trades Count = &quot;,k);<br />&nbsp; &nbsp;return(0);<br />&nbsp; }<br />//+------------------------------------------------------------------+<br />//| expert deinitialization function&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />//+------------------------------------------------------------------+<br />int deinit()<br />&nbsp; {<br />//----<br />&nbsp; &nbsp;<br />//----<br />&nbsp; &nbsp;return(0);<br />&nbsp; }<br />//+------------------------------------------------------------------+<br />//| expert start function&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />//+------------------------------------------------------------------+<br />int start()<br />&nbsp; {<br />//----</p><p>int f =0;<br />&nbsp; &nbsp;for(int i=0;i&lt;10000;i++){<br />&nbsp; &nbsp; &nbsp; if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(OrderSymbol()==Symbol() /*&amp;&amp; OrderMagicNumber()==MAGICMA &amp;&amp; OrderComment() ==Cmt(Period())*/ ){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f++;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; }else{<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br />&nbsp; &nbsp; &nbsp; }&nbsp; <br />&nbsp; &nbsp;}<br />&nbsp; &nbsp;Comment(&quot; Trades in History &quot;,f,&quot; Init cnt &quot;,k&nbsp; );<br />&nbsp; &nbsp;if(k &lt; f){<br />&nbsp; &nbsp; &nbsp; string ordertyp;<br />&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; OrderSelect(f,SELECT_BY_POS,MODE_HISTORY);<br />&nbsp; &nbsp; &nbsp; if(OrderType()==0)ordertyp=&quot;BUY&quot;;<br />&nbsp; &nbsp; &nbsp; if(OrderType()==1)ordertyp=&quot;SELL&quot;;<br />&nbsp; &nbsp; &nbsp;// SendMail(&quot;HI&quot;,&quot;HI&quot;);<br />&nbsp; &nbsp; &nbsp; SendMail(&quot;CLOSED TRADE&quot;,&quot;&nbsp; &quot;+Symbol()+&quot;&nbsp; &nbsp; OpenTime: &quot;+TimeToStr(OrderOpenTime())+&quot;&nbsp; &nbsp;Close Time: &quot;+TimeToStr(OrderCloseTime())+&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;+<br />&nbsp; &nbsp; &nbsp; &quot;Order Type &quot;+ordertyp+&quot;&nbsp; &nbsp;Open &quot;+DoubleToStr(OrderOpenPrice(),4)+&quot;&nbsp; &nbsp;Close &quot;+DoubleToStr(OrderClosePrice(),4)+&quot;&nbsp; Profit (&quot;+DoubleToStr(OrderProfit(),4)+&quot;)&quot; );<br />&nbsp; &nbsp; &nbsp; k++;<br />&nbsp; &nbsp;}<br /> return;<br />} </p><br /><p>//----<br />&nbsp; <br />//+------------------------------------------------------------------+</p>]]></content>
			<author>
				<name><![CDATA[powerstar]]></name>
				<uri>https://forexsb.com/forum/user/2647/</uri>
			</author>
			<updated>2010-10-20T06:12:36Z</updated>
			<id>https://forexsb.com/forum/post/7024/#p7024</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7018/#p7018" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>powerstar wrote:</cite><blockquote><p>GBPUSD&nbsp; &nbsp; OpenTime: 1970.01.01 00:00&nbsp; &nbsp;Close Time: 1970.01.01 00:00&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />Order Type BUY&nbsp; &nbsp;Open 0.0000&nbsp; &nbsp;Close 0.0000&nbsp; Profit (0.0000)</p><p>Thank you</p></blockquote></div><p>Just a guess (without actually looking at any of the code) but it looks like the variables for passing the time and order info are not being set. The 1970 date is like the default for time objects.</p>]]></content>
			<author>
				<name><![CDATA[krog]]></name>
				<uri>https://forexsb.com/forum/user/1692/</uri>
			</author>
			<updated>2010-10-19T18:20:26Z</updated>
			<id>https://forexsb.com/forum/post/7018/#p7018</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7011/#p7011" />
			<content type="html"><![CDATA[<p>Hi,<br />Many thanks for finding that EA for me. I tried it on demo and it actually send the mail alert but the contents are not filled and all zero. It gives a date with the year 1970 and I do not know from where it is fetching the year 1970. My computer date is correct as well as the metatrader explorer have been changed. Here is the sample message which I received on my hand phone.</p><p>GBPUSD&nbsp; &nbsp; OpenTime: 1970.01.01 00:00&nbsp; &nbsp;Close Time: 1970.01.01 00:00&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />Order Type BUY&nbsp; &nbsp;Open 0.0000&nbsp; &nbsp;Close 0.0000&nbsp; Profit (0.0000)</p><p>I would appreciate if you could kindly check this and let me know.</p><p>On the other hand if there is a drop down item in the FSB ( forex Stratergy Builder) which could be inserted easily in to the EA would be very attractive. Can you please suggest this point to the owner please.</p><p>Thank you</p>]]></content>
			<author>
				<name><![CDATA[powerstar]]></name>
				<uri>https://forexsb.com/forum/user/2647/</uri>
			</author>
			<updated>2010-10-19T11:51:48Z</updated>
			<id>https://forexsb.com/forum/post/7011/#p7011</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7005/#p7005" />
			<content type="html"><![CDATA[<p>Here is how to make Break Even closing on several points profit. </p><p>Find the &quot;External variables&quot; section on line 80 and add this external variable:<br /></p><div class="codebox"><pre><code>extern int Break_Even_Shift = 5;</code></pre></div><p>It will be visible when starting the expert and you can set the Break Even shift in points. The default is 5, but you can change it.</p><p>After that find the &quot;void SetBreakEvenStop(string symbol)&quot; function on line 1031 and replace it with that one:</p><p> </p><div class="codebox"><pre><code>///
/// Sets a BreakEven stop of current positions. 
/// 
void SetBreakEvenStop(string symbol)
{
    if (SetAggregatePosition(symbol) &lt;= 0)
        return;

    double breakeven = MarketInfo(symbol, MODE_STOPLEVEL);
    if (breakeven &lt; BreakEven)
        breakeven = BreakEven;
        
    double breakprice = 0; // Break Even price including commission.   
    double commission = 0; // Commission in pips.
    if (PositionCommission != 0)
        commission = MathAbs(PositionCommission) / MarketInfo(symbol, MODE_TICKVALUE);
        
    double point  = MarketInfo(symbol, MODE_POINT);
    double digits = MarketInfo(symbol, MODE_DIGITS);
    
    if (PositionType == OP_BUY)
    {
        double bid = MarketInfo(symbol, MODE_BID);
        breakprice = NormalizeDouble(PositionOpenPrice + point * Break_Even_Shift + point * commission / PositionLots, digits);
        if (bid - breakprice &gt;= point * breakeven)
            if (PositionStopLoss &lt; breakprice)
            {
                SetStopLossAndTakeProfit(symbol, breakprice, PositionTakeProfit);
                Print(&quot;Break Even (&quot;, BreakEven, &quot; pips) set Stop Loss to &quot;,  breakprice, &quot;, Bid = &quot;, bid);
            }
    }
    else if (PositionType == OP_SELL)
    {
        double ask = MarketInfo(symbol, MODE_ASK);
        breakprice = NormalizeDouble(PositionOpenPrice - point * Break_Even_Shift - point * commission / PositionLots, digits);
        if (breakprice - ask &gt;= point * breakeven)
            if (PositionStopLoss == 0 || PositionStopLoss &gt; breakprice)
            {
                SetStopLossAndTakeProfit(symbol, breakprice, PositionTakeProfit);
                Print(&quot;Break Even (&quot;, BreakEven, &quot; pips) set Stop Loss to &quot;,  breakprice, &quot;, Ask = &quot;, ask);
            }
    }
}</code></pre></div><p>There are two modifications only. For long position:<br /></p><div class="codebox"><pre><code>breakprice = NormalizeDouble(PositionOpenPrice + point * commission / PositionLots, digits);
changed to:
breakprice = NormalizeDouble(PositionOpenPrice + point * Break_Even_Shift + point * commission / PositionLots, digits);</code></pre></div><p>And for short position:<br /></p><div class="codebox"><pre><code>breakprice = NormalizeDouble(PositionOpenPrice - point * commission / PositionLots, digits);
changed to:
breakprice = NormalizeDouble(PositionOpenPrice - point * Break_Even_Shift - point * commission / PositionLots, digits);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2010-10-19T05:23:40Z</updated>
			<id>https://forexsb.com/forum/post/7005/#p7005</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/7002/#p7002" />
			<content type="html"><![CDATA[<p>Thanks Footon,&nbsp; &nbsp; I think it would be great if that were an option,&nbsp; I was also wondering if there were an option for the trailing stop to start trailing in profit only,&nbsp; to lock in some kind of profit instead of slipping into negative territory...</p><p>Thanks</p>]]></content>
			<author>
				<name><![CDATA[cruzsurfn]]></name>
				<uri>https://forexsb.com/forum/user/2378/</uri>
			</author>
			<updated>2010-10-18T23:11:05Z</updated>
			<id>https://forexsb.com/forum/post/7002/#p7002</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6984/#p6984" />
			<content type="html"><![CDATA[<p>Is there a way to change the break even so that it stops at a 2 to 3 pip positive position</p>]]></content>
			<author>
				<name><![CDATA[cruzsurfn]]></name>
				<uri>https://forexsb.com/forum/user/2378/</uri>
			</author>
			<updated>2010-10-18T15:18:42Z</updated>
			<id>https://forexsb.com/forum/post/6984/#p6984</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6973/#p6973" />
			<content type="html"><![CDATA[<p>Yes thanks for that but the broker says that the EA must include the e-mail alert instructions. So how do we include the e-mail instructions to the EA via the Forex Stratergy Builder ? This is the problem.</p><p>Many thanks in advance</p>]]></content>
			<author>
				<name><![CDATA[powerstar]]></name>
				<uri>https://forexsb.com/forum/user/2647/</uri>
			</author>
			<updated>2010-10-18T01:56:26Z</updated>
			<id>https://forexsb.com/forum/post/6973/#p6973</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6965/#p6965" />
			<content type="html"><![CDATA[<p>Hi,</p><p>How can I set a trade alert for me to receive an e-mail or SMS on details of trades done whenever there is a trade either open or close ?</p><p>Thanks</p><p>Yes thanks for that but the broker says that the EA must include the e-mail alert instructions. So how do we include the e-mail instructions to the EA via the Forex Stratergy Builder ? This is the problem.</p><p>Many thanks in advance</p>]]></content>
			<author>
				<name><![CDATA[powerstar]]></name>
				<uri>https://forexsb.com/forum/user/2647/</uri>
			</author>
			<updated>2010-10-16T23:44:12Z</updated>
			<id>https://forexsb.com/forum/post/6965/#p6965</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6958/#p6958" />
			<content type="html"><![CDATA[<p>hello.i am new here.i would like to have a indicator to buy if moving avg(5 day,simple)crosses (7 day,expo).<br />pls,help</p>]]></content>
			<author>
				<name><![CDATA[picovishnu]]></name>
				<uri>https://forexsb.com/forum/user/2668/</uri>
			</author>
			<updated>2010-10-16T11:14:46Z</updated>
			<id>https://forexsb.com/forum/post/6958/#p6958</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6783/#p6783" />
			<content type="html"><![CDATA[<p>Thank you very much for the custom indicator. I have placed it under the custom indicators folder and it is showing up for the opening logic condition. But for the closing logic condition it is not showing up. Do I have to save it in any other folders?</p><p>Thank you.</p>]]></content>
			<author>
				<name><![CDATA[padala123]]></name>
				<uri>https://forexsb.com/forum/user/2610/</uri>
			</author>
			<updated>2010-10-04T19:45:37Z</updated>
			<id>https://forexsb.com/forum/post/6783/#p6783</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help on a strategy]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/6777/#p6777" />
			<content type="html"><![CDATA[<p>This version of the indicator applies the &quot;Use previous bar value&quot; option correctly.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2010-10-04T05:23:03Z</updated>
			<id>https://forexsb.com/forum/post/6777/#p6777</id>
		</entry>
</feed>
