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

Different Values for each Chart

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

    Different Values for each Chart

    Hello,

    i create a strategy, which i use for different Charts (NQ / ES / CL).

    I use int Profittarget / SL. Can i change the Values for a spezific Charts, like

    if Chart = "ES" then PF = 10
    if else Chart = "CL" then PF = xy?



    #2
    Hello Dirales,

    Yes you can do that, is this a manually coded strategy or are you using the builder?
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      i use a manually code:
      Code:
                      #region Resets ALL values when ALL positions are closed
                          if (Position.MarketPosition == MarketPosition.Flat && longEntry == null && shortEntry == null && longEntry2 == null && shortEntry2 == null && longEntry3 == null && shortEntry3 == null
                                  && targetLong == null && targetShort == null && targetLong2 == null && targetShort2 == null && targetLong3 == null && targetShort3 == null && Position.Quantity == 0)
                              {    
      //                            CurrentTriggerPrice    = 0;    CurrentStopPrice     = 0;    
                                  TrailStopBegin        = 16;    TrailFrequenz        = 1;    TrailStopDistanceMAX    = 22;    TrailStopDistance            = 16;
                                  EntryDistance        = 0;
                                  ProfitDistance1        = 22;     ProfitDistance2        = 26;    ProfitDistance3            = 32;
                                  StopDistance1        = 24;    StopDistance2        = 25;     StopDistance3            = 26;
                                  MaxOpenContract        = 5;
                                  closeopenorderafterxbar = 2;
                              }
                      #endregion​

      Comment


        #4
        Hello Dirales,

        You can do that kind of a within OnBarUpdate. Instead of using a UserInput you would use a standard variable:

        Code:
        private int pf = 10;
        protected override void OnBarUpdate()
        {
            if(Instrument.MasterInstrument.Name == "ES") pf = 12;


        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse,

          thats ( Instrument.MasterInstrument.Name ) exact what i search. Many Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by geddyisodin, 04-25-2024, 05:20 AM
          8 responses
          61 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          4 responses
          3,288 views
          1 like
          Last Post jgualdronc  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          5 views
          0 likes
          Last Post Option Whisperer  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          22 views
          0 likes
          Last Post halgo_boulder  
          Started by mishhh, 05-25-2010, 08:54 AM
          19 responses
          6,189 views
          0 likes
          Last Post rene69851  
          Working...
          X