Negative trade loss control

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #107272 quote
    AlunAlun
    Participant
    Average

    This may be a question that has already been answered previously. Apologies if it is a repeat.

    When using the the calculated trailing stop based on MFE, if the trade goes negative then no trailing stop is created. I have tried to use the following where a long trade immediately starts with losses, in an attempt to minimise losses but it does not give a consistent result. Would there be a simple explanation for this failure to work. Is there a way of coding this initial loss control?

    //Here is a long example:-
    
    lossdipL = ((close-tradeprice(1))<-10 AND (BarIndex-TradeIndex)>nL)
    
    IF longonmarket AND (lossdipL) THEN
    SELL AT MARKET
    ENDIF
    #107278 quote
    VonasiVonasi
    Moderator
    Master

    Change line 3 to this:

    lossdipL = ((tradeprice(1)-close) > 10 AND (BarIndex-TradeIndex) > nL)
    #107304 quote
    AlunAlun
    Participant
    Average

    Thank you for your reply and suggestion Vonasi.

    I have tried your suggestion but it has a similar inconsistent result, or a result that does not seem to fit with the logic in the code – that is, it does not stop losses worse than 10. In the backtest, there remain losses worse than -10. My aim is to limit the losses to -10 worst case.

    #107310 quote
    NicolasNicolas
    Keymaster
    Legend

    With this code you can have more than 10 points of loss because this condition is only read at close of the bar, and at that moment the difference could be more than 10 points obviously.

    Why not using a simple SET STOP PLOSS 10 ?

    #107312 quote
    VonasiVonasi
    Moderator
    Master

    Oh – yes I now see that my calculation is identical to yours! Your second posts describes your problem much more clearly than the first and Nicolas’ answer to use SET STOP pLOSS will fix it for you as that will place a 10 pip stop on the market for every buy entry order that is filled.

    #107314 quote
    AlunAlun
    Participant
    Average

    Many thanks Nicolas and Vonasi for your replies. I will try again this evening.

    Regards

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Negative trade loss control


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Alun @alun Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by AlunAlun
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/11/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...