controlling number of cumulative orders

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #160169 quote
    nonetheless
    Participant
    Master

    I have a cumulative algo running that uses the following code (in theory) to allow the total position to be 3 x positionsize, where positionsize is variable and set by the MM code.

    Once MaxPositionsAllowed = 3*positionsize
    
    IF not longonmarket and Ctime and (conditions) THEN
    BUY positionsize CONTRACT AT MARKET
    elsif longonmarket and Ctime and (conditions) and COUNTOFLONGSHARES < MaxPositionsAllowed then
    BUY positionsize CONTRACT AT MARKET
    ENDIF

    But what I find in practice is that once positionsize goes above 3 contracts, then no additional positions are opened. So at present positionsize  is 5.79 and that initial position opens as it should, but there is no 2nd or third entry, even though the conditions are met. So after it gets to 3 it’s as if cumulative orders = false.

    Is there any other way to code this, to allow for 3 entries regardless of positionsize ?

    #160170 quote
    robertogozzi
    Moderator
    Master

    Remove ONCE from line 1, otherwise it’s only executed the first time, when POSITIONSIZE is likely to be 1.

    nonetheless thanked this post
    #160178 quote
    nonetheless
    Participant
    Master

    Excellent, I thought it would be something simple like that – thanks again!

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

controlling number of cumulative orders


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by nonetheless
5 years ago.

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