Cumsum long/short positions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #136262 quote
    AlbaranAlbaran
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 robertogozzirobertogozzi
6 years, 3 months ago.

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