How to code user specific lot size  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
williamhk
Posts: 6
Joined: 01 Aug 2012
Has thanked: 2 times
Been thanked: 1 time

How to code user specific lot size

Postby williamhk » 07 Aug 2012

Hi all,

Is there any example how to create a contract with user specified lot size and assign to
SOrderParameters?

Thank you in advanced!

William

User avatar
JoshM
Posts: 2080
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1483 times
Contact:

Re: How to code user specific lot size

Postby JoshM » 07 Aug 2012

williamhk wrote:Is there any example how to create a contract with user specified lot size and assign to SOrderParameters?

I don't know if the specified lot size can be assigned to SOrderParameters, but you can define there Contracts.UserSpecified, and then specify your order size when you submit an order in the CalcBar() method.

For example:

Code: Select all

namespace PowerLanguage.Strategy
{
   public class TestStrategy : SignalObject
   {
      private IOrderMarket buy_order;

        protected override void Create()
        {
         buy_order   = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, "MACrossLE", EOrderAction.Buy));
      }
      
      protected override void CalcBar()
      {
         if (enterLong == true)
         {
            buy_order.Send(int numLots);
         }
      }
   }
}
These users thanked the author JoshM for the post (total 3):
adminwilliamhkMidKnight

williamhk
Posts: 6
Joined: 01 Aug 2012
Has thanked: 2 times
Been thanked: 1 time

Re: How to code user specific lot size  [SOLVED]

Postby williamhk » 07 Aug 2012

Thanks JoshM! I was exploring Conteacts.CreateUserSpecified() method which seems to be
wrong way to go.
These users thanked the author williamhk for the post:
JoshM


Return to “MultiCharts .NET”