Scalping Strategy – P/L Chart misaligned with Optimisation report

Forums ProRealTime English forum ProOrder support Scalping Strategy – P/L Chart misaligned with Optimisation report

Viewing 15 posts - 1 through 15 (of 18 total)
  • #179397

    Hi all,

    I am coding a simple entry/exit system, however when I try and optimise some variables I can see something odd..

    The Gains on Optimization Report (on the left), are completely misaligned with what I see on the P/L curve (on the right). (this happens even when selecting the different optimised models.

    In my past experience usign this platform I always beleived these figures were the final results of the strategy

     

    Thanks

    Gabriel

    #179407

    Optimization had never used tick by tick (intrabar) precision while ordinary backtest do. That’s why there is a “Modalita tick by tick” column that shows you on how many bars some checking should be made in a normal backtest, more bars = more differences possible.

    #179410

    The figures on the left seem to be the outcome of closed trades, while the curve is updated at any new candle.

    Is there any open trade still not reported among closed trades?

     

    #179454

    No trades are still open at the end of the strategy. But the difference between the results is rather significant.


    @Nicolas
    – is it wise to not use tick by tick opt when coding a scalping strategy? If you don’t use tick by tick are you trading at each candle’s close?

    Here is the code, if someone wants to try and run this to see their outcome…

     

    #179457

    Your equity curve shows lots of trades opening and closing in the same bar and so do not show up as positions under the equity curve.

    May be something weird in the code or could be those tight times result in trades open and close at 8 o’clock when there is high volatility?

    #179458

    Your Set Stop Trailing at Line 30 and 37 needs widening from the value for x at Line 24.

    Better still, dont use Set Stop Trailing at all as it does not work as you expect it to.  Try Set Stop Loss.

    #179462

    Hi @GraHal,

    thanks for the above.

    The actual purpose of this code is to scalp a few points in the first two minutes at the opening. As the aim is to have trades opened and closed within minutes or seconds sometimes.

    I shall try to change to Set Stop Loss and see what happens.

    If I wanted a Trailing Stop for any strategy, should I code it from scratch? rather than use Set Stop Trailing? Do you think this would be ineffective for all the strategies or for this only?

    Thanks

    Gabriel

     

    #179463

    What is the point of Lines 7 and 8 … you don’t use hh2 or hh1 anywhere?

    Also  Line 12 … ll = close * 1000 … is going to give a huge number, is this ever used?

    Just a few thoughts from looking at the code. 

    #179464

    Re Trailing Stop, use one of the many codes available here …

    Snippet Link Library

    Filter by Trail in column B and you will see several … provided by the kind Coding Wizards on here.

    #179469

    Hi @GraHal,

    thanks again.

    What I am trying to do is to Buy Stop or Sell Stop above and below the trading range occurred in 30 minutes before the open.

    I have reviewed the code as per your suggestion above (Thank you!!) and also noticed that the strategy was only selling. I fixed a couple of things and it should work as expected.

     

    However.. What I am still struggling to understand is how big the results are when backtesting tick-by-tick and when not!! The gains and the P/L curves are extremley different
    Should we use tick-by_tick for scalping strategies? (in this strategy there is only 1 trade executed with trailing trailing and take profit after all)

    Thanks
    Gabs

    #179474

    I’ll try the new code, but yes we always need to have tick by tick enabled … results are completely false without tick by tick enabled and would never be achieved in Realtime.

    When I first started on here (never coded before) I thought, wow it’s this easy to code and become a millionaire! 🙂 That was before there was even a tick by tick option to enable.

    I then spent loads of time testing testing testing as I didn’t know what was going on or why.  Eventually I advised PRT of my findings. I guess it must have been early days for Auto-Trading on PRT. Anyway all history and behind us now, just feel in a chatty mood this morning! 🙂

    #179475

    haha 🙂 find below the full code.. I thought I found the best strategy in the world but with tick by tick that’s not really true haha

    I tried playing around with different kinds of stops (trailing/loss). It’s a really basic strategy.. i was hoping it could be automated (succesfully)

    But anyway I am back at square one. If I test my strategy using tick by tick and then try an optimise Stop loss and take profit.. the P/L values are completely off between the strategy and the optimisation report (feel free to give it a try)

    #179480

    P/L values are completely off between the strategy and the optimisation report

    Please expand a bit more on what you mean by above?

    Attached results on equity curve and Detail Report are the same as the optimisation results.

    My changes in attached may not align fully with your overall strategy?  I wanted to get some Long trades (to prove the code works).

    I’m sure attached can be improved further. Feel free to reverse any changes I made,  I tend to make changes and run them rather than sit there working out what I expect to happen.

    Let’s keep at it. I like scalpers as that is mostly how I manual trade.

     

    #179484

    Btw, above was optimised over 10k bars (IS) and then run over 100k bars (OOS) so it might be a good basis for going forward?

    1 user thanked author for this post.
    #179490

    Hey @GraHal

    I think Nicolas explained this above actually.. But I am not sure I fully understand.

    If you look at the filed attached I have run an optimisation to find the best value for my Take Profit (y).
    One of the best optimisation is with Y=17.. and as you can see the expected gains are EUR 395.90 (see on the left in ‘Rapporto Ottimizzazione’ the row highlighted in orange!)

    Once I click on this, I would expect to see the latest equity value (on the equity line above) to be EUR 395.90 added to the starting capital… so I am expecting: EUR 1395.90, however this is not the case and the final equity value is EUR 1312.3 instead. There is a difference of EUR 83.6… why?


    @Nicolas
    stated:

    Optimization had never used tick by tick (intrabar) precision while ordinary backtest do. That’s why there is a “Modalita tick by tick” column that shows you on how many bars some checking should be made in a normal backtest, more bars = more differences possible.

    But if this is the case, what would be the point of having optimized variables if these don’t apply to tick-by-tick mode.. I am rather confused.

     

    Nice stuff – I can see you ran the code on DJI!! I wanted to test this too.. But I would adjust the times to the Dow opening (14:30)

    Same as you I scalp manually, hence why I am interesting in building an simple code for scalping 😀

     

Viewing 15 posts - 1 through 15 (of 18 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login