Limiting trades per session to 1 profit or 2 losses

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #193007 quote
    Jaanboy321
    Participant
    Average

    Hi Guys,

    Within the 2 trading sessions I’ve specified below I want to limit the number of trades as follows – I think this would be a good risk management device:

    After 1 trade closes in profit then no more trades in that session

    After 2 trades close with a loss then no more trades in that session

    Many thanks to anyone to can help out.

    Regards,

    John

     

    //TODO TO IMPROVE:
    // make TP a % of DAily ATR
    //limit so it stops after one profit per session
    //limit so it stops after 2 losses per session
    
    
    
    
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    //DEFPARAM FLATBEFORE = 130000
    //DEFPARAM FLATAFTER = 130000 //<<<<<ALTER THIS TO CLOSING TIME!!!!!!!!!!
    
    ONCE UKAMopenstart = 093000
    ONCE UKAMopenfinish =120000
    ONCE UKAMexit =130000
    
    ONCE USPMopenstart = 173000
    ONCE USPMopenfinish =201500
    
    //Exit after x minutes
    
    indicator11 = ADX[14]
    c11 = (indicator11[1] > 20.46)
    
    indicator1 = Average[3](close) //// note of4/4/22: changed this to [1] as NVIDIA and Micron didnt take and I'm wondering if thats the reason ?
    
    indicator2 = ExponentialAverage[9](close)
    b1 = (indicator1 < indicator2)
    
    indicator4 = Average[20](close)
    d1 = (indicator2 < indicator4)
     
    // Conditions to enter long positions
    IF NOT ShortOnMarket and ((time>=UKAMopenstart AND time<=UKAMopenfinish) or (time>=USPMopenstart AND time<=USPMopenfinish))AND  b1 and d1 and c11 THEN
    SELLSHORT QTY LOT AT MARKET
    
    ENDIF
    
    // Conditions to exit long positions
    //timeframe(10 minutes, updateonclose)
    indicator23 = ExponentialAverage[9](close)
    c21 = (indicator21 > indicator23)
    
    IF  c21 or (time=>UKAMexit and time<=USPMopenstart) or time>235900 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    
    
    
    indicator211 = ADX[14]
    c211 = (indicator211[1] < 20.46)
    
    indicator21 = Average[3](close) //// note of4/4/22: changed this to [1] as NVIDIA and Micron didnt take and I'm wondering if thats the reason ?
    
    indicator22 = ExponentialAverage[9](close)
    b21 = (indicator21 > indicator22)
    
    indicator24 = Average[20](close)
    d21 = (indicator22 > indicator24)
     
    // Conditions to enter long positions
    IF NOT LongOnMarket and ((time>=UKAMopenstart AND time<=UKAMopenfinish) or (time>=USPMopenstart AND time<=USPMopenfinish))AND  b21 and d21 and c211 THEN
    BUY QTY LOT AT MARKET
    
    ENDIF
    
    // Conditions to exit long positions
    //timeframe(10 minutes, updateonclose)
    indicator3 = ExponentialAverage[9](close)
    c21 = (indicator21 < indicator23)
    
    IF  c21 or (time=>UKAMexit and time<=USPMopenstart) or time>235900 THEN
    SELL AT MARKET
    ENDIF
    
    SET STOP $LOSS 110
    SET TARGET $PROFIT 31
    
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Limiting trades per session to 1 profit or 2 losses


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Jaanboy321 @jaanboy321 Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/10/2022
Status: Active
Attachments: No files
Logo Logo
Loading...