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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X