Strategyprofit negative number

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #117489 quote
    J.
    Participant
    Average

    Hello, can strategyprofit be negative?

    I’m trying to make my position sizing dynamic based on how much capital I have.

    STARTINGCAPITAL = x //eg 5000 EUR
    
    SIZE = 2 / STARTINGCAPITAL //size starts with 2
    
    CAPITAL = STARTINGCAPITAL + STRATEGYPROFIT //current capital
    AMOUNT = CAPITAL * SIZE //calculate position size

    I noticed in backtesting that my position sizing won’t go down after having a negative start.

    Is there a better way to do this?

    Thanks

    #117491 quote
    J.
    Participant
    Average

    Quick side note: I’m using this to open and close positions, could it be that I first have to give a Sell and Exitshort command for my dynamic sizing to work?

    IF c1 THEN
     BUY AMOUNT CONTRACT AT MARKET
    ENDIF
    
    IF c2 THEN
     SELLSHORT AMOUNT CONTRACT AT MARKET
    ENDIF

    Edit: tested it and it didn’t work either.

    #117494 quote
    Nicolas
    Keymaster
    Master

    Strategyprofit is updated with positions closed. So you have to close positions in order to use strategyprofit to calculate your new position size.

    However you can also use this snippet to compute in real time the floating profit of the open orders at market:

    //floating profit
    floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize //actual trade gains
    J. and Nobody thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Strategyprofit negative number


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
J. @j_slowly Participant
Summary

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

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