Trailing stop with supertrend

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19319 quote
    Juan Sanguineti
    Participant
    New

    What is the problem? it is to good to be truth, it works with forex pairs in daily timeframe, the attach contemplates a spread of 3 pips and a order fee of $2. the initial capital is $10000. Here is the simple code:

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = SuperTrend[3,10]
    c1 = (indicator1 <= close)
    
    IF c1 THEN
    BUY 10 SHARES AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator2 = SuperTrend[3,10]
    c2 = (indicator2 >= close)
    
    IF c2 THEN
    SELLSHORT 10 SHARES AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pTRAILING 25
    captura-de-pantalla-1482961811p4l8c1.png captura-de-pantalla-1482961811p4l8c1.png
    #19342 quote
    Nicolas
    Keymaster
    Master

    Juan, I have moved your question to forum instead of the library! 🙂

    You have been trapped into the 0 bar phenomena of ProBacktest. This is something already discussed a lot in different topics. Because the backtest engine don’t look inside bar, but only once, the takeprofit are always tested before the stoploss, so if these 2 levels are met within the same bar, you always win.

    This Probacktest behaviour has been modified (understand “fixed”) into the new PRT version 10.3 with the tick/tick option. I made a video about it: Tick by tick backtest

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Trailing stop with supertrend


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/29/2016
Status: Active
Attachments: No files
Logo Logo
Loading...