Partial closure impossible size closed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #110178 quote
    VonasiVonasi
    Moderator
    Master

    I’m testing with partial position closing and I tested the following code. It should be impossible to close half of any position if the remainder left on the market is less than 0.2 but when I check the orders list it shows positions with a size of less than 0.2 being closed.

    pst = 0.2
    
    if onmarket and close > positionprice then
    if (countofposition/2) >= pst then
    sell countofposition/2 contracts at market
    endif
    endif
    
    if onmarket and close > positionprice * 1.005 then
    sell at market
    endif
    Screenshot_15.png Screenshot_15.png
    #110186 quote
    GraHalGraHal
    Participant
    Master

    I’m testing with partial position closing

    I have to ask … thought we couldn’t close partial positions??

    #110196 quote
    VonasiVonasi
    Moderator
    Master

    We can in back testing but not in live auto trading. I’m just trying to prepare for when we hopefully can finally can use it!

    GraHal thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

From idea to ProBuilder code in seconds.

Your coding copilot for ProRealTime™. Ask in plain English — get clean, ready-to-paste indicators, screeners and systems.

Available in 7 languages
Try ProRealAI

Partial closure impossible size closed


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by VonasiVonasi
6 years, 11 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 10/15/2019
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...