Nir 1 Trade pro ZigZag Low bis High

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8358 quote
    mabro51
    Participant
    Junior

    Mein Problem für einen Backtest:

    Ich möchte nach einer Umkehr im ZigZag einsteigen und nach Erreichung der Gewinnmarke aussteigen

    ohne einen Wiedereinstieg.

    Mein Code:

    // Longtrades
    // ZigZag Kauf und Verkauf
    // Umkehrpunkt in Punkten
    m = 0.007  // Einstieg
    p = 0.003  // Verkauf mit Gewinn
    v = 0.006  // Trailingstopp
     
    indicator1 = ZigZagPoint[m](Low)  // Filter
     
    cond2  = indicator1
    Increase = ( cond2 > cond2[ 1])
    Countk = 0
    WHILE Increase[Countk] DO
    Countk = Countk + 1
    k1 = ABS(countk)
    c1 = High >= Low[k1] + m
    f1 = cond2 > cond2[1]
     
    IF c1 AND f1 THEN
    BUY  1 SHARES AT MARKET
    ENDIF
     
    WEND
     
    IF High >=TRADEPRICE + p THEN
    SELL AT MARKET
    ENDIF

     

    Wie erreiche ich, dass nicht nach Verkauf bei einer weitern Steigung sofort wieder ein Trade
    eingegangen wird?
    Besten Dank für Eure Hilfe
    #8368 quote
    Nicolas
    Keymaster
    Master

    Hallo,
    Wenn ich Ihre Anfrage richtig verstehe, sollte der modifizierte Code unten funktionieren.

    // Longtrades
    // ZigZag Kauf und Verkauf
    // Umkehrpunkt in Punkten
    m = 0.007  // Einstieg
    p = 0.003  // Verkauf mit Gewinn
    //v = 0.006  // Trailingstopp
    
    indicator1 = ZigZagPoint[m](Low)  // Filter
    
    cond2  = indicator1
    Increase = ( cond2 > cond2[ 1])
    Countk = 0
    
    if cond2>cond2[1] and cond2[1]<cond2[2] then
    lastlow = cond2[1]
    endif
    
    WHILE Increase[Countk] DO
    Countk = Countk + 1
    k1 = ABS(countk)
    c1 = High >= Low[k1] + m
    f1 = cond2 > cond2[1]
    
    IF c1 AND f1 and flag<>lastlow THEN
    BUY  1 SHARES AT MARKET
    flag = lastlow
    ENDIF
    
    WEND
    
    IF High >=TRADEPRICE + p THEN
    SELL AT MARKET
    ENDIF
    #8379 quote
    mabro51
    Participant
    Junior

    Der modifizierte Code Code arbeitet bestens.

    Vielen Dank für die rasche Hilfe.

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

Nir 1 Trade pro ZigZag Low bis High


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
mabro51 @mabro51 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by mabro51
9 years, 8 months ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 05/30/2016
Status: Active
Attachments: No files
Logo Logo
Loading...