Order's Time-in-force.


SYNTAX


public TimeInForce TimeInForce { get; }


EXAMPLE


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using PTLRuntime.NETScript;

namespace OrderClassExamples
{    
     public class OrderClassExamples : NETStrategy
     {
         Position[] All_pos;
         Order[] All_ord;
         string ord_Id;
         
         public override void OnQuote()
         {
             //Check how much positions we have
             All_pos = Positions.GetPositions();
             All_ord = Orders.GetOrders(false);

             if(All_pos.Length==0)
             {
                 //There is no open positions, lets create BuyLimit
                 if(All_ord.Length==0)
                 {
                     NewOrderRequest request = NewOrderRequest.CreateBuyStop(Instruments.Current,1,1970,Accounts.Current);
                     ord_Id = Orders.Send(request);
                 }
       
                 //Lets check all orders and cancel order with some order ID      
             }
             
             if(All_ord.Length!=0)
             {
           for(int i=0;All_ord.Length-1>i;i++)
             {
               if(All_ord[i].Id==ord_Id)
             {
        
             //if we want to see all Properties of this order we have to do such operations:
             Print(All_ord[i].Account);
             Print(All_ord[i].Amount);
             Print(All_ord[i].AutoTradeOrder);
             Print(All_ord[i].CloseTime);
             Print(All_ord[i].Comment);
             Print(All_ord[i].CurrentPrice);
             Print(All_ord[i].ExpirationTime);
             Print(All_ord[i].FilledAmount);
             Print(All_ord[i].FillPrice);
             Print(All_ord[i].GroupId);
             Print(All_ord[i].Id);
             Print(All_ord[i].Instrument);
             Print(All_ord[i].IsActive);
                     Print(All_ord[i].IsGroupPart);
             Print(All_ord[i].IsReplaceable);
             Print(All_ord[i].IsStopLossOrder);
             Print(All_ord[i].IsTakeProfitOrder);
             Print(All_ord[i].LastUpdateTime);
             Print(All_ord[i].LinkedTo);
             Print(All_ord[i].MagicNumber);
             Print(All_ord[i].Price);
             Print(All_ord[i].RemoteId);
             Print(All_ord[i].Side);
             Print(All_ord[i].StopLimitPrice);
             Print(All_ord[i].StopLossOrder);
             Print(All_ord[i].TakeProfitOrder);
             Print(All_ord[i].Time);
             Print(All_ord[i].TimeInForce);
             Print(All_ord[i].Type);
                
             //if we want to modify this order we have to do such operations:
             ReplaceOrderRequest ror = new ReplaceOrderRequest();
             ror.Price=1953;
             ror.Type=OrdersType.Limit;
             All_ord[i].Modify(ror);
         
         
             //We get order with ID=ord_Id and now we can do such operations:
             All_ord[i].Cancel();
             All_ord[i].RemoveStopLoss();
             All_ord[i].RemoveTakeProfit();
             All_ord[i].SetStopLoss(1950);
             All_ord[i].SetTakeProfit(1980);
             }
                 }
             }
         }
     }
}