Trailing Stop, trouble when I add a trailing stop code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10082 quote
    gutta11
    Participant
    New
    
    DEFPARAM FlatBefore  =  090000  // Cancel  any pending  orders, close  any positions  andprevent placement of additional orders by the trading system before 9:30:00 in the timezone of the strategy.
    
    DEFPARAM FlatAfter= 172900 // Cancel any pending orders, close any positions and preventplacement of additional orders by the trading system after 16:00:00 in the time zone ofthe strategy.
    ONCE PreviousStatus = 0
    IF BarIndex = 0THEN
    XClose = TotalPrice
    
    XOpen = (Open+Close) /2
    ELSE
    XClose = TotalPrice
    XOpen = (XOpen[1]+ Xclose[1]) /2
    ENDIF
    IF XClose >= XOpen THEN
    IF PreviousStatus <> 1THEN
    BUY 1 SHARES AT MARKET
    PreviousStatus = 1
    ENDIF
    ELSE
    IF PreviousStatus <> -1THEN
    SELLSHORT 1 SHARES AT MARKET
    PreviousStatus = -1
    ENDIF
    Endif

    Hello guys!
    I have tried the “built in” trailing stop but it works not good in real trading.
    So i heard I need something like the code above. Is it correct that the “bulit in” trailing stop doesn’t work very well?
    Maybe I’m doing something wrong…

    However, I made a back test with the code above with DAX and some forex in mixed time frames.
    Every test failed hard..
    Do some of you nice guys have a clue what is happening?
    Take care!
    // Martin

    #10087 quote
    Nicolas
    Keymaster
    Master

    Well, without implementing the trailing stop function, I can see that your strategy open and sell position accordingly to heiken ashi candlesticks. If the present candlestick direction change, you take position on the opposite direction, it occurs very often and I don’t think that in this case, the trailing stop can do its job!

    #10430 quote
    gutta11
    Participant
    New

    Hi!

    Okey I see, big thanks. Is there any code to force the built in trailing stop to start in the next candle and not the same one as it´s opens?
    // Martin

    #10433 quote
    Nicolas
    Keymaster
    Master

    No, because each conditions are only tested once per bar. But IMO, you should do 2 different trading strategies : one for long orders and another one for short orders, this way trade will not be closed by opposite Heiken Ashi color change and it will give more breathe for your trailing stop to operate. Just my 2 cents.

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

Trailing Stop, trouble when I add a trailing stop code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
gutta11 @gutta11 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas
9 years, 7 months ago.

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