Cumsum long/short positions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #136262 quote
    Albaran
    Participant
    Average

    Hi there,

    I need my system to know how long/short I am in the market even though I, personnally, can’t/ could not possibly know…

    Below piece of code assumes that I have been building up on positions..

    Is this going to work? :

    countof(long/short)shares = cumsum(countof(long/short)shares)

    Thanks for your replies

    #136263 quote
    robertogozzi
    Moderator
    Master

    You don’t need to do any math.

    CountOfLongShares and CountOfShortShares return the data you need. Since you cannot have Long and Short trades opened at the same time, that’s all you need.

    CountOfPosition returns the same data, but as a positive number for Long trades and negative numbers for Short trades (you may use ABS() to work this around).

    They return data relative to the current strategy, since knowing what other strategies do is not currently supported.

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

Cumsum long/short positions


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Albaran @albaran Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
5 years, 8 months ago.

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