How to stop loss at 1min OHLC?

Discussion in 'Trading Systems and Strategies' started by johnnybegoode, Apr 18, 2019.

  1. johnnybegoode

    johnnybegoode Trader

    53
    0
    22
    Backtesting using Every Tick and 1 min OHLC yield very different result.
    1 min OHLC is profitable while Every Tick is losing.

    Would it be possible to perform the StopLoss() function at 1 min OHLC intervals
    even when Backtesting Every Tick?
    Would that make the strategy to be profitable?
     
  2. Properly

    Properly Master Trader

    33
    0
    47
    Please tell something more about your SL logic. Basing on what you wrote I conclude that you update your SL every tick and thats why Bactesting every tick gives different result. Maybe try to change SL to update after close of each candle.
     
  3. johnnybegoode

    johnnybegoode Trader

    53
    0
    22
    How could I change the SL to update after the closing of each candle?
    Thanks!

    MT5
    Code (MQL5):
    void StopLoss2()
    {
       double Incre_SL = NormalizeDouble( AccountInfoDouble(ACCOUNT_EQUITY)/AccountInfoDouble(ACCOUNT_BALANCE), 3);
       if (Incre_SL <= Stop_Loss_Level2)  
       {
          {
          Ordering=false;
          CloseAll3();
          }
       }

    }
     
  4. Properly

    Properly Master Trader

    33
    0
    47
    So I was right, your SL is updated every tick. I do not code in Mt5 so I can't help you with the code but I found similar thread in mql5 forum, I think you should also search there.
    https://www.mql5.com/en/forum/203028
     
  5. Enivid

    Enivid Administrator Staff Member

    11,012
    404
    114
    When you are backtesting on Every Tick data, you get a higher resolution of price data than when backtesting on 1 Min OHLC. Changing your EA to check the SL on M1 opens rather than on every tick will not make it profitable in real market trading.
     

Share This Page