help with daily stop!

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #116935 quote
    Makkman
    Participant
    New

    cant get the maxdailystop to work please help

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    maxdailyprofit=20000
    maxdailyloss=2
    
    once tradeallowed=1
    
    if intradaybarindex=0 then
    myprofit=strategyprofit
    tradeallowed=1
    endif
    
    if strategyprofit>=myprofit+maxdailyprofit or strategyprofit<=myprofit-maxdailyloss then
    TradeAllowed=0
    endif
    
    // Prevents the system from creating new orders to enter the market or increase position size before the specified time
    noEntryBeforeTime = 153000
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Prevents the system from placing new orders to enter the market or increase position size after the specified time
    noEntryAfterTime = 220000
    timeEnterAfter = time < noEntryAfterTime
    
    // Conditions to enter long positions
    indicator1 = RSI[2](close)
    indicator2 = RSI[2](close)+15
    c1 = (indicator1 >= indicator2[1])
    c2 = (indicator1 > 60)
    IF tradeallowed=1 and c1 and c2 and timeenterbefore and timeenterafter THEN
    BUY 0.2 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator3 = RSI[2](close)
    indicator4 = RSI[2](close)-15
    c3 = (indicator3 <= indicator4[1])
    c4 = (indicator3 < 40)
    IF tradeallowed=1 and c3 and c4 and timeenterbefore and timeenterafter THEN
    SELLSHORT 0.2 CONTRACT AT MARKET
    ENDIF
    SET STOP TRAILING 6
    
    #116938 quote
    Vonasi
    Moderator
    Master

    Makkman – Welcome to the forums. I have moved your post as it was posted in the ProBuilder forum which is for indicator topics. The ProOrder forum is the place for strategy topics. Please try to post in the correct forum with future topics.

    Thank you for using the ‘Insert PRT Code’ button when posting code but please try not to include your comments within the code. I have edited your post to separate them from the code.

    #116940 quote
    Vonasi
    Moderator
    Master

    In what way does it not work?

    20000 is quite a large profit to expect in a day before not allowing any more trades to open – what instrument are you testing on?

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

help with daily stop!


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Makkman @makkman Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Vonasi
6 years, 1 month ago.

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