Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder as a parameter

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

    IOrder as a parameter

    Is it possible to pass in a IOrder variable to a method that will create my entry? for example:
    protected override void OnBarUpdate()
    {
    EnterPosition(entryOrder_1, ENTRY_ONE, T1_positionQuantity);

    }


    private void EnterPosition(IOrder entryOrder, int entryTag, int positionQuantity)
    {
    if (entryOrder == null and some other condition)

    entryOrder = EnterLongLimit(0,true, positionQuantity, lowerBandEntry, "Long_" + entryTag);
    }

    The problem I am having is that once I have entered the position, my if-statement continues to always evaluate to true. In other words, my entryOrder(IOrder) variable remains null. However, if I print out the entryOrder.Token just after entering the position, then there is a value there. When the OnOrderUpdate fires, it fires with the same Token value. But if I print out the explicit variable that was passed into the EnterPosition method(entryOrder_1), then it is blank.

    Is it possible that the entryOrder_1 variable that is passed into EnterPosition method is passed "By Value" and not as an object reference??

    #2
    Not to worry, I solved the problem by ading the "ref" keyword to the parameters.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    574 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X