Partial closure, please.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #198983 quote
    LinkLink
    Participant
    Senior

    I need code to close, for example, 0.25% of the position at 12 hours. And close another 0.25% of the position at 18 hours.

    #198988 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    ONCE LotSize  = 4
    ONCE  MinSize = 1
    ONCE ExitLots = max(LotSize * 0.25, MinSize)
     .
     .
    If OnMarket then
       If Time = 120000 OR Time = 180000 then
          Sell ExitLots contracts at Market
          Exitshort ExitLots contracts at Market
       Endif
    Endif
    Midlanddave thanked this post
    #198994 quote
    LinkLink
    Participant
    Senior

    Thanks

    #199019 quote
    LinkLink
    Participant
    Senior

    and code for 2 or 3 partial position closures?

    #199026 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You can add as many different times as needed:

    If Time = 120000 OR Time = 140000 OR Time = 170000 then
Viewing 5 posts - 1 through 5 (of 5 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

Partial closure, please.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Link @tony-manero Participant
Summary

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

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