Position size limit per strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #188723 quote
    abuanzaabuanza
    Participant
    New

    Hi there,

    Sorry if this is a repeated question.

     

    i am trying to find a code to limit the number of opened positions under one strategy. For example:

    Timeframe(4hours, updateonclose)

    a = close/1.01

    Timeframe(default)

    b = close

    if b < c then

    buy 2 contracts at the Market

     

    if i were to use the above on the 1 min chart on a daily basis, how to limit the number of opened positions to 2 per day if the criteria is met.

     

    thanks

    #188735 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go (not tested):

    Timeframe(default)
    ONCE Tally = 0
    IF IntraDayBarIndex = 0 THEN
       Tally = 0
    endif
    //
    Timeframe(4hours, updateonclose)
    a = close/1.01
    //
    Timeframe(default)
    b = close
    if b < c and (Tally < 2) then
       buy 2 contracts at the Market
       Tally = Tally + 1
    endif
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

Position size limit per strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
abuanza @abuanza Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
4 years, 7 months ago.

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