Strategy with Risk Reward Ratio 1/3

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #151907 quote
    Oliviertrader2020
    Participant
    Average

    Hello,

    I wish to test a risk/reward ratio of 1/3 on my trading strategies based on the SL level.
    For example, for a buy, if my SL is “close < BollingerDown" and the distance between the current price and the current BollingerDown is 25pips, the TP will need to be at 75pips. Is it possible to calculate this level of TP only when entering the position to keep a fixed TP (which I wish) or will the algo recalculate the distance at each new candle which will change the TP at each calculation (which I do not wish). Here is the code for this example, how to improve it?

    // Closing trades
    
    // Stop Loss
    C11 = close < BollingerDown [20](close)
    
    // Target Profit
    BBL = BollingerDown [20](close)
    Distance = (low - BBL )*3
    C12 = close + Distance
    
    
    
    MyConditionsCloture = C11 OR C12
    
    if MyConditionsCloture AND OnMarket then
    SELL 1 lot AT market
    endif
    #152524 quote
    robertogozzi
    Moderator
    Master

    At line 4 you are NOT calculating a Stop Loss, yiou are just assigning a logical value (1 or 0) to C1 whenever CLOSE is below the lower band.

    At line 16 you

    Change it to:

    C11 = BollingerDown [20](close)

    so C1 will retain the price of the lower BB.

    Then you’ll have to move lines 3 through 9 within the IF…ENDIF where you have written the BUY instruction, to prevent C11 and C12 from changing each new candle.

    Then you need to replace line 13 with:

    MyConditionsCloture = (close <= C11) OR (close >= C12)
    #153290 quote
    Oliviertrader2020
    Participant
    Average

    Hello @robertogozzi,
    Sorry but I didn’t understand how to do it.
    For me, the calculation logic is to get the distance between the entrance fee and the SL, then multiply this distance by 3 to get the TP.
    Apparently I’m wrong unless it’s my way of coding that’s wrong.
    Can you help me with an example or the correct code please ? 🙂

    #153297 quote
    robertogozzi
    Moderator
    Master

    My fault, sorry.

    You have to replace line 4 by:

    C11 = BollingerDown [20](close)

    and line 13 by:

    MyConditionsCloture = (close <= C11) OR (close >= C12)
    #153302 quote
    robertogozzi
    Moderator
    Master

    Use the @ sign only when you have to address someone among many users.

    In this case it’s just the two of us.

    Thank  you 🙂

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

Strategy with Risk Reward Ratio 1/3


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/27/2020
Status: Active
Attachments: No files
Logo Logo
Loading...