Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Share size rounding

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Share size rounding

    Good morning,

    I have some criteria to determine Share size when submitting an order:

    EnterLongStopLimit(Convert.ToInt32(100 / ATR1[0]), High[0] + (10 * TickSize), High[0], "L");

    At times on higher prices instruments my share size is Below 1 share. It seems as if my equation result is between 1 and .05 then the strategy rounds up to 1 share. However if the equation result is below .5 then the strategy defaults to 100 shares.

    Is there a way to make any results under 1 round up to 1 for share size? Or maybe even change the default to 1 share instead of 100, if this is even what is happening?

    Thank you very much for you help,
    Ryan

    #2
    Hello Tonkingrf1551,

    Thank you for your note.

    You could calculate that outside the EnterLongStopLimit() method call and do something like this to ensure at least 1 share:

    Code:
    double myShareSize;
    
    myShareSize = 100/ATR1[0];
    
    if (myShareSize < 1)
    {
    myShareSize = 1;
    }
    
    EnterLongStopLimit(Convert.ToInt32(myShareSize), High[0] + (10 * TickSize), High[0], "L");
    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    131 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X