Is backtesting simply simulated trades on historic data?

Discussion in 'Automated Trading' started by entrade, Jul 7, 2018.

  1. Yes, I actually tried to do it. The problem is in getting the right entry price, not in exiting the trade. By using tighter stops I increased chances of them being hit. But, if I tried to use wider stops, my feeling of the market stops to make any sense. Going for 50 pips with a 100-pip stop isn't something I will be proud of :)

    PS: By the way, I made some progress in this area at the very end of my trading career after I used my simulator for a while. I just found that I don't like the idea of trading. I feel that with more training I would finally manage to feel the right stop level, it just doesn't feel sexy to me.
     
    #21     Jul 26, 2018
  2. Perhaps i wasn't clear.I am talking about time stops only.Nothing to do with distance from entry.If my trade is not in profit by <1 tick it gets closed after such and such amount of time.
    Lets say in the price channel that amount of time is a little bit more because i would expect a whipsaw and when price is outside of bands of channel it would be less time,because i would be worried about loss of profit from reversal.
    Or just time based stops regardless what price is doing and where it is now.Lets say if i am not in profit in 20 min time trade gets closed.Possibilities are endless,goal is to overcome whipsaw.
    Did you test these kind of ideas?
    If not maybe you find place for them in that tester you are building
     
    #22     Jul 26, 2018
  3. Now I understand what do you mean by time-based stops.

    I personally tested 2 approaches:

    1. Closing positions after some time. It's the easiest one and makes complete sense because market changes. If something didn't work out as expected, the market will become different and old predictions become obsolete. Moreover, I would be surprised if somebody will keep a poisition forever :)

    From my personal experience, a time to close is as important as a stop loss/take profit level. When you enter the market, you should know not only when you are "right" or "wrong", but also the horizons of your decision. Will you enter the market again if you knew in advance that the market will not behave as expected? This "unexpected behaviour" means that you were wrong from the very beginning, there is no point in taking more risks. That's my personal opinion.

    2. Making tighter stop losses with the time spent in the market. I even wrote a MetaTrader script for this purpose. What it did is just moving stops closer over time. Not a good idea, I must say. At the end, you have such tight stops that get touched by the market noize. I would prefer to move stops to breakeven, but not closer. It's better to wait for the profit to grow, but making tighter and tighters stops kills the idea.

    Why don't you try it by yourself?

    I finally decided to make the product free, trying to make money with advertising and selling its sources. This kind of strategies can be tested manually, no need to write any extra code. Download and install it, it will take 5-10 minutes total.
     
    Last edited: Jul 26, 2018
    #23     Jul 26, 2018
  4. When you enter the market, you should know not only when you are "right" or "wrong", but also horizons of your decision.

    There is also another consideration that with time stops you could possibly be wrong only once.

    Making tighter stop losses with time spent in the market. I even wrote a MetaTrader script for this purpose. What it did is just moving stops closer over time. Not a good idea, I must say

    I am in agreement with you here, trailing stops are terrible idea

    Why don't you try it by yourself?

    I did spend lots time on this.you wouldn't find me here if i was doing testing.
     
    #24     Jul 26, 2018
    MaxPastukhov likes this.
  5. That sound s about right 70% of trends are fake or will not last 20 days, including stocks under $5.
    But a volume ETF like QQQ ........ makes higher highs,[month, weeks....] higher lows, higher closes,much more than 20 days/bull market. Even a historic weak Nasdaq month like JUL; looks strong this month-not a prediction.May go down in SEPT; most do
     
    #25     Jul 27, 2018
  6. ronblack

    ronblack

    Backtesting algo is usually different from real-time order generation algo although they may share key components having to do with signal generation.

    So the answer may be it depends what you mean by algo. In addition your question cannot be separated from the nuances as you call them. I have found this short article very useful.
     
    Last edited: Aug 13, 2018
    #26     Aug 13, 2018
    murray t turtle likes this.
  7. mikelight

    mikelight

    Simple backtesting is something like this:

    double[] SimpleBackTest(double[] ask, double[] bid, double[] signal)
    {
    double[] equity = new double[signal.Length];
    double curentPoss = 0, curentBallance = 0, curentEquity = 0;
    for (int i = 0; i < signal.Length; i++)
    {
    if (signal > 0) curentBallance -= signal * ask;
    if (signal < 0) curentBallance -= signal * bid;
    curentPoss += signal;
    if (curentPoss > 0) curentEquity = curentBallance + curentPoss * bid;
    if (curentPoss < 0) curentEquity = curentBallance + curentPoss * ask;
    equity = curentEquity;
    }

    return equity;
    }
     
    #27     Aug 24, 2018