forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


[ Closed ]

Forex Forum → Forex Strategy Builder Professional → MT4-FST Expert v13-Beta - BreakEven corrected.

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 1

Topic: MT4-FST Expert v13-Beta - BreakEven corrected.

- Bug fixed with Breakeven for a short position when the initial SL = 0;
- Expert recognizes FXCM, FXOpen and ODL for late SL and TP setting with additional OrderModify().

FXOpen is questionable. I'm not sure if they accept instant setting of SL and TP with OrderSend() or not. Any feed back is welcome.

The corrected BreakEven code:

///
/// Sets a BreakEven stop of current positions. 
///
void SetBreakEvenStop(string symbol)
{
    if (SetAggregatePosition(symbol) <= 0)
        return;

    double breakeven = MarketInfo(symbol, MODE_STOPLEVEL);
    if (breakeven < BreakEven_Activating_Distance)
        breakeven = BreakEven_Activating_Distance;
    else if(BreakEven_Activating_Distance > 2000)
        breakeven = 2000;
    
    if (PositionType == OP_BUY)
    {
        double bid = MarketInfo(symbol, MODE_BID);
        if (bid - PositionOpenPrice >= Point * breakeven)
            if (PositionStopLoss < PositionOpenPrice)
                SetStopLossAndTakeProfit(symbol, PositionOpenPrice, PositionTakeProfit);
    }
    else if (PositionType == OP_SELL)
    {
        double ask = MarketInfo(symbol, MODE_ASK);
        if (PositionOpenPrice - ask >= Point * breakeven)
            if (PositionStopLoss == 0 || PositionStopLoss > PositionOpenPrice)
                SetStopLossAndTakeProfit(symbol, PositionOpenPrice, PositionTakeProfit);
    }
}

Posts: 1

Pages 1

You must login or register to post a reply

Forex Forum → Forex Strategy Builder Professional → MT4-FST Expert v13-Beta - BreakEven corrected.

Similar topics in this forum