Stop Profit doesnt work

Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #225711 quote
    killerplatuze
    Participant
    New

    Hi, i need a littlew bit help.

    Dont know why, but it doesnt work. Stop Profit should be the half of the profit-30 points. Without the SL conditions it works fine, but with….. see the attached picture.

     

    // Berechnung des aktuellen Profits long
    vProfitL = high - tradeprice(1)
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) long
    StopLossLevelL = vProfitL * 0.5-30
    
    // Berechnung des aktuellen Profits short
    vProfitS = tradeprice(1)-low
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) short
    StopLossLevelS = vProfitS * 0.5-30
    
    
    //// Bedingungen zum Einstieg in Long-Positionen
    IF NOT LongOnMarket AND close crosses over trailingsl and close > ExponentialAverage[vAverage] THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    if high-tradeprice(1) > 200 and longonmarket then
    set stop profit StopLossLevelL
    endif
    If LongOnMarket AND close < trailingsl THEN
    SELL AT MARKET
    ENDIF
    
    
    // Bedingungen zum Einstieg in Short-Positionen
    IF not shortonmarket and close crosses under  trailingsl and close < ExponentialAverage[vAverage] THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    If tradeprice(1)-low > 200 and shortonmarket then
    set stop profit StopLossLevelS
    endif
    If shortonmarket AND close > trailingsl THEN
    EXITSHORT AT MARKET
    ENDIF// Berechnung des aktuellen Profits long
    vProfitL = high - tradeprice(1)
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) long
    StopLossLevelL = (vProfitL * 0.5)-30
    
    // Berechnung des aktuellen Profits short
    vProfitS = tradeprice(1)-low
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) long
    StopLossLevelS = (vProfitS * 0.5)-30
    
    
    //// Bedingungen zum Einstieg in Long-Positionen
    IF NOT LongOnMarket AND close crosses over trailingsl and close > ExponentialAverage[vAverage] THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    if high-tradeprice(1) > 200 and longonmarket then
    set stop profit StopLossLevelL
    endif
    If LongOnMarket AND close < trailingsl THEN
    SELL AT MARKET
    ENDIF
    
    
    // Bedingungen zum Einstieg in Short-Positionen
    IF not shortonmarket and close crosses under  trailingsl and close < ExponentialAverage[vAverage] THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    If tradeprice(1)-low > 200 and shortonmarket then
    set stop profit StopLossLevelS
    endif
    If shortonmarket AND close > trailingsl THEN
    EXITSHORT AT MARKET
    ENDIF
    
    Screenshot_4.jpg Screenshot_4.jpg
    #225713 quote
    killerplatuze
    Participant
    New

    It  mus be set stop trailing, not set stop profit…. now it works

    #225716 quote
    killerplatuze
    Participant
    New

    Dont know what to do, Stop Porift dont works for me….

    If the trade is 200p in proft the sl should be 80p profit, but i cant find the cerrect way, please help me.

     

    // Bedingungen zum Einstieg in Short-Positionen
    IF not shortonmarket and close crosses under  trailingsl and close < ExponentialAverage[vAverage] THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    if tradeprice(1)-low > 100 and shortonmarket then
    //sell at market
    Set Stop Profit 80
    endif
    If shortonmarket AND close > trailingsl THEN
    EXITSHORT AT MARKET
    ENDIF
    #225720 quote
    robertogozzi
    Moderator
    Master

    Please, post the full code.

    #225756 quote
    killerplatuze
    Participant
    New

    Please, post the full code.

    THX

    atr = averagetruerange[pd]
    if high[prd] >= highest[(prd)*2+1](high) then
    ph = high[prd]
    lastpp = ph
    endif
    
    if low[prd] <= lowest[(prd)*2+1](low)  then
    pl = low[prd]
    lastpp = pl
    endif
    
    if lastpp<>lastpp[1] then
    if center=0 then
    center = lastpp
    else
    center = (center * 2 + lastpp) / 3
    endif
    endif
    
    Up = center - (Factor * averagetruerange[Pd])
    Dn = center  + (Factor * averagetruerange[Pd])
    
    
    Trend = 0
    if close[1] > TUp[1] then
    TuP = max(Up, TUp[1])
    else
    TuP= Up
    endif
    if close[1] < TDown[1] then
    TDown= min(Dn, TDown[1])
    else
    TDown= Dn
    endif
    if close > TDown[1] then
    trend = 1
    elsif close < TUp[1] then
    trend = -1
    else
    trend = Trend[1]
    endif
    
    once trend=1
    if Trend = 1 then
    trailingsl =  TUp
    r=0
    g=255
    else
    trailingsl = TDown
    r=255
    g=0
    endif
    
    TP1 = averagetruerange[3]*vTP
    TP2 = TP1 * 4
    TP3 =TP1 * 10
    SL = averagetruerange[3]*vSL
    
    // Berechnung des aktuellen Profits long
    vProfitL = high - tradeprice(1)
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) long
    StopLossLevelL = (vProfitL * 0.5)-30
    
    // Berechnung des aktuellen Profits short
    vProfitS = tradeprice(1)-low
    // Berechnung des Stop-Loss-Levels (die Hälfte des aktuellen Profits) long
    StopLossLevelS = (vProfitS * 0.5)-30
    
    
    //// Bedingungen zum Einstieg in Long-Positionen
    IF NOT LongOnMarket AND close crosses over trailingsl and close > ExponentialAverage[vAverage] THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    if high-tradeprice(1) > 100 and longonmarket then
    set stop Profit 80
    endif
    If LongOnMarket AND close < trailingsl THEN
    SELL AT MARKET
    ENDIF
    
    
    // Bedingungen zum Einstieg in Short-Positionen
    IF not shortonmarket and close crosses under  trailingsl and close < ExponentialAverage[vAverage] THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    If tradeprice(1)-low > 100 and shortonmarket then
    set stop Profit 80
    endif
    If shortonmarket AND close > trailingsl THEN
    EXITSHORT AT MARKET
    ENDIF

     

    #225775 quote
    robertogozzi
    Moderator
    Master

    Some variables are missing, please post the ITF file.

    #225795 quote
    killerplatuze
    Participant
    New

    see attached the itf file, thx

    Drehpunkt_System_SL_TP_DOW_V05.itf
    #225950 quote
    VinzentVega
    Participant
    Veteran

    try “takeprofit=80”

    #225977 quote
    killerplatuze
    Participant
    New

    Is there any chance to get help?

    #226012 quote
    killerplatuze
    Participant
    New

    Is there realy noone who can help me?  I only need a working example with the stop profit condition, thats all.

    Or it is impossible in Version 12? Or should i pay for.

    Please, i need only a little bit of help.

    #226013 quote
    GraHal
    Participant
    Master

    Try below to see if the strategy works anyway apart from the snippets including set stop Profit.

    It could be there is more wrong with the Strategy and that is why it is not working as you think it should work?

     

     

    //if high-tradeprice(1) > 100 and longonmarket then
    //set stop Profit 80
    //endif
    
    //If tradeprice(1)-low > 100 and shortonmarket then
    //set stop Profit 80
    //endif
    
    
    killerplatuze thanked this post
    #226014 quote
    killerplatuze
    Participant
    New

    Tjx, but the strategy isnt the problem. With and without Stop Profit. There will only one Trade with the Sopt Profit condition, the others will be closed immediately.

    Screenshot_2.jpg Screenshot_2.jpg
    #226016 quote
    killerplatuze
    Participant
    New
    #226019 quote
    GraHal
    Participant
    Master

    Or try this …

    if Close-tradeprice(1) > 100 and longonmarket then // Close in place of High
    set stop Profit 80
    endif
    
    If tradeprice(1)-Close > 100 and shortonmarket then // Close in place of Low
    set stop Profit 80
    endif

    Let us know how you got on.

    Anybody else feel free to jump in and help killerplatuze

    #226020 quote
    GraHal
    Participant
    Master

    I get attached now with your MeinHandelssystem1.itf  with the commented out lines as I suggested.

    Do you get the same?

    Screenshot-2024-01-05-220838.png Screenshot-2024-01-05-220838.png
Viewing 15 posts - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.

Stop Profit doesnt work


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 24 replies,
has 5 voices, and was last updated by PeterSt
2 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/26/2023
Status: Active
Attachments: 11 files
Logo Logo
Loading...