<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — MT4-FST Expert v13-Beta - BreakEven corrected.]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/1213/" />
	<updated>2009-12-16T08:58:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/1213/mt4fst-expert-v13beta-breakeven-corrected/</id>
		<entry>
			<title type="html"><![CDATA[MT4-FST Expert v13-Beta - BreakEven corrected.]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/3920/#p3920" />
			<content type="html"><![CDATA[<p>- Bug fixed with Breakeven for a short position when the initial SL = 0;<br /> - Expert recognizes FXCM, FXOpen and ODL for late SL and TP setting with additional OrderModify().</p><p>FXOpen is questionable. I&#039;m not sure if they accept instant setting of SL and TP with OrderSend() or not. Any feed back is welcome.</p><p>The corrected BreakEven code:<br /></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_Activating_Distance)
        breakeven = BreakEven_Activating_Distance;
    else if(BreakEven_Activating_Distance &gt; 2000)
        breakeven = 2000;
    
    if (PositionType == OP_BUY)
    {
        double bid = MarketInfo(symbol, MODE_BID);
        if (bid - PositionOpenPrice &gt;= Point * breakeven)
            if (PositionStopLoss &lt; PositionOpenPrice)
                SetStopLossAndTakeProfit(symbol, PositionOpenPrice, PositionTakeProfit);
    }
    else if (PositionType == OP_SELL)
    {
        double ask = MarketInfo(symbol, MODE_ASK);
        if (PositionOpenPrice - ask &gt;= Point * breakeven)
            if (PositionStopLoss == 0 || PositionStopLoss &gt; PositionOpenPrice)
                SetStopLossAndTakeProfit(symbol, PositionOpenPrice, PositionTakeProfit);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2009-12-16T08:58:19Z</updated>
			<id>https://forexsb.com/forum/post/3920/#p3920</id>
		</entry>
</feed>
