Risk Management code + ATR stop loss and ATR take limit

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #81037 quote
    razalgo
    Participant
    New

    Hi

    Require some help in adjusting the code below to reflect the following

    1. Risk management (risk 10% of captial) based upon ATR as below
    2. Stop loss 1* ATR
    3. profit take 5* ATR if the exit conditions are not met
    / Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = Average[90](close)
    c1 = (close[1] > indicator1[1])
    indicator2 = MACDline[12,26,9](close)
    indicator3 = ExponentialAverage[9](indicator2)
    c2 = (indicator2[1] CROSSES OVER indicator3[1])
    
    IF c1 AND c2 THEN
    BUY 100 PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator4 = MACDline[12,26,9](close)
    indicator5 = ExponentialAverage[9](indicator4)
    c3 = (indicator4[1] CROSSES UNDER indicator5[1])
    
    IF c3 THEN
    SELL AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator6 = Average[90](close)
    c4 = (close[1] < indicator6[1])
    indicator7 = MACDline[12,26,9](close)
    indicator8 = ExponentialAverage[9](indicator7)
    c5 = (indicator7[1] CROSSES UNDER indicator8[1])
    
    IF c4 AND c5 THEN
    SELLSHORT 100 PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    indicator9 = MACDline[12,26,9](close)
    indicator10 = ExponentialAverage[9](indicator9)
    c6 = (indicator9[1] CROSSES OVER indicator10[1])
    
    IF c6 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 50
    SET TARGET pPROFIT 200
    
    #81038 quote
    Vonasi
    Moderator
    Master

    Topic moved to ProOrder forum as it is a ProOrder coding question rather than a General Discussion subject.

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

Risk Management code + ATR stop loss and ATR take limit


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
razalgo @razalgo Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Vonasi
7 years, 5 months ago.

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