STOP LOSS UNDER THE LOW

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #63819 quote
    Ivan Donatiello
    Participant
    Average

    In a system of this type:

    C1 = LOW[2] > LOW[1]
    
    C2 = LOW[1] > LOW
    
    IF C1 AND C2 THEN
    
    if not longonmarket AND C1 AND C2  then
    buy 5 contract at High stop
    endif
    
    SET TARGET PROFIT 10

     

    what is the code to put the stop loss below the minimum?

    #63833 quote
    Leo
    Participant
    Veteran
    SET STOP pLOSS (close-lowest[2](low))/pipsize+spread

    do not forget the spread at entry the market!

    #63837 quote
    robertogozzi
    Moderator
    Master

    One ENDIF is missing!

    #63999 quote
    Ivan Donatiello
    Participant
    Average

    Thanks Roberto and Leo. But the stop does not work as I would like. In fact I want the stop under the minimum of the entrance candle and that it remains fixed there, but now it moves.

    I tried to use the stop of the post dochian channel but it does not work. This is my code

     

    // Parameters Definition
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    // Long Condition
    C1 = Low[2] > Low[1]
    C2 = Low[1] > Low
    C3 = Open[2] > Close[2]
    C4 = Open[1] > Close[1]
    C5 = Open > Close
    C6 = Low[1] > Close
    
    IF C1 AND C2 AND C3 AND C4 AND C5 AND C6 THEN
    BUY 1 CONTRACT AT High STOP
    ENDIF
    
    //Exit Profit Condition
    SET TARGET PROFIT AverageTrueRange[5](close)
    
    //Stop Loss Condition
    C7 = Low - 0.1*AverageTrueRange[5](close)
    
    if longonmarket then
    sell 1 CONTRACT at c7 stop
    endif

    Is there a way to put the stop under the minimum of the enter candle, without it moving with the passing of the bars?

    LLL.jpg LLL.jpg
    #64026 quote
    robertogozzi
    Moderator
    Master

    This is your modified code, it should do:

    // Parameters Definition
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
     
    // Long Condition
    C1 = Low[2] > Low[1]
    C2 = Low[1] > Low
    C3 = Open[2] > Close[2]
    C4 = Open[1] > Close[1]
    C5 = Open > Close
    C6 = Low[1] > Close
     
    IF C1 AND C2 AND C3 AND C4 AND C5 AND C6 AND Not OnMarket THEN
       BUY 1 CONTRACT AT High STOP
       //Exit Profit Condition
       c8 = AverageTrueRange[5](close)
       SET TARGET PROFIT c8
       //Stop Loss Condition
       C7 = Low - 0.1*c8
    ENDIF
    
    if longonmarket then
       sell 1 CONTRACT at c7 stop
    endif
    #64029 quote
    Leo
    Participant
    Veteran

    if longonmarket then    sell 1 CONTRACT at c7 stop endif

    This is a good point to ask here.

    This type of function never work for me. I don not know why.

    If I wish something like this, I have to put

    Set stop ploss (close - (Low - 0.1*c8)/pipsize

    in order to update my stop loss, or something like

    If close < Low[1] - 0.1*c8 THEN
    SELL AT MARKET
    ENDIF
    #64168 quote
    robertogozzi
    Moderator
    Master

    I tested the above code on both Dax and Eur/Usd, h1, and it works finely!

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

STOP LOSS UNDER THE LOW


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by robertogozzi
8 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/24/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...