Make program take a pause after win

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #197630 quote
    Mr.Mjau
    Participant
    New

    Hi all

    Been playing around with ProRealtime for like 10w now and I have made some profits so far, but I have one problem that maybe someone can help me with.

    If this is met

    SET TARGET pPROFIT 325

    The following trade is 90% a loss. Is there a way to make the program to take a pause/break for some time for ex 12/24/36h after it has hit the target profit?

    Best wishes

    Daniel

    #197631 quote
    robertogozzi
    Moderator
    Master

    Yes, the best is pausing the strategy for N bars (you know how many bars it takes to pause 1, 4 or 48 hours).

    Add the variable TradeON to your conditions to trade:

    ONCE TradeON   = 1
    ONCE PauseBars = 20
    ONCE Count     = 0
    IF TradeON = 0 THEN
       Count = Count - 1
       TradeON = (Count = 0)
    ENDIF
    IF StrategyProfit > StrategyProfit[1] THEN
       Count = PauseBars
       TradeON = 0
    ENDIF
    IF MyLongConditions AND TradeON THEN
       BUY.....
    ENDIF
    Mr.Mjau thanked this post
    #197632 quote
    Mr.Mjau
    Participant
    New

    Hi Roberto and tank you for your fast reply

    I have sofar just used the simplyfied creation, so all this is new to me. I post the full code and mb you can tell me where and how to make your code fit?

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[20](close)
    indicator2 = ExponentialAverage[100](close)
    c1 = (indicator1 CROSSES OVER indicator2)
    
    IF c1 THEN
    BUY 5 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[20](close)
    indicator4 = ExponentialAverage[100](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    
    // Stops and targets
    SET TARGET pPROFIT 325
    #197641 quote
    robertogozzi
    Moderator
    Master

    There you go:

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    ONCE TradeON   = 1
    ONCE PauseBars = 20
    ONCE Count     = 0
    IF TradeON = 0 THEN
       Count = Count - 1
       TradeON = (Count = 0)
    ENDIF
    IF StrategyProfit > StrategyProfit[1] THEN
       Count = PauseBars
       TradeON = 0
    ENDIF
    
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[20](close)
    indicator2 = ExponentialAverage[100](close)
    c1 = (indicator1 CROSSES OVER indicator2)
     
    IF c1 AND TradeON THEN
       BUY 5 CONTRACT AT MARKET
    ENDIF
     
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[20](close)
    indicator4 = ExponentialAverage[100](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
     
    IF c2 AND TradeON THEN
       SELL AT MARKET
    ENDIF
     
    // Stops and targets
    SET TARGET pPROFIT 325
    Mr.Mjau thanked this post
    #197645 quote
    Mr.Mjau
    Participant
    New

    Tank you so much, I got it working and is now trying out different values and backtesting. But now it makes a pause after every winning trade, so both when “Condition to exit long position” makes a profit and “stops and targets” are met. Is there a way to make it only pause after the “Stops and target(set target pProfit(325))” is met?

    #197707 quote
    robertogozzi
    Moderator
    Master

    There you go:

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
     
    ONCE TradeON      = 1
    ONCE PauseBars    = 20
    ONCE Count        = 0
    ONCE PauseTrading = 1
    IF TradeON = 0 THEN
    Count = Count - 1
    TradeON = (Count = 0)
    ENDIF
    IF StrategyProfit > StrategyProfit[1] AND PauseTrading THEN
    Count = PauseBars
    TradeON = 0
    ENDIF
     
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[20](close)
    indicator2 = ExponentialAverage[100](close)
    c1 = (indicator1 CROSSES OVER indicator2)
     
    IF c1 AND TradeON THEN
    BUY 5 CONTRACT AT MARKET
    PauseTrading = 1
    ENDIF
     
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[20](close)
    indicator4 = ExponentialAverage[100](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
     
    IF c2 AND TradeON THEN
    SELL AT MARKET
    PauseTrading = 0
    ENDIF
     
    // Stops and targets
    SET TARGET pPROFIT 325
    Mr.Mjau and Midlanddave thanked this post
    #197712 quote
    Mr.Mjau
    Participant
    New

    Tank you so very much Roberto, you truly are a king among men!

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

Make program take a pause after win


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mr.Mjau @mr-mjau Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Mr.Mjau
3 years, 7 months ago.

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