CumulateOrder=True not compatible with $Loss or $Profit

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #174301 quote
    deletedaccount051022
    Participant
    New

    Hi,

    Hoping someone knows a work around for this.  Am running a strategy that can take up to 2 positions, so I set CumulateOrder to True and Max Position to 2 x N contracts.  No issues back testing however, when I go to launch in production I get an error saying CumulateOrder not compatible with $LOSS stops or $PROFIT targets.  The strategy uses a $Loss stop, as well as a %Loss.

    Does anyone know of any workaround for this please?

    Thanks very much

    @AlgoHunter1 thanked this post
    #174304 quote
    deletedaccount051022
    Participant
    New

    I got this piece of code from Robo Futures Trader (one of the best sites – check it out) and it comes surprisingly close, but I’d still like to use $LOSS with CumulativeOrders.  Appreciate any ideas to try, thank you

    stoplimit=70
    atrvalue = AverageTrueRange[20](close)
    atrstopv = 40*atrvalue  
    if atrstopv>stoplimit then
    atrstop = stoplimit
    else
    atrstop = atrstopv
    endif
    
    set stop ploss atrstop
    @AlgoHunter1 thanked this post
    #174307 quote
    robertogozzi
    Moderator
    Master

    You should convert the currency amount in a percentage or pips.

    I you have a 1K amount you can convert to % with this snippet:

    CurrencySL = 1000
    PerCentSL  = (CurrencySL * 100 / close) / PipValue
    SET STOP %LOSS PerCentSL

    to convert it to Pips:

    CurrencySL = 1000
    PipsSL     = (close * ((CurrencySL * 100 / close) / PipValue) / 100) / PipSize
    SET STOP pLOSS PipsSL

    I did not test them, though.

    #174340 quote
    deletedaccount051022
    Participant
    New

    Grazie mille Roberto!  Will give that a try

    @AlgoHunter1 thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

CumulateOrder=True not compatible with $Loss or $Profit


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by deletedaccount051022
4 years, 6 months ago.

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