Break even coding

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #71749 quote
    ChrisNYE
    Participant
    Senior

    I decided to adjust my system to a 2:1 and no trail is now required.

    Chris

    #71896 quote
    ChrisNYE
    Participant
    Senior

    I would like to thank everyone that contributed to my post. I really do appreciate your knowledge.

    Chris

    #80746 quote
    rmhandel
    Participant
    Junior

    hi guys ,

    pleae could somebody explain me why this break even i not working . The strategy don´t consider it ? I expect a Kept in profit  of 5 point but d0n´t work. thanks in advance

    //-------------------------------------------------------------------------
    // Hauptcode : SAR Kauf TOP mit BREAKEVEN 5mi
    //-------------------------------------------------------------------------
    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
    
    // Bedingungen zum Einstieg in Long-Positionen
    indicator1 = SAR[0.02,0.02,0.2]
    c1 = (indicator1 CROSSES over close)
    
    startBreakeven = 1 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep = 5 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
     
    
     
    
    //SET STOP PLOSS 10 //first stoploss
    
     
    //reset the breakevenLevel when no trade are on market
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
     
    // --- BUY SIDE ---
    //test if the price have moved favourably of "startBreakeven" points already
    IF SHORTONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
     
    
    
    
    IF c1 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Bedingungen zum Ausstieg von Long-Positionen
    indicator2 = RSI[14](close)
    c2 = (indicator2 CROSSES over 30)
    indicator3 = RSI[14](close)
    c3 = (indicator3[1] < indicator3)
    
    IF c2 AND c3 THEN
    exitshort at market
    endif
    
    #80749 quote
    robertogozzi
    Moderator
    Master

    You are going short, you should replace line 27 with

    IF SHORTONMARKET AND (tradeprice(1)-close)>=(startBreakeven*pipsize) THEN

    and line 29 with

    breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    #80750 quote
    rmhandel
    Participant
    Junior

    many thanks but i am not convinced that it works . Have you got backtest it ? In my backtests i couldn´t find stops in order (points to keep ) maybe it works not in going short .

    #80752 quote
    robertogozzi
    Moderator
    Master

    I backtested it on DAX, 5-minute TF, calculations are fine.

    Keep in mind that 1 pips is way too low, I guess, and orders in real accounts could be rejected because too close to price.

    Moreover, I just realized you are using SELL to exit a short trade, while you should use EXITSHORT (SELL is reserved to exit a LONG position).

    #80765 quote
    rmhandel
    Participant
    Junior

    i understand thanks for help

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.

Break even coding


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ChrisNYE @chrisnye Participant
Summary

This topic contains 21 replies,
has 4 voices, and was last updated by rmhandel
7 years, 5 months ago.

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