Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Reference guide for system variable

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

    Reference guide for system variable

    Hi,

    How do I find the document or sample program on the explaination of system variable such as Position, Order etc.

    Position.AvgPrice, GetProfitLoss,MarketPosition,Quantity
    MarketPosition.Flag, Long Short
    order.Name, StopPrice, LimitPrice ....
    OrderState.Accepted, Cancelled, Filled ....

    I cannot find it in NinjaTrader Version 6 Help Guide.


    Regards,
    Toyogo

    #3
    Hi,

    Thanks for that, another question, where can I find the conversion from double to integer etc... The .Net Framework that I found as below doesn't work!!!!


    Public Shared Function ToInt32 ( _
    value As Double _
    ) As Integer

    Regards,
    Toyogo

    Comment


      #4
      Try something like:
      int i = (int) myDoubleValue;

      Comment


        #5
        Hi,

        Thanks. another question, the following setting with default qty = 2 contracts.
        protectedoverridevoid Initialize()
        {

        SetStopLoss(CalculationMode.Ticks, 20);
        SetProfitTarget(CalculationMode.Ticks, 50);
        CalculateOnBarClose =
        true;
        }

        How to change the position quantity after the order filled?

        OnBarUpdate()
        {
        if (condition1) {
        // how to set the quantity = 1
        SetStopLoss(CalculationMode.Ticks, 10);
        SetProfitTarget(CalculationMode.Ticks, 30);
        }
        }

        Regards,
        Toyogo

        Comment


          #6
          To clarify...

          You want to enter with 2 contracts but only send stop/target for 1 of 2?
          RayNinjaTrader Customer Service

          Comment


            #7
            Hi,

            I want to enter 2 contracts, initial stop/target is qty=2. Thus 2 qty will be filled if price goes against the entry and stop out. if price started running then set the 1st set of stop/target for qty=1 on 1st condition; if 1st condition filled then set the 2nd set of stop/target for qty=1 (reminding qty) on 2nd condition.



            Regards,
            Toyoto

            Comment


              #8
              Thanks. The only way you can do that is by using the ExitLong() or ExitStop() type approach vs Set() methods. Then specify the quanty of 2, then change to 1. I believe this should work.
              RayNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by puapwr, Today, 06:09 PM
              0 responses
              2 views
              0 likes
              Last Post puapwr
              by puapwr
               
              Started by franciscog21, Today, 05:27 PM
              0 responses
              5 views
              0 likes
              Last Post franciscog21  
              Started by hdge4u, 04-29-2024, 12:23 PM
              5 responses
              28 views
              0 likes
              Last Post MisterTee  
              Started by llanqui, 01-25-2024, 06:15 PM
              9 responses
              64 views
              0 likes
              Last Post MisterTee  
              Started by tradingnasdaqprueba, 05-07-2024, 03:42 AM
              16 responses
              67 views
              0 likes
              Last Post tradingnasdaqprueba  
              Working...
              X