Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged order

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

    Unmanaged order

    Hello !!! i try to use unmanaged order and for some reason i have muly entryes for every single order
    is any way i can access my position ?
    use BarsSinceEntry ?


    Unmanaged = true;
    Cbi.Position myPosition = Account.Positions.FindByInstrument(Instrument);

    if (myPosition == null)
    if(Position.MarketPosition == MarketPosition.Flat)
    if(Close[0] > Close[1] )
    if (BarsInProgress == 0)
    {
    BuyOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Limit, Lot, Close[0], 0, "", "Enter Long");
    }

    #2
    GainForex,

    Thank you for your post.

    Please use the EntriesPerDirection and EntryHandling to control the number of entries on each side.

    Comment


      #3
      yes i use it but same problem Multy orders , it is work with Unmanaged order ?
      EntriesPerDirection = 1;
      EntryHandling = EntryHandling.AllEntries;

      Comment


        #4
        i think i find the problem but i dont know how to fix it
        every 10min strategy submit new limit order and dont remove it

        i add rools but no result

        barNumberOfOrder = CurrentBar;
        }


        if (CurrentBar > barNumberOfOrder + 5)
        CancelOrder(BuyOrder);
        }

        Comment


          #5
          Hello GainForex,

          Thank you for your response.

          EntryHandling and EntriesPerDirection would not work with Unmanaged Approach. My mistake.

          This means you would need a condition to prevent multiple entries. If you wanted only one entry you could use a bool, if you wanted to multiple you would track the number of entries with your our count.

          For example:
          Code:
                  #region Variables
                  private int count = 0;
          		private bool inTrade = false;
                  #endregion
          		
                  protected override void Initialize()
                  {
                      CalculateOnBarClose = true;
          			Unmanaged = true;
                  }
          		
                  protected override void OnBarUpdate()
                  {
          			// if we just wanted one entry
          			if(!inTrade)
          			{
          				SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, 0, 0, "", "LONG");
          				inTrade = true;
          			}
          			if(Position.MarketPosition == MarketPosition.Flat)
          				inTrade = false;
          			
          			// if we wanted several trades (went with 3 here)
          			if(count < 3)
          			{
          				SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, 0, 0, "", "LONG");
          				count++;
          			}
                  }
          		
          		protected override void OnExecution(IExecution e)
          		{
          			if(e.Order != null
          				&& e.Order.Name == "Long"
          				&& e.Order.OrderState == OrderState.Filled)
          				count--;
          		}

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X